Reviewers: Toon Verwaest,

Message:
PTAL

Description:
Make ComputeReceiverForNonGlobal faster

by checking instance type rather than constructor.

BUG=chromium:461734
LOG=n
[email protected]

Please review this at https://codereview.chromium.org/953283004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+4, -6 lines):
  M src/runtime/runtime-scopes.cc


Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index 201bf9d4c683030fcdcc3a15d94a7b51b02869ca..9706e1dc98f864776794e579abb3d709ed6018fb 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -855,16 +855,14 @@ RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) {

static Object* ComputeReceiverForNonGlobal(Isolate* isolate, JSObject* holder) {
   DCHECK(!holder->IsGlobalObject());
-  Context* top = isolate->context();
-  // Get the context extension function.
-  JSFunction* context_extension_function =
-      top->native_context()->context_extension_function();
+
   // If the holder isn't a context extension object, we just return it
   // as the receiver. This allows arguments objects to be used as
   // receivers, but only if they are put in the context scope chain
   // explicitly via a with-statement.
-  Object* constructor = holder->map()->GetConstructor();
-  if (constructor != context_extension_function) return holder;
+  if (holder->map()->instance_type() != JS_CONTEXT_EXTENSION_OBJECT_TYPE) {
+    return holder;
+  }
   // Fall back to using the global object as the implicit receiver if
   // the property turns out to be a local variable allocated in a
   // context extension object - introduced via eval.


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to