__ mov(r0, Operand(var->name()));
__ push(r0);
- // TODO(120): use JSGlobalObject for function lookup and inline cache,
- // and use global proxy as 'this' for invocation.
+ // TODO(120): Use global object for function lookup and inline
+ // cache, and use global proxy as 'this' for invocation.
LoadGlobalReceiver(r0);
// Load the arguments.
// Load the function.
Load(function);
- // Pass the global object as the receiver.
- // TODO(120): use JSGlobalObject for function lookup and inline cache,
- // and use global proxy as 'this' for invocation.
+ // Pass the global proxy as the receiver.
LoadGlobalReceiver(r0);
+
// Call the function.
CallWithArguments(args, node->position());
__ push(r0);
// evaluated.
// Compute function to call and use the global object as the
- // receiver.
+ // receiver. There is no need to use the global proxy here because
+ // it will always be replaced with a newly allocated object.
Load(node->expression());
- LoadGlobalReceiver(r0);
+ LoadGlobal();
// Push the arguments ("left-to-right") on the stack.
ZoneList<Expression*>* args = node->arguments();
// Push the name of the function and the receiver onto the stack.
frame_->Push(Immediate(var->name()));
- // TODO(120): use JSGlobalObject for function lookup and inline cache,
- // and use global proxy as 'this' for invocation.
+ // TODO(120): Use global object for function lookup and inline
+ // cache, and use global proxy as 'this' for invocation.
LoadGlobalReceiver(eax);
// Load the arguments.
// Load the function.
Load(function);
- // Pass the global object as the receiver.
-
- // TODO(120): use JSGlobalObject for function lookup and inline cache,
- // and use global proxy as 'this' for invocation.
+ // Pass the global proxy as the receiver.
LoadGlobalReceiver(eax);
// Call the function.
// evaluated.
// Compute function to call and use the global object as the
- // receiver.
+ // receiver. There is no need to use the global proxy here because
+ // it will always be replaced with a newly allocated object.
Load(node->expression());
- LoadGlobalReceiver(eax);
+ LoadGlobal();
// Push the arguments ("left-to-right") on the stack.
ZoneList<Expression*>* args = node->arguments();
// If this assert fails, we have to check upper bound too.
ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
- // Check for access to global object (unlikely).
+ // Check for access to global proxy.
__ cmp(r0, Operand(JS_GLOBAL_PROXY_TYPE));
__ b(eq, &global);
__ cmp(r0, Operand(JS_FUNCTION_TYPE));
__ b(ne, &miss);
- // Patch the function on the stack; 1 ~ receiver.
- __ str(r1, MemOperand(sp, (argc + 1) * kPointerSize));
+ // TODO(120): Check for access to global object. Needs patching of
+ // receiver but no security check.
// Invoke the function.
ParameterCount actual(argc);
CEntryStub stub;
__ CallStub(&stub);
- // Move result to r1.
+ // Move result to r1 and leave the internal frame.
__ mov(r1, Operand(r0));
-
__ LeaveInternalFrame();
- // Patch the function on the stack; 1 ~ receiver.
- __ str(r1, MemOperand(sp, (argc + 1) * kPointerSize));
+ // TODO(120): Check for access to to global object. Needs patching
+ // of receiver but no security check.
// Invoke the function.
ParameterCount actual(argc);
__ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE));
__ b(eq, &global);
-
__ bind(&probe);
GenerateDictionaryLoad(masm, &done, &miss, r1, r0);
__ Ret();
// If this assert fails, we have to check upper bound too.
ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
- // Check for access to global object.
+ // Check for access to global proxy.
__ cmp(eax, JS_GLOBAL_PROXY_TYPE);
__ j(equal, &global, not_taken);
__ cmp(edx, JS_FUNCTION_TYPE);
__ j(not_equal, &miss, not_taken);
+ // TODO(120): Check for access to global object. Needs patching of
+ // receiver but no security check.
+
// Invoke the function.
ParameterCount actual(argc);
__ InvokeFunction(edi, actual, JUMP_FUNCTION);
- // Global object access: Check access rights.
+ // Global object proxy access: Check access rights.
__ bind(&global);
__ CheckAccessGlobalProxy(edx, eax, &miss);
__ jmp(&probe);
__ mov(Operand(edi), eax);
__ LeaveInternalFrame();
+ // TODO(120): Check for access to to global object. Needs patching
+ // of receiver but no security check.
+
// Invoke the function.
ParameterCount actual(argc);
__ InvokeFunction(edi, actual, JUMP_FUNCTION);
__ cmp(r2, Operand(JS_FUNCTION_TYPE));
__ b(ne, &miss);
- // Patch the function on the stack; 1 ~ receiver.
- __ str(r1, MemOperand(sp, (argc + 1) * kPointerSize));
+ if (object->IsGlobalObject()) {
+ // TODO(120): Patch receiver with the global proxy.
+ }
// Invoke the function.
__ InvokeFunction(r1, arguments(), JUMP_FUNCTION);
__ mov(r1, Operand(Handle<JSFunction>(function)));
__ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
- // Patch the function on the stack; 1 ~ receiver.
- __ str(r1, MemOperand(sp, (argc + 1) * kPointerSize));
+ if (object->IsGlobalObject()) {
+ // TODO(120): Patch receiver with the global proxy.
+ }
// Jump to the cached code (tail call).
Handle<Code> code(function->code());
__ CallRuntime(Runtime::kLazyCompile, 1);
__ pop(edi);
+ // Tear down temporary frame.
__ LeaveInternalFrame();
// Do a tail-call of the compiled function.
__ cmp(ebx, JS_FUNCTION_TYPE);
__ j(not_equal, &miss, not_taken);
+ if (object->IsGlobalObject()) {
+ // TODO(120): Patch receiver with the global proxy.
+ }
+
// Invoke the function.
__ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
__ mov(Operand(edi), Immediate(Handle<JSFunction>(function)));
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
+ if (object->IsGlobalObject()) {
+ // TODO(120): Patch receiver with the global proxy.
+ }
+
// Jump to the cached code (tail call).
Handle<Code> code(function->code());
ParameterCount expected(function->shared()->formal_parameter_count());
__ cmp(ebx, JS_FUNCTION_TYPE);
__ j(not_equal, &miss, not_taken);
+ if (object->IsGlobalObject()) {
+ // TODO(120): Patch receiver with the global proxy.
+ }
+
// Invoke the function.
__ InvokeFunction(edi, arguments(), JUMP_FUNCTION);