Revision: 2642
Author: [email protected]
Date: Fri Aug  7 00:15:16 2009
Log: Convert global objects to global receivers before invoking
JavaScript functions on them.
Review URL: http://codereview.chromium.org/165122
http://code.google.com/p/v8/source/detail?r=2642

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

=======================================
--- /branches/bleeding_edge/src/execution.cc    Wed Jul 29 04:55:26 2009
+++ /branches/bleeding_edge/src/execution.cc    Fri Aug  7 00:15:16 2009
@@ -82,6 +82,14 @@
      JSEntryStub stub;
      code = stub.GetCode();
    }
+
+  // Convert calls on global objects to be calls on the global
+  // receiver instead to avoid having a 'this' pointer which refers
+  // directly to a global object.
+  if (receiver->IsGlobalObject()) {
+    Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
+    receiver = Handle<JSObject>(global->global_receiver());
+  }

    {
      // Save and restore context around invocation and block the

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to