Revision: 3459
Author: [email protected]
Date: Mon Dec 14 01:54:13 2009
Log: Try to make the contextuality check in the IC code faster
by checking if the receiver is a global object before diving
into traversing reloc info.
Review URL: http://codereview.chromium.org/491075
http://code.google.com/p/v8/source/detail?r=3459
Modified:
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/src/ic.h
/branches/bleeding_edge/src/stub-cache.cc
=======================================
--- /branches/bleeding_edge/src/ic.cc Wed Nov 11 01:50:06 2009
+++ /branches/bleeding_edge/src/ic.cc Mon Dec 14 01:54:13 2009
@@ -409,7 +409,7 @@
if (!lookup.IsValid()) {
// If the object does not have the requested property, check which
// exception we need to throw.
- if (is_contextual()) {
+ if (IsContextual(object)) {
return ReferenceError("not_defined", name);
}
return TypeError("undefined_method", object, name);
@@ -428,7 +428,7 @@
// If the object does not have the requested property, check which
// exception we need to throw.
if (attr == ABSENT) {
- if (is_contextual()) {
+ if (IsContextual(object)) {
return ReferenceError("not_defined", name);
}
return TypeError("undefined_method", object, name);
@@ -628,7 +628,7 @@
// If lookup is invalid, check if we need to throw an exception.
if (!lookup.IsValid()) {
- if (FLAG_strict || is_contextual()) {
+ if (FLAG_strict || IsContextual(object)) {
return ReferenceError("not_defined", name);
}
LOG(SuspectReadEvent(*name, *object));
@@ -671,7 +671,7 @@
if (result->IsFailure()) return result;
// If the property is not present, check if we need to throw an
// exception.
- if (attr == ABSENT && is_contextual()) {
+ if (attr == ABSENT && IsContextual(object)) {
return ReferenceError("not_defined", name);
}
return result;
@@ -843,7 +843,7 @@
// If lookup is invalid, check if we need to throw an exception.
if (!lookup.IsValid()) {
- if (FLAG_strict || is_contextual()) {
+ if (FLAG_strict || IsContextual(object)) {
return ReferenceError("not_defined", name);
}
}
@@ -859,7 +859,7 @@
if (result->IsFailure()) return result;
// If the property is not present, check if we need to throw an
// exception.
- if (attr == ABSENT && is_contextual()) {
+ if (attr == ABSENT && IsContextual(object)) {
return ReferenceError("not_defined", name);
}
return result;
=======================================
--- /branches/bleeding_edge/src/ic.h Thu Dec 10 07:10:50 2009
+++ /branches/bleeding_edge/src/ic.h Mon Dec 14 01:54:13 2009
@@ -104,7 +104,16 @@
// Returns if this IC is for contextual (no explicit receiver)
// access to properties.
- bool is_contextual() {
+ bool IsContextual(Handle<Object> receiver) {
+ if (receiver->IsGlobalObject()) {
+ return SlowIsContextual();
+ } else {
+ ASSERT(!SlowIsContextual());
+ return false;
+ }
+ }
+
+ bool SlowIsContextual() {
return ComputeMode() == RelocInfo::CODE_TARGET_CONTEXT;
}
=======================================
--- /branches/bleeding_edge/src/stub-cache.cc Wed Dec 9 06:54:34 2009
+++ /branches/bleeding_edge/src/stub-cache.cc Mon Dec 14 01:54:13 2009
@@ -831,7 +831,7 @@
// can't use either LoadIC or KeyedLoadIC constructors.
IC ic(IC::NO_EXTRA_FRAME);
ASSERT(ic.target()->is_load_stub() || ic.target()->is_keyed_load_stub());
- if (!ic.is_contextual()) return Heap::undefined_value();
+ if (!ic.SlowIsContextual()) return Heap::undefined_value();
// Throw a reference error.
HandleScope scope;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev