Speed up native error check.

BUG=148757
TEST=largeObj test from the bug is 2x faster.
R=yangguo@chromium.org

Review URL: https://chromiumcodereview.appspot.com/11377100

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12938 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ulan@chromium.org 2012-11-12 15:33:31 +00:00
parent ce884e13e3
commit acd3013d9d

View File

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