Speed up native error check. (issue 11377100)

0 views
Skip to first unread message

ul...@chromium.org

unread,
Nov 12, 2012, 10:09:30 AM11/12/12
to yan...@chromium.org, v8-...@googlegroups.com
Reviewers: Yang,

Message:
PTAL

Description:
Speed up native error check.

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


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




yan...@chromium.org

unread,
Nov 12, 2012, 10:11:01 AM11/12/12
to ul...@chromium.org, v8-...@googlegroups.com
On 2012/11/12 15:09:29, ulan wrote:
> PTAL

LGTM.

https://chromiumcodereview.appspot.com/11377100/
Reply all
Reply to author
Forward
0 new messages