Chromium Code Reviews| Index: src/arm/codegen-arm.cc |
| =================================================================== |
| --- src/arm/codegen-arm.cc (revision 4607) |
| +++ src/arm/codegen-arm.cc (working copy) |
| @@ -2787,7 +2787,8 @@ |
| frame_->SpillAll(); |
| Slot* potential_slot = slot->var()->local_if_not_shadowed()->slot(); |
| // Only generate the fast case for locals that rewrite to slots. |
| - // This rules out argument loads. |
| + // This rules out argument loads because eval forces arguments |
| + // access to be through the arguments object. |
| if (potential_slot != NULL) { |
| __ ldr(r0, |
| ContextSlotOperandCheckExtensions(potential_slot, |
| @@ -3702,9 +3703,56 @@ |
| } else if (var != NULL && var->slot() != NULL && |
| var->slot()->type() == Slot::LOOKUP) { |
| // ---------------------------------- |
| - // JavaScript example: 'with (obj) foo(1, 2, 3)' // foo is in obj |
| + // JavaScript examples: |
| + // |
| + // with (obj) foo(1, 2, 3) // foo is in obj |
|
Erik Corry
2010/05/07 10:38:31
As I understand it the point of this code is to go
|
| + // |
| + // function f() {}; |
| + // function g() { |
| + // eval(...); |
| + // f(); // f could be in extension object |
|
Erik Corry
2010/05/07 10:38:31
Full stop.
|
| + // } |
| // ---------------------------------- |
| + // JumpTargets do not yet support merging frames so the frame must be |
| + // spilled when jumping to these targets. |
| + JumpTarget slow; |
| + JumpTarget done; |
| + |
| + // Generate fast-case code for variables that might be shadowed by |
| + // eval-introduced variables. Eval is used a lot without |
| + // introducing variables. In those cases, we do not want to |
| + // perform a runtime call for all variables in the scope |
| + // containing the eval. |
| + if (var->mode() == Variable::DYNAMIC_GLOBAL) { |
| + LoadFromGlobalSlotCheckExtensions(var->slot(), NOT_INSIDE_TYPEOF, &slow); |
| + frame_->EmitPush(r0); |
| + LoadGlobalReceiver(r1); |
| + done.Jump(); |
| + |
| + } else if (var->mode() == Variable::DYNAMIC_LOCAL) { |
| + Slot* potential_slot = var->local_if_not_shadowed()->slot(); |
| + // Only generate the fast case for locals that rewrite to slots. |
| + // This rules out argument loads because eval forces arguments |
| + // access to be through the arguments object. |
| + if (potential_slot != NULL) { |
| + __ ldr(r0, |
| + ContextSlotOperandCheckExtensions(potential_slot, |
| + r1, |
| + r2, |
| + &slow)); |
| + if (potential_slot->var()->mode() == Variable::CONST) { |
| + __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| + __ cmp(r0, ip); |
| + __ LoadRoot(r0, Heap::kUndefinedValueRootIndex, eq); |
| + } |
| + frame_->EmitPush(r0); |
| + LoadGlobalReceiver(r1); |
| + done.Jump(); |
| + } |
| + } |
| + |
| + slow.Bind(); |
| // Load the function |
| frame_->EmitPush(cp); |
| __ mov(r0, Operand(var->name())); |
| @@ -3716,7 +3764,9 @@ |
| frame_->EmitPush(r0); // function |
| frame_->EmitPush(r1); // receiver |
| - // Call the function. |
| + done.Bind(); |
| + // Call the function. At this point, everything is spilled but the |
| + // function and receiver are in r0 and r1. |
| CallWithArguments(args, NO_CALL_FUNCTION_FLAGS, node->position()); |
| frame_->EmitPush(r0); |