Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index 31d2b929fd403f615f97fac252b3d6a93acc545e..ff8506d1f86176417f06ce3645d2fc64f2650ee5 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 stub( |
- is_strict_mode() ? ArgumentsAccessStub::NEW_STRICT |
- : ArgumentsAccessStub::NEW_NON_STRICT); |
+ 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); |
__ 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); |
} |
@@ -1256,13 +1256,12 @@ void FullCodeGenerator::EmitDynamicLoadFromSlotFastCase( |
void FullCodeGenerator::EmitVariableLoad(Variable* var) { |
- // 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. |
+ // Three cases: non-this global variables, lookup slots, and all other |
+ // types of slots. |
Slot* slot = var->AsSlot(); |
- Property* property = var->AsProperty(); |
+ ASSERT((var->is_global() && !var->is_this()) == (slot == NULL)); |
- if (var->is_global() && !var->is_this()) { |
+ if (slot == NULL) { |
Comment cmnt(masm_, "Global variable"); |
// Use inline caching. Variable name is passed in r2 and the global |
// object (receiver) in r0. |
@@ -1272,7 +1271,7 @@ void FullCodeGenerator::EmitVariableLoad(Variable* var) { |
EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT, AstNode::kNoNumber); |
context()->Plug(r0); |
- } else if (slot != NULL && slot->type() == Slot::LOOKUP) { |
+ } else if (slot->type() == Slot::LOOKUP) { |
Label done, slow; |
// Generate code for loading from variables potentially shadowed |
@@ -1288,7 +1287,7 @@ void FullCodeGenerator::EmitVariableLoad(Variable* var) { |
context()->Plug(r0); |
- } else if (slot != NULL) { |
+ } else { |
Comment cmnt(masm_, (slot->type() == Slot::CONTEXT) |
? "Context slot" |
: "Stack slot"); |
@@ -1304,32 +1303,6 @@ 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); |
} |
} |
@@ -1570,7 +1543,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
} |
// Left-hand side can only be a property, a global or a (parameter or local) |
- // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY. |
+ // slot. |
enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
LhsKind assign_type = VARIABLE; |
Property* property = expr->target()->AsProperty(); |
@@ -1596,27 +1569,13 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
break; |
case KEYED_PROPERTY: |
if (expr->is_compound()) { |
- 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()); |
- } |
+ VisitForStackValue(property->obj()); |
+ VisitForAccumulatorValue(property->key()); |
__ ldr(r1, MemOperand(sp, 0)); |
__ push(r0); |
} else { |
- 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()); |
- } |
+ VisitForStackValue(property->obj()); |
+ VisitForStackValue(property->key()); |
} |
break; |
} |
@@ -1823,7 +1782,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. Variables with rewrite to .arguments are treated as KEYED_PROPERTY. |
+ // slot. |
enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
LhsKind assign_type = VARIABLE; |
Property* prop = expr->AsProperty(); |
@@ -1854,20 +1813,10 @@ void FullCodeGenerator::EmitAssignment(Expression* expr, int bailout_ast_id) { |
} |
case KEYED_PROPERTY: { |
__ push(r0); // Preserve value. |
- 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); |
- } |
+ 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() |
@@ -1883,8 +1832,6 @@ 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); |
@@ -3824,7 +3771,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
} |
// Expression can only be a property, a global or a (parameter or local) |
- // slot. Variables with rewrite to .arguments are treated as KEYED_PROPERTY. |
+ // slot. |
enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
LhsKind assign_type = VARIABLE; |
Property* prop = expr->expression()->AsProperty(); |
@@ -3852,15 +3799,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
__ push(r0); |
EmitNamedPropertyLoad(prop); |
} else { |
- 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()); |
- } |
+ VisitForStackValue(prop->obj()); |
+ VisitForAccumulatorValue(prop->key()); |
__ ldr(r1, MemOperand(sp, 0)); |
__ push(r0); |
EmitKeyedPropertyLoad(prop); |