Index: src/arm64/full-codegen-arm64.cc |
diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc |
index f73d214d7c7066a8df05903f1af80a73e14a833b..eeaef5f2962690b11b090401b834da73c98469d3 100644 |
--- a/src/arm64/full-codegen-arm64.cc |
+++ b/src/arm64/full-codegen-arm64.cc |
@@ -2032,6 +2032,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, |
@@ -2350,11 +2358,19 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
context()->Plug(x0); |
} else { |
- VisitForStackValue(expr->obj()); |
- VisitForAccumulatorValue(expr->key()); |
- __ Move(LoadDescriptor::NameRegister(), x0); |
- __ Pop(LoadDescriptor::ReceiverRegister()); |
- EmitKeyedPropertyLoad(expr); |
+ if (!expr->IsSuperAccess()) { |
+ VisitForStackValue(expr->obj()); |
+ VisitForAccumulatorValue(expr->key()); |
+ __ Move(LoadDescriptor::NameRegister(), x0); |
+ __ 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(x0); |
} |
} |
@@ -2463,6 +2479,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 = x10; |
+ SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference(); |
+ EmitLoadHomeObject(super_ref); |
+ __ Push(x0); |
+ VisitForAccumulatorValue(super_ref->this_var()); |
+ __ Push(x0); |
+ __ Peek(scratch, kPointerSize); |
+ __ Push(x0, 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. |
+ __ Poke(x0, 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(); |
@@ -2616,9 +2669,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()); |