Reviewers: Kevin Millikin,

Description:
Convert global objects to global receivers before invoking
JavaScript functions on them.

Please review this at http://codereview.chromium.org/165122

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/execution.cc


Index: src/execution.cc
===================================================================
--- src/execution.cc    (revision 2641)
+++ src/execution.cc    (working copy)
@@ -83,6 +83,14 @@
      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
      // allocation of handles without explicit handle scopes.



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

Reply via email to