Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index c908d1038665587c0347eb43cc1dd7e3a5d48a09..660c10fe6269152ae3b82ff81be97eb6d9f44c7c 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -2382,6 +2382,14 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
} |
+void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
+ // Stack: receiver, home_object, key. |
+ SetSourcePosition(prop->position()); |
+ |
+ __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
+} |
+ |
+ |
void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
Token::Value op, |
OverwriteMode mode, |
@@ -2685,11 +2693,19 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
context()->Plug(r0); |
} else { |
- VisitForStackValue(expr->obj()); |
- VisitForAccumulatorValue(expr->key()); |
- __ Move(LoadDescriptor::NameRegister(), r0); |
- __ pop(LoadDescriptor::ReceiverRegister()); |
- EmitKeyedPropertyLoad(expr); |
+ if (!expr->IsSuperAccess()) { |
+ VisitForStackValue(expr->obj()); |
+ VisitForAccumulatorValue(expr->key()); |
+ __ Move(LoadDescriptor::NameRegister(), r0); |
+ __ pop(LoadDescriptor::ReceiverRegister()); |
+ EmitKeyedPropertyLoad(expr); |
+ } else { |
+ VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
+ EmitLoadHomeObject(expr->obj()->AsSuperReference()); |
+ __ Push(result_register()); |
+ VisitForStackValue(expr->key()); |
+ EmitKeyedSuperPropertyLoad(expr); |
+ } |
context()->Plug(r0); |
} |
} |
@@ -2801,6 +2817,43 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, |
} |
+void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
+ Expression* callee = expr->expression(); |
+ DCHECK(callee->IsProperty()); |
+ Property* prop = callee->AsProperty(); |
+ DCHECK(prop->IsSuperAccess()); |
+ |
+ SetSourcePosition(prop->position()); |
+ // Load the function from the receiver. |
+ const Register scratch = r1; |
+ SuperReference* super_ref = prop->obj()->AsSuperReference(); |
+ EmitLoadHomeObject(super_ref); |
+ __ Push(r0); |
+ VisitForAccumulatorValue(super_ref->this_var()); |
+ __ Push(r0); |
+ __ Push(r0); |
+ __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); |
+ __ Push(scratch); |
+ VisitForStackValue(prop->key()); |
+ |
+ // Stack here: |
+ // - home_object |
+ // - this (receiver) |
+ // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
+ // - home_object |
+ // - key |
+ __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
+ |
+ // Replace home_object with target function. |
+ __ str(r0, MemOperand(sp, kPointerSize)); |
+ |
+ // Stack here: |
+ // - target function |
+ // - this (receiver) |
+ EmitCall(expr, CallICState::METHOD); |
+} |
+ |
+ |
void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
// Load the arguments. |
ZoneList<Expression*>* args = expr->arguments(); |
@@ -2950,9 +3003,12 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
} else if (call_type == Call::PROPERTY_CALL) { |
Property* property = callee->AsProperty(); |
bool is_named_call = property->key()->IsPropertyName(); |
- // super.x() is handled in EmitCallWithLoadIC. |
- if (property->IsSuperAccess() && is_named_call) { |
- EmitSuperCallWithLoadIC(expr); |
+ if (property->IsSuperAccess()) { |
+ if (is_named_call) { |
+ EmitSuperCallWithLoadIC(expr); |
+ } else { |
+ EmitKeyedSuperCallWithLoadIC(expr); |
+ } |
} else { |
{ |
PreservePositionScope scope(masm()->positions_recorder()); |