Optimize the case when creating plain object
This commit is contained in:
parent
6785870dde
commit
3d2163230b
1 changed files with 5 additions and 3 deletions
|
@ -10,14 +10,16 @@
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
v8::Local<v8::Object> CreateObjectWithName(v8::Isolate* isolate,
|
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);
|
v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
|
||||||
t->SetClassName(name);
|
t->SetClassName(mate::StringToV8(isolate, name));
|
||||||
return t->GetFunction()->NewInstance();
|
return t->GetFunction()->NewInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> GetHiddenValue(v8::Local<v8::Object> object,
|
v8::Local<v8::Value> GetHiddenValue(v8::Local<v8::Object> object,
|
||||||
v8::Local<v8::String> key) {
|
v8::Local<v8::String> key) {
|
||||||
return object->GetHiddenValue(key);
|
return object->GetHiddenValue(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue