Revision: 12938
Author:   [email protected]
Date:     Mon Nov 12 07:33:31 2012
Log:      Speed up native error check.

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

Review URL: https://chromiumcodereview.appspot.com/11377100
http://code.google.com/p/v8/source/detail?r=12938

Modified:
 /branches/bleeding_edge/src/api.cc

=======================================
--- /branches/bleeding_edge/src/api.cc  Mon Nov 12 04:34:18 2012
+++ /branches/bleeding_edge/src/api.cc  Mon Nov 12 07:33:31 2012
@@ -2309,7 +2309,11 @@
 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