Commit bcbef79a authored by kasperl@chromium.org's avatar kasperl@chromium.org

Convert global objects to global receivers before invoking

JavaScript functions on them.
Review URL: http://codereview.chromium.org/165122

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2642 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b290c323
...@@ -83,6 +83,14 @@ static Handle<Object> Invoke(bool construct, ...@@ -83,6 +83,14 @@ static Handle<Object> Invoke(bool construct,
code = stub.GetCode(); 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 // Save and restore context around invocation and block the
// allocation of handles without explicit handle scopes. // allocation of handles without explicit handle scopes.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment