Index: src/mips/full-codegen-mips.cc |
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc |
index 56e3a5fc44731b5c77d3f6e2dd43203189268a8d..c81f346d13cc86a87c4fcb95d105ce9f673f68b0 100644 |
--- a/src/mips/full-codegen-mips.cc |
+++ b/src/mips/full-codegen-mips.cc |
@@ -249,24 +249,6 @@ |
} |
} |
} |
- } |
- |
- // Possibly set up a local binding to the this function which is used in |
- // derived constructors with super calls. |
- Variable* this_function_var = scope()->this_function_var(); |
- if (this_function_var != nullptr) { |
- Comment cmnt(masm_, "[ This function"); |
- SetVar(this_function_var, a1, a2, a3); |
- } |
- |
- Variable* new_target_var = scope()->new_target_var(); |
- if (new_target_var != nullptr) { |
- Comment cmnt(masm_, "[ new.target"); |
- // new.target is parameter -2. |
- int offset = 2 * kPointerSize + |
- (info_->scope()->num_parameters() + 1) * kPointerSize; |
- __ lw(v0, MemOperand(fp, offset)); |
- SetVar(new_target_var, v0, a2, a3); |
} |
Variable* home_object_var = scope()->home_object_var(); |
@@ -2006,10 +1988,9 @@ |
} |
break; |
case NAMED_SUPER_PROPERTY: |
- VisitForStackValue( |
- property->obj()->AsSuperPropertyReference()->this_var()); |
+ VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
VisitForAccumulatorValue( |
- property->obj()->AsSuperPropertyReference()->home_object_var()); |
+ property->obj()->AsSuperReference()->home_object_var()); |
__ Push(result_register()); |
if (expr->is_compound()) { |
const Register scratch = a1; |
@@ -2019,10 +2000,9 @@ |
break; |
case KEYED_SUPER_PROPERTY: { |
const Register scratch = a1; |
- VisitForStackValue( |
- property->obj()->AsSuperPropertyReference()->this_var()); |
+ VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
VisitForAccumulatorValue( |
- property->obj()->AsSuperPropertyReference()->home_object_var()); |
+ property->obj()->AsSuperReference()->home_object_var()); |
__ Move(scratch, result_register()); |
VisitForAccumulatorValue(property->key()); |
__ Push(scratch, result_register()); |
@@ -2656,9 +2636,9 @@ |
} |
case NAMED_SUPER_PROPERTY: { |
__ Push(v0); |
- VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
+ VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
VisitForAccumulatorValue( |
- prop->obj()->AsSuperPropertyReference()->home_object_var()); |
+ prop->obj()->AsSuperReference()->home_object_var()); |
// stack: value, this; v0: home_object |
Register scratch = a2; |
Register scratch2 = a3; |
@@ -2673,9 +2653,8 @@ |
} |
case KEYED_SUPER_PROPERTY: { |
__ Push(v0); |
- VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
- VisitForStackValue( |
- prop->obj()->AsSuperPropertyReference()->home_object_var()); |
+ VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
+ VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var()); |
VisitForAccumulatorValue(prop->key()); |
Register scratch = a2; |
Register scratch2 = a3; |
@@ -2904,9 +2883,8 @@ |
__ Move(LoadDescriptor::ReceiverRegister(), v0); |
EmitNamedPropertyLoad(expr); |
} else { |
- VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
- VisitForStackValue( |
- expr->obj()->AsSuperPropertyReference()->home_object_var()); |
+ VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
+ VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); |
EmitNamedSuperPropertyLoad(expr); |
} |
} else { |
@@ -2917,9 +2895,8 @@ |
__ pop(LoadDescriptor::ReceiverRegister()); |
EmitKeyedPropertyLoad(expr); |
} else { |
- VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
- VisitForStackValue( |
- expr->obj()->AsSuperPropertyReference()->home_object_var()); |
+ VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
+ VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); |
VisitForStackValue(expr->key()); |
EmitKeyedSuperPropertyLoad(expr); |
} |
@@ -2981,7 +2958,7 @@ |
DCHECK(!key->value()->IsSmi()); |
// Load the function from the receiver. |
const Register scratch = a1; |
- SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
+ SuperReference* super_ref = prop->obj()->AsSuperReference(); |
VisitForAccumulatorValue(super_ref->home_object_var()); |
__ mov(scratch, v0); |
VisitForAccumulatorValue(super_ref->this_var()); |
@@ -3039,7 +3016,7 @@ |
SetSourcePosition(prop->position()); |
// Load the function from the receiver. |
const Register scratch = a1; |
- SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
+ SuperReference* super_ref = prop->obj()->AsSuperReference(); |
VisitForAccumulatorValue(super_ref->home_object_var()); |
__ Move(scratch, v0); |
VisitForAccumulatorValue(super_ref->this_var()); |
@@ -3119,8 +3096,15 @@ |
} |
+void FullCodeGenerator::EmitLoadSuperConstructor() { |
+ __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ __ Push(a0); |
+ __ CallRuntime(Runtime::kGetPrototype, 1); |
+} |
+ |
+ |
void FullCodeGenerator::EmitInitializeThisAfterSuper( |
- SuperCallReference* super_ref, FeedbackVectorICSlot slot) { |
+ SuperReference* super_ref, FeedbackVectorICSlot slot) { |
Variable* this_var = super_ref->this_var()->var(); |
GetVar(a1, this_var); |
__ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
@@ -3278,7 +3262,7 @@ |
// Push constructor on the stack. If it's not a function it's used as |
// receiver for CALL_NON_FUNCTION, otherwise the value on the stack is |
// ignored. |
- DCHECK(!expr->expression()->IsSuperPropertyReference()); |
+ DCHECK(!expr->expression()->IsSuperReference()); |
VisitForStackValue(expr->expression()); |
// Push the arguments ("left-to-right") on the stack. |
@@ -3314,14 +3298,11 @@ |
void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
- SuperCallReference* super_call_ref = |
- expr->expression()->AsSuperCallReference(); |
- DCHECK_NOT_NULL(super_call_ref); |
- |
- VariableProxy* new_target_proxy = super_call_ref->new_target_var(); |
- VisitForStackValue(new_target_proxy); |
- |
- EmitLoadSuperConstructor(super_call_ref); |
+ Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); |
+ GetVar(result_register(), new_target_var); |
+ __ Push(result_register()); |
+ |
+ EmitLoadSuperConstructor(); |
__ push(result_register()); |
// Push the arguments ("left-to-right") on the stack. |
@@ -3359,7 +3340,8 @@ |
RecordJSReturnSite(expr); |
- EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); |
+ EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference(), |
+ expr->CallFeedbackICSlot()); |
context()->Plug(v0); |
} |
@@ -4245,15 +4227,11 @@ |
void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
- ZoneList<Expression*>* args = expr->arguments(); |
- DCHECK(args->length() == 2); |
- |
- // new.target |
- VisitForStackValue(args->at(0)); |
- |
- // .this_function |
- VisitForStackValue(args->at(1)); |
- __ CallRuntime(Runtime::kGetPrototype, 1); |
+ Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); |
+ GetVar(result_register(), new_target_var); |
+ __ Push(result_register()); |
+ |
+ EmitLoadSuperConstructor(); |
__ Push(result_register()); |
// Check if the calling frame is an arguments adaptor frame. |
@@ -4655,14 +4633,11 @@ |
void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) { |
// Assert: expr == CallRuntime("ReflectConstruct") |
- DCHECK_EQ(1, expr->arguments()->length()); |
CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime(); |
- |
ZoneList<Expression*>* args = call->arguments(); |
DCHECK_EQ(3, args->length()); |
- SuperCallReference* super_call_ref = args->at(0)->AsSuperCallReference(); |
- DCHECK_NOT_NULL(super_call_ref); |
+ SuperReference* super_reference = args->at(0)->AsSuperReference(); |
// Load ReflectConstruct function |
EmitLoadJSRuntimeFunction(call); |
@@ -4672,8 +4647,8 @@ |
__ push(at); |
__ sw(v0, MemOperand(sp, kPointerSize)); |
- // Push super constructor |
- EmitLoadSuperConstructor(super_call_ref); |
+ // Push super |
+ EmitLoadSuperConstructor(); |
__ Push(result_register()); |
// Push arguments array |
@@ -4690,7 +4665,7 @@ |
context()->DropAndPlug(1, v0); |
// TODO(mvstanton): with FLAG_vector_stores this needs a slot id. |
- EmitInitializeThisAfterSuper(super_call_ref); |
+ EmitInitializeThisAfterSuper(super_reference); |
} |
@@ -4915,9 +4890,9 @@ |
} |
case NAMED_SUPER_PROPERTY: { |
- VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
+ VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
VisitForAccumulatorValue( |
- prop->obj()->AsSuperPropertyReference()->home_object_var()); |
+ prop->obj()->AsSuperReference()->home_object_var()); |
__ Push(result_register()); |
const Register scratch = a1; |
__ lw(scratch, MemOperand(sp, kPointerSize)); |
@@ -4927,9 +4902,9 @@ |
} |
case KEYED_SUPER_PROPERTY: { |
- VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
+ VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
VisitForAccumulatorValue( |
- prop->obj()->AsSuperPropertyReference()->home_object_var()); |
+ prop->obj()->AsSuperReference()->home_object_var()); |
const Register scratch = a1; |
const Register scratch1 = t0; |
__ Move(scratch, result_register()); |