Reviewers: Yang,

Message:
PTAL

Description:
Speed up native error check.

BUG=148757
TEST=largeObj test from the bug is 2x faster.
[email protected]


Please review this at https://chromiumcodereview.appspot.com/11377100/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/api.cc


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);
 }




--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to