Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index cac11a1ea0380feaf8ae5edce4bc066f15bfcd54..573ca702d62437181c6173c4af6cce4a2dd827a2 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -236,24 +236,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, edi, ebx, edx); |
- } |
- |
- 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 + kFPOnStackSize + kPCOnStackSize + |
- (info_->scope()->num_parameters() - 1) * kPointerSize; |
- __ mov(eax, Operand(ebp, offset)); |
- SetVar(new_target_var, eax, ebx, edx); |
} |
Variable* home_object_var = scope()->home_object_var(); |
@@ -1938,10 +1920,9 @@ |
// Nothing to do here. |
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()) { |
__ push(MemOperand(esp, kPointerSize)); |
@@ -1958,10 +1939,9 @@ |
} |
break; |
case KEYED_SUPER_PROPERTY: |
+ VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
VisitForStackValue( |
- property->obj()->AsSuperPropertyReference()->this_var()); |
- VisitForStackValue( |
- property->obj()->AsSuperPropertyReference()->home_object_var()); |
+ property->obj()->AsSuperReference()->home_object_var()); |
VisitForAccumulatorValue(property->key()); |
__ Push(result_register()); |
if (expr->is_compound()) { |
@@ -2585,9 +2565,9 @@ |
} |
case NAMED_SUPER_PROPERTY: { |
__ push(eax); |
- 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; eax: home_object |
Register scratch = ecx; |
Register scratch2 = edx; |
@@ -2602,9 +2582,8 @@ |
} |
case KEYED_SUPER_PROPERTY: { |
__ push(eax); |
- 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 = ecx; |
Register scratch2 = edx; |
@@ -2826,9 +2805,8 @@ |
__ Move(LoadDescriptor::ReceiverRegister(), result_register()); |
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 { |
@@ -2839,9 +2817,8 @@ |
__ Move(LoadDescriptor::NameRegister(), result_register()); // Key. |
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); |
} |
@@ -2899,7 +2876,7 @@ |
Literal* key = prop->key()->AsLiteral(); |
DCHECK(!key->value()->IsSmi()); |
// Load the function from the receiver. |
- SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
+ SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference(); |
VisitForStackValue(super_ref->home_object_var()); |
VisitForAccumulatorValue(super_ref->this_var()); |
__ push(eax); |
@@ -2955,7 +2932,7 @@ |
SetSourcePosition(prop->position()); |
// Load the function from the receiver. |
- SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
+ SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference(); |
VisitForStackValue(super_ref->home_object_var()); |
VisitForAccumulatorValue(super_ref->this_var()); |
__ push(eax); |
@@ -3033,9 +3010,15 @@ |
} |
+void FullCodeGenerator::EmitLoadSuperConstructor() { |
+ __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
+ __ CallRuntime(Runtime::kGetPrototype, 1); |
+} |
+ |
+ |
void FullCodeGenerator::EmitInitializeThisAfterSuper( |
- SuperCallReference* super_call_ref, FeedbackVectorICSlot slot) { |
- Variable* this_var = super_call_ref->this_var()->var(); |
+ SuperReference* super_ref, FeedbackVectorICSlot slot) { |
+ Variable* this_var = super_ref->this_var()->var(); |
GetVar(ecx, this_var); |
__ cmp(ecx, isolate()->factory()->the_hole_value()); |
Label uninitialized_this; |
@@ -3184,7 +3167,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. |
@@ -3220,14 +3203,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(eax, new_target_var); |
+ __ push(eax); |
+ |
+ EmitLoadSuperConstructor(); |
__ push(result_register()); |
// Push the arguments ("left-to-right") on the stack. |
@@ -3265,7 +3245,8 @@ |
RecordJSReturnSite(expr); |
- EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); |
+ EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference(), |
+ expr->CallFeedbackICSlot()); |
context()->Plug(eax); |
} |
@@ -4142,15 +4123,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(eax, new_target_var); |
+ __ push(eax); |
+ |
+ EmitLoadSuperConstructor(); |
__ push(result_register()); |
// Check if the calling frame is an arguments adaptor frame. |
@@ -4573,14 +4550,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); |
@@ -4589,8 +4563,8 @@ |
__ push(Operand(esp, 0)); |
__ mov(Operand(esp, kPointerSize), eax); |
- // Push super constructor |
- EmitLoadSuperConstructor(super_call_ref); |
+ // Push super |
+ EmitLoadSuperConstructor(); |
__ Push(result_register()); |
// Push arguments array |
@@ -4607,7 +4581,7 @@ |
context()->DropAndPlug(1, eax); |
// TODO(mvstanton): with FLAG_vector_stores this needs a slot id. |
- EmitInitializeThisAfterSuper(super_call_ref); |
+ EmitInitializeThisAfterSuper(super_reference); |
} |
@@ -4832,9 +4806,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()); |
__ push(MemOperand(esp, kPointerSize)); |
__ push(result_register()); |
@@ -4843,9 +4817,8 @@ |
} |
case KEYED_SUPER_PROPERTY: { |
- 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()); |
__ push(result_register()); |
__ push(MemOperand(esp, 2 * kPointerSize)); |