Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 4820f9d57f385a1c1c49e6fbc2765c60128ca542..e86430776d4d8ca30bf27e348caae58830231e91 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -2309,7 +2309,11 @@ static i::Object* LookupBuiltin(i::Isolate* isolate, |
static bool CheckConstructor(i::Isolate* isolate, |
i::Handle<i::JSObject> obj, |
const char* class_name) { |
- return obj->map()->constructor() == LookupBuiltin(isolate, class_name); |
+ i::Object* constr = obj->map()->constructor(); |
+ if (!constr->IsJSFunction()) return false; |
+ i::JSFunction* func = i::JSFunction::cast(constr); |
+ return func->shared()->native() && |
+ constr == LookupBuiltin(isolate, class_name); |
} |