Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index 6615af177b5937529ef71ea875605154297015c6..1acaabec37cc754a2c13df12277029377d949a37 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -3271,9 +3271,6 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
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); |
__ push(result_register()); |
@@ -3288,6 +3285,10 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
// constructor invocation. |
SetConstructCallPosition(expr); |
+ // Load original constructor into ecx. |
+ VisitForAccumulatorValue(super_call_ref->new_target_var()); |
+ __ mov(ecx, result_register()); |
+ |
// Load function and argument count into edi and eax. |
__ Move(eax, Immediate(arg_count)); |
__ mov(edi, Operand(esp, arg_count * kPointerSize)); |
@@ -3308,8 +3309,6 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); |
__ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
- __ Drop(1); |
- |
RecordJSReturnSite(expr); |
EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); |
@@ -4235,11 +4234,14 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
__ CallRuntime(Runtime::kGetPrototype, 1); |
__ push(result_register()); |
+ // Load original constructor into ecx. |
+ __ mov(ecx, Operand(esp, 1 * kPointerSize)); |
+ |
// Check if the calling frame is an arguments adaptor frame. |
Label adaptor_frame, args_set_up, runtime; |
__ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
- __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); |
- __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
+ __ mov(ebx, Operand(edx, StandardFrameConstants::kContextOffset)); |
+ __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
__ j(equal, &adaptor_frame); |
// default constructor has no arguments, so no adaptor frame means no args. |
__ mov(eax, Immediate(0)); |
@@ -4248,17 +4250,17 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
// Copy arguments from adaptor frame. |
{ |
__ bind(&adaptor_frame); |
- __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
- __ SmiUntag(ecx); |
+ __ mov(ebx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
+ __ SmiUntag(ebx); |
- __ mov(eax, ecx); |
- __ lea(edx, Operand(edx, ecx, times_pointer_size, |
+ __ mov(eax, ebx); |
+ __ lea(edx, Operand(edx, ebx, times_pointer_size, |
StandardFrameConstants::kCallerSPOffset)); |
Label loop; |
__ bind(&loop); |
__ push(Operand(edx, -1 * kPointerSize)); |
__ sub(edx, Immediate(kPointerSize)); |
- __ dec(ecx); |
+ __ dec(ebx); |
__ j(not_zero, &loop); |
} |