| Index: src/arm/full-codegen-arm.cc | 
| diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc | 
| index 7029c1079e567069bfa3cefde76e8ee2394c5475..31d2b929fd403f615f97fac252b3d6a93acc545e 100644 | 
| --- a/src/arm/full-codegen-arm.cc | 
| +++ b/src/arm/full-codegen-arm.cc | 
| @@ -230,17 +230,17 @@ void FullCodeGenerator::Generate(CompilationInfo* info) { | 
| //   function, receiver address, parameter count. | 
| // The stub will rewrite receiever and parameter count if the previous | 
| // stack frame was an arguments adapter frame. | 
| -    ArgumentsAccessStub::Type type; | 
| -    if (is_strict_mode()) { | 
| -      type = ArgumentsAccessStub::NEW_STRICT; | 
| -    } else if (function()->has_duplicate_parameters()) { | 
| -      type = ArgumentsAccessStub::NEW_NON_STRICT_SLOW; | 
| -    } else { | 
| -      type = ArgumentsAccessStub::NEW_NON_STRICT_FAST; | 
| -    } | 
| -    ArgumentsAccessStub stub(type); | 
| +    ArgumentsAccessStub stub( | 
| +        is_strict_mode() ? ArgumentsAccessStub::NEW_STRICT | 
| +                         : ArgumentsAccessStub::NEW_NON_STRICT); | 
| __ CallStub(&stub); | 
|  | 
| +    Variable* arguments_shadow = scope()->arguments_shadow(); | 
| +    if (arguments_shadow != NULL) { | 
| +      // Duplicate the value; move-to-slot operation might clobber registers. | 
| +      __ mov(r3, r0); | 
| +      Move(arguments_shadow->AsSlot(), r3, r1, r2); | 
| +    } | 
| Move(arguments->AsSlot(), r0, r1, r2); | 
| } | 
|  | 
| @@ -383,7 +383,7 @@ void FullCodeGenerator::TestContext::Plug(Slot* slot) const { | 
| // For simplicity we always test the accumulator register. | 
| codegen()->Move(result_register(), slot); | 
| codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 
| -  codegen()->DoTest(true_label_, false_label_, fall_through_); | 
| +  codegen()->DoTest(this); | 
| } | 
|  | 
|  | 
| @@ -417,7 +417,7 @@ void FullCodeGenerator::TestContext::Plug(Heap::RootListIndex index) const { | 
| if (true_label_ != fall_through_) __ b(true_label_); | 
| } else { | 
| __ LoadRoot(result_register(), index); | 
| -    codegen()->DoTest(true_label_, false_label_, fall_through_); | 
| +    codegen()->DoTest(this); | 
| } | 
| } | 
|  | 
| @@ -464,7 +464,7 @@ void FullCodeGenerator::TestContext::Plug(Handle<Object> lit) const { | 
| } else { | 
| // For simplicity we always test the accumulator register. | 
| __ mov(result_register(), Operand(lit)); | 
| -    codegen()->DoTest(true_label_, false_label_, fall_through_); | 
| +    codegen()->DoTest(this); | 
| } | 
| } | 
|  | 
| @@ -500,7 +500,7 @@ void FullCodeGenerator::TestContext::DropAndPlug(int count, | 
| __ Drop(count); | 
| __ Move(result_register(), reg); | 
| codegen()->PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); | 
| -  codegen()->DoTest(true_label_, false_label_, fall_through_); | 
| +  codegen()->DoTest(this); | 
| } | 
|  | 
|  | 
| @@ -578,7 +578,8 @@ void FullCodeGenerator::TestContext::Plug(bool flag) const { | 
| } | 
|  | 
|  | 
| -void FullCodeGenerator::DoTest(Label* if_true, | 
| +void FullCodeGenerator::DoTest(Expression* condition, | 
| +                               Label* if_true, | 
| Label* if_false, | 
| Label* fall_through) { | 
| if (CpuFeatures::IsSupported(VFP3)) { | 
| @@ -1255,12 +1256,13 @@ void FullCodeGenerator::EmitDynamicLoadFromSlotFastCase( | 
|  | 
|  | 
| void FullCodeGenerator::EmitVariableLoad(Variable* var) { | 
| -  // Three cases: non-this global variables, lookup slots, and all other | 
| -  // types of slots. | 
| +  // Four cases: non-this global variables, lookup slots, all other | 
| +  // types of slots, and parameters that rewrite to explicit property | 
| +  // accesses on the arguments object. | 
| Slot* slot = var->AsSlot(); | 
| -  ASSERT((var->is_global() && !var->is_this()) == (slot == NULL)); | 
| +  Property* property = var->AsProperty(); | 
|  | 
| -  if (slot == NULL) { | 
| +  if (var->is_global() && !var->is_this()) { | 
| Comment cmnt(masm_, "Global variable"); | 
| // Use inline caching. Variable name is passed in r2 and the global | 
| // object (receiver) in r0. | 
| @@ -1270,7 +1272,7 @@ void FullCodeGenerator::EmitVariableLoad(Variable* var) { | 
| EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT, AstNode::kNoNumber); | 
| context()->Plug(r0); | 
|  | 
| -  } else if (slot->type() == Slot::LOOKUP) { | 
| +  } else if (slot != NULL && slot->type() == Slot::LOOKUP) { | 
| Label done, slow; | 
|  | 
| // Generate code for loading from variables potentially shadowed | 
| @@ -1286,7 +1288,7 @@ void FullCodeGenerator::EmitVariableLoad(Variable* var) { | 
|  | 
| context()->Plug(r0); | 
|  | 
| -  } else { | 
| +  } else if (slot != NULL) { | 
| Comment cmnt(masm_, (slot->type() == Slot::CONTEXT) | 
| ? "Context slot" | 
| : "Stack slot"); | 
| @@ -1302,6 +1304,32 @@ void FullCodeGenerator::EmitVariableLoad(Variable* var) { | 
| } else { | 
| context()->Plug(slot); | 
| } | 
| +  } else { | 
| +    Comment cmnt(masm_, "Rewritten parameter"); | 
| +    ASSERT_NOT_NULL(property); | 
| +    // Rewritten parameter accesses are of the form "slot[literal]". | 
| + | 
| +    // Assert that the object is in a slot. | 
| +    Variable* object_var = property->obj()->AsVariableProxy()->AsVariable(); | 
| +    ASSERT_NOT_NULL(object_var); | 
| +    Slot* object_slot = object_var->AsSlot(); | 
| +    ASSERT_NOT_NULL(object_slot); | 
| + | 
| +    // Load the object. | 
| +    Move(r1, object_slot); | 
| + | 
| +    // Assert that the key is a smi. | 
| +    Literal* key_literal = property->key()->AsLiteral(); | 
| +    ASSERT_NOT_NULL(key_literal); | 
| +    ASSERT(key_literal->handle()->IsSmi()); | 
| + | 
| +    // Load the key. | 
| +    __ mov(r0, Operand(key_literal->handle())); | 
| + | 
| +    // Call keyed load IC. It has arguments key and receiver in r0 and r1. | 
| +    Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); | 
| +    EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(property)); | 
| +    context()->Plug(r0); | 
| } | 
| } | 
|  | 
| @@ -1542,7 +1570,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 
| } | 
|  | 
| // Left-hand side can only be a property, a global or a (parameter or local) | 
| -  // slot. | 
| +  // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY. | 
| enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 
| LhsKind assign_type = VARIABLE; | 
| Property* property = expr->target()->AsProperty(); | 
| @@ -1568,13 +1596,27 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 
| break; | 
| case KEYED_PROPERTY: | 
| if (expr->is_compound()) { | 
| -        VisitForStackValue(property->obj()); | 
| -        VisitForAccumulatorValue(property->key()); | 
| +        if (property->is_arguments_access()) { | 
| +          VariableProxy* obj_proxy = property->obj()->AsVariableProxy(); | 
| +          __ ldr(r0, EmitSlotSearch(obj_proxy->var()->AsSlot(), r0)); | 
| +          __ push(r0); | 
| +          __ mov(r0, Operand(property->key()->AsLiteral()->handle())); | 
| +        } else { | 
| +          VisitForStackValue(property->obj()); | 
| +          VisitForAccumulatorValue(property->key()); | 
| +        } | 
| __ ldr(r1, MemOperand(sp, 0)); | 
| __ push(r0); | 
| } else { | 
| -        VisitForStackValue(property->obj()); | 
| -        VisitForStackValue(property->key()); | 
| +        if (property->is_arguments_access()) { | 
| +          VariableProxy* obj_proxy = property->obj()->AsVariableProxy(); | 
| +          __ ldr(r1, EmitSlotSearch(obj_proxy->var()->AsSlot(), r0)); | 
| +          __ mov(r0, Operand(property->key()->AsLiteral()->handle())); | 
| +          __ Push(r1, r0); | 
| +        } else { | 
| +          VisitForStackValue(property->obj()); | 
| +          VisitForStackValue(property->key()); | 
| +        } | 
| } | 
| break; | 
| } | 
| @@ -1781,7 +1823,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { | 
| } | 
|  | 
| // Left-hand side can only be a property, a global or a (parameter or local) | 
| -  // slot. | 
| +  // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY. | 
| enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 
| LhsKind assign_type = VARIABLE; | 
| Property* prop = expr->AsProperty(); | 
| @@ -1812,10 +1854,20 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { | 
| } | 
| case KEYED_PROPERTY: { | 
| __ push(r0);  // Preserve value. | 
| -      VisitForStackValue(prop->obj()); | 
| -      VisitForAccumulatorValue(prop->key()); | 
| -      __ mov(r1, r0); | 
| -      __ pop(r2); | 
| +      if (prop->is_synthetic()) { | 
| +        ASSERT(prop->obj()->AsVariableProxy() != NULL); | 
| +        ASSERT(prop->key()->AsLiteral() != NULL); | 
| +        { AccumulatorValueContext for_object(this); | 
| +          EmitVariableLoad(prop->obj()->AsVariableProxy()->var()); | 
| +        } | 
| +        __ mov(r2, r0); | 
| +        __ mov(r1, Operand(prop->key()->AsLiteral()->handle())); | 
| +      } else { | 
| +        VisitForStackValue(prop->obj()); | 
| +        VisitForAccumulatorValue(prop->key()); | 
| +        __ mov(r1, r0); | 
| +        __ pop(r2); | 
| +      } | 
| __ pop(r0);  // Restore value. | 
| Handle<Code> ic = is_strict_mode() | 
| ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 
| @@ -1831,6 +1883,8 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { | 
|  | 
| void FullCodeGenerator::EmitVariableAssignment(Variable* var, | 
| Token::Value op) { | 
| +  // Left-hand sides that rewrite to explicit property accesses do not reach | 
| +  // here. | 
| ASSERT(var != NULL); | 
| ASSERT(var->is_global() || var->AsSlot() != NULL); | 
|  | 
| @@ -3770,7 +3824,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 
| } | 
|  | 
| // Expression can only be a property, a global or a (parameter or local) | 
| -  // slot. | 
| +  // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY. | 
| enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; | 
| LhsKind assign_type = VARIABLE; | 
| Property* prop = expr->expression()->AsProperty(); | 
| @@ -3798,8 +3852,15 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 
| __ push(r0); | 
| EmitNamedPropertyLoad(prop); | 
| } else { | 
| -      VisitForStackValue(prop->obj()); | 
| -      VisitForAccumulatorValue(prop->key()); | 
| +      if (prop->is_arguments_access()) { | 
| +        VariableProxy* obj_proxy = prop->obj()->AsVariableProxy(); | 
| +        __ ldr(r0, EmitSlotSearch(obj_proxy->var()->AsSlot(), r0)); | 
| +        __ push(r0); | 
| +        __ mov(r0, Operand(prop->key()->AsLiteral()->handle())); | 
| +      } else { | 
| +        VisitForStackValue(prop->obj()); | 
| +        VisitForAccumulatorValue(prop->key()); | 
| +      } | 
| __ ldr(r1, MemOperand(sp, 0)); | 
| __ push(r0); | 
| EmitKeyedPropertyLoad(prop); | 
|  |