Optimize the case when creating plain object

This commit is contained in:
Cheng Zhao 2015-12-28 22:51:01 +08:00
parent 6785870dde
commit 3d2163230b

View file

@ -10,14 +10,16 @@
namespace {
v8::Local<v8::Object> CreateObjectWithName(v8::Isolate* isolate,
v8::Local<v8::String> name) {
const std::string& name) {
if (name == "Object")
return v8::Object::New(isolate);
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
t->SetClassName(name);
t->SetClassName(mate::StringToV8(isolate, name));
return t->GetFunction()->NewInstance();
}
v8::Local<v8::Value> GetHiddenValue(v8::Local<v8::Object> object,
v8::Local<v8::String> key) {
v8::Local<v8::String> key) {
return object->GetHiddenValue(key);
}