Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index 8539ad4c4ac3e3e4d5beaf5c9819eee9394fc76e..5f612ee92c8b197df64af1a8504088b28a6363f9 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -242,6 +242,11 @@ void FullCodeGenerator::Generate() { |
} |
} |
+ Variable* home_object_var = scope()->home_object_var(); |
+ if (home_object_var != nullptr) { |
+ __ Push(r1); |
+ } |
+ |
ArgumentsAccessStub::HasNewTarget has_new_target = |
IsSubclassConstructor(info->function()->kind()) |
? ArgumentsAccessStub::HAS_NEW_TARGET |
@@ -307,6 +312,19 @@ void FullCodeGenerator::Generate() { |
SetVar(arguments, r0, r1, r2); |
} |
+ // Possibly set up a local binding to the [[HomeObject]]. |
+ if (home_object_var != nullptr) { |
+ Comment cmnt(masm_, "[ Home object"); |
+ __ Pop(LoadDescriptor::ReceiverRegister()); |
+ Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); |
+ __ Move(LoadDescriptor::NameRegister(), home_object_symbol); |
+ __ Move(LoadDescriptor::SlotRegister(), |
+ Operand(SmiFromSlot(function()->HomeObjectFeedbackSlot()))); |
+ CallLoadIC(NOT_CONTEXTUAL); |
+ |
+ SetVar(home_object_var, r0, r1, r2); |
+ } |
+ |
if (FLAG_trace) { |
__ CallRuntime(Runtime::kTraceEnter, 0); |
} |
@@ -1325,27 +1343,6 @@ 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()); |
- __ Move(LoadDescriptor::NameRegister(), home_object_symbol); |
- |
- __ mov(LoadDescriptor::SlotRegister(), |
- Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); |
- CallLoadIC(NOT_CONTEXTUAL); |
- |
- __ cmp(r0, Operand(isolate()->factory()->undefined_value())); |
- Label done; |
- __ b(ne, &done); |
- __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
- __ bind(&done); |
-} |
- |
- |
void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, |
int offset) { |
if (NeedsHomeObject(initializer)) { |
@@ -1980,7 +1977,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
break; |
case NAMED_SUPER_PROPERTY: |
VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
- EmitLoadHomeObject(property->obj()->AsSuperReference()); |
+ VisitForAccumulatorValue( |
+ property->obj()->AsSuperReference()->home_object_var()); |
__ Push(result_register()); |
if (expr->is_compound()) { |
const Register scratch = r1; |
@@ -1991,8 +1989,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
break; |
case KEYED_SUPER_PROPERTY: |
VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
- EmitLoadHomeObject(property->obj()->AsSuperReference()); |
- __ Push(result_register()); |
+ VisitForStackValue( |
+ property->obj()->AsSuperReference()->home_object_var()); |
VisitForAccumulatorValue(property->key()); |
__ Push(result_register()); |
if (expr->is_compound()) { |
@@ -2634,7 +2632,8 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { |
case NAMED_SUPER_PROPERTY: { |
__ Push(r0); |
VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
- EmitLoadHomeObject(prop->obj()->AsSuperReference()); |
+ VisitForAccumulatorValue( |
+ prop->obj()->AsSuperReference()->home_object_var()); |
// stack: value, this; r0: home_object |
Register scratch = r2; |
Register scratch2 = r3; |
@@ -2650,8 +2649,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { |
case KEYED_SUPER_PROPERTY: { |
__ Push(r0); |
VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
- EmitLoadHomeObject(prop->obj()->AsSuperReference()); |
- __ Push(result_register()); |
+ VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var()); |
VisitForAccumulatorValue(prop->key()); |
Register scratch = r2; |
Register scratch2 = r3; |
@@ -2863,8 +2861,7 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
EmitNamedPropertyLoad(expr); |
} else { |
VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
- EmitLoadHomeObject(expr->obj()->AsSuperReference()); |
- __ Push(result_register()); |
+ VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); |
EmitNamedSuperPropertyLoad(expr); |
} |
} else { |
@@ -2876,8 +2873,7 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
EmitKeyedPropertyLoad(expr); |
} else { |
VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
- EmitLoadHomeObject(expr->obj()->AsSuperReference()); |
- __ Push(result_register()); |
+ VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); |
VisitForStackValue(expr->key()); |
EmitKeyedSuperPropertyLoad(expr); |
} |
@@ -2943,8 +2939,7 @@ void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { |
// Load the function from the receiver. |
const Register scratch = r1; |
SuperReference* super_ref = prop->obj()->AsSuperReference(); |
- EmitLoadHomeObject(super_ref); |
- __ Push(r0); |
+ VisitForStackValue(super_ref->home_object_var()); |
VisitForAccumulatorValue(super_ref->this_var()); |
__ Push(r0); |
__ Push(r0); |
@@ -3004,8 +2999,7 @@ void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
// Load the function from the receiver. |
const Register scratch = r1; |
SuperReference* super_ref = prop->obj()->AsSuperReference(); |
- EmitLoadHomeObject(super_ref); |
- __ Push(r0); |
+ VisitForStackValue(super_ref->home_object_var()); |
VisitForAccumulatorValue(super_ref->this_var()); |
__ Push(r0); |
__ Push(r0); |
@@ -4847,7 +4841,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
case NAMED_SUPER_PROPERTY: { |
VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
- EmitLoadHomeObject(prop->obj()->AsSuperReference()); |
+ VisitForAccumulatorValue( |
+ prop->obj()->AsSuperReference()->home_object_var()); |
__ Push(result_register()); |
const Register scratch = r1; |
__ ldr(scratch, MemOperand(sp, kPointerSize)); |
@@ -4859,8 +4854,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
case KEYED_SUPER_PROPERTY: { |
VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
- EmitLoadHomeObject(prop->obj()->AsSuperReference()); |
- __ Push(result_register()); |
+ VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var()); |
VisitForAccumulatorValue(prop->key()); |
__ Push(result_register()); |
const Register scratch = r1; |