| Index: src/arm64/full-codegen-arm64.cc
|
| diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc
|
| index 4611363551bdc504d960ac3aa521689f73fed526..1928aa5839133c5caed138cd4f3cfb4d07496155 100644
|
| --- a/src/arm64/full-codegen-arm64.cc
|
| +++ b/src/arm64/full-codegen-arm64.cc
|
| @@ -1341,6 +1341,26 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
|
| }
|
|
|
|
|
| +void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) {
|
| + Comment cnmt(masm_, "[ SuperReference ");
|
| +
|
| + __ ldr(LoadDescriptor::ReceiverRegister(),
|
| + MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| +
|
| + Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol());
|
| + __ Mov(LoadDescriptor::NameRegister(), Operand(home_object_symbol));
|
| +
|
| + CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId());
|
| +
|
| + __ Mov(x10, Operand(isolate()->factory()->undefined_value()));
|
| + __ cmp(x0, x10);
|
| + Label done;
|
| + __ b(&done, ne);
|
| + __ CallRuntime(Runtime::kThrowNonMethodError, 0);
|
| + __ bind(&done);
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
|
| TypeofState typeof_state,
|
| Label* slow) {
|
| @@ -1949,6 +1969,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
|
| void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
| SetSourcePosition(prop->position());
|
| Literal* key = prop->key()->AsLiteral();
|
| + DCHECK(!prop->IsSuperAccess());
|
| +
|
| __ Mov(LoadDescriptor::NameRegister(), Operand(key->value()));
|
| if (FLAG_vector_ics) {
|
| __ Mov(VectorLoadICDescriptor::SlotRegister(),
|
| @@ -1960,6 +1982,21 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
| }
|
|
|
|
|
| +void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
|
| + SetSourcePosition(prop->position());
|
| + Literal* key = prop->key()->AsLiteral();
|
| + DCHECK(!key->value()->IsSmi());
|
| + DCHECK(prop->IsSuperAccess());
|
| +
|
| + SuperReference* super_ref = prop->obj()->AsSuperReference();
|
| + EmitLoadHomeObject(super_ref);
|
| + __ Push(x0);
|
| + VisitForStackValue(super_ref->this_var());
|
| + __ Push(key->value());
|
| + __ CallRuntime(Runtime::kLoadFromSuper, 3);
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
|
| SetSourcePosition(prop->position());
|
| // Call keyed load IC. It has arguments key and receiver in r0 and r1.
|
| @@ -2263,9 +2300,13 @@ void FullCodeGenerator::VisitProperty(Property* expr) {
|
| Expression* key = expr->key();
|
|
|
| if (key->IsPropertyName()) {
|
| - VisitForAccumulatorValue(expr->obj());
|
| - __ Move(LoadDescriptor::ReceiverRegister(), x0);
|
| - EmitNamedPropertyLoad(expr);
|
| + if (!expr->IsSuperAccess()) {
|
| + VisitForAccumulatorValue(expr->obj());
|
| + __ Move(LoadDescriptor::ReceiverRegister(), x0);
|
| + EmitNamedPropertyLoad(expr);
|
| + } else {
|
| + EmitNamedSuperPropertyLoad(expr);
|
| + }
|
| PrepareForBailoutForId(expr->LoadId(), TOS_REG);
|
| context()->Plug(x0);
|
| } else {
|
| @@ -2307,6 +2348,7 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
|
| } else {
|
| // Load the function from the receiver.
|
| DCHECK(callee->IsProperty());
|
| + DCHECK(!callee->AsProperty()->IsSuperAccess());
|
| __ Peek(LoadDescriptor::ReceiverRegister(), 0);
|
| EmitNamedPropertyLoad(callee->AsProperty());
|
| PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
|
| @@ -2319,6 +2361,45 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
|
| }
|
|
|
|
|
| +void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) {
|
| + Expression* callee = expr->expression();
|
| + DCHECK(callee->IsProperty());
|
| + Property* prop = callee->AsProperty();
|
| + DCHECK(prop->IsSuperAccess());
|
| +
|
| + SetSourcePosition(prop->position());
|
| + Literal* key = prop->key()->AsLiteral();
|
| + DCHECK(!key->value()->IsSmi());
|
| +
|
| + // 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(scratch, x0);
|
| + __ Push(key->value());
|
| +
|
| + // Stack here:
|
| + // - home_object
|
| + // - this (receiver)
|
| + // - home_object <-- LoadFromSuper will pop here and below.
|
| + // - this (receiver)
|
| + // - key
|
| + __ CallRuntime(Runtime::kLoadFromSuper, 3);
|
| +
|
| + // Replace home_object with target function.
|
| + __ Poke(x0, kPointerSize);
|
| +
|
| + // Stack here:
|
| + // - target function
|
| + // - this (receiver)
|
| + EmitCall(expr, CallICState::METHOD);
|
| +}
|
| +
|
| +
|
| // Code common for calls using the IC.
|
| void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr,
|
| Expression* key) {
|
| @@ -2491,15 +2572,21 @@ void FullCodeGenerator::VisitCall(Call* expr) {
|
| EmitCall(expr);
|
| } else if (call_type == Call::PROPERTY_CALL) {
|
| Property* property = callee->AsProperty();
|
| - { PreservePositionScope scope(masm()->positions_recorder());
|
| - VisitForStackValue(property->obj());
|
| - }
|
| - if (property->key()->IsPropertyName()) {
|
| - EmitCallWithLoadIC(expr);
|
| + bool is_named_call = property->key()->IsPropertyName();
|
| + // super.x() is handled in EmitCallWithLoadIC.
|
| + if (property->IsSuperAccess() && is_named_call) {
|
| + EmitSuperCallWithLoadIC(expr);
|
| } else {
|
| - EmitKeyedCallWithLoadIC(expr, property->key());
|
| + {
|
| + PreservePositionScope scope(masm()->positions_recorder());
|
| + VisitForStackValue(property->obj());
|
| + }
|
| + if (is_named_call) {
|
| + EmitCallWithLoadIC(expr);
|
| + } else {
|
| + EmitKeyedCallWithLoadIC(expr, property->key());
|
| + }
|
| }
|
| -
|
| } else {
|
| DCHECK(call_type == Call::OTHER_CALL);
|
| // Call to an arbitrary expression not handled specially above.
|
|
|