Chromium Code Reviews| Index: src/ia32/full-codegen-ia32.cc |
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
| index 487384c8287f092051ed847e79802ef5cd9d24f0..cddb6670b8b8d80001b808b98291cb5f31462ef3 100644 |
| --- a/src/ia32/full-codegen-ia32.cc |
| +++ b/src/ia32/full-codegen-ia32.cc |
| @@ -3062,11 +3062,15 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
| } |
| } |
| } else if (call_type == Call::SUPER_CALL) { |
| - SuperReference* super_ref = callee->AsSuperReference(); |
| - EmitLoadSuperConstructor(super_ref); |
| - __ push(result_register()); |
| - VisitForStackValue(super_ref->this_var()); |
| - EmitCall(expr, CallICState::METHOD); |
| + if (FLAG_experimental_classes) { |
| + EmitSuperConstructorCall(expr); |
| + } else { |
| + SuperReference* super_ref = callee->AsSuperReference(); |
| + EmitLoadSuperConstructor(super_ref); |
| + __ push(result_register()); |
| + VisitForStackValue(super_ref->this_var()); |
| + EmitCall(expr, CallICState::METHOD); |
| + } |
| } else { |
| DCHECK(call_type == Call::OTHER_CALL); |
| // Call to an arbitrary expression not handled specially above. |
| @@ -3133,6 +3137,51 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
| } |
| +void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
| + SuperReference* super_ref = expr->expression()->AsSuperReference(); |
| + EmitLoadSuperConstructor(super_ref); |
| + __ push(result_register()); |
| + |
|
arv (Not doing code reviews)
2015/01/21 19:18:55
remove one empty line
Dmitry Lomov (no reviews)
2015/01/22 11:59:00
Done.
|
| + |
| + // Push the arguments ("left-to-right") on the stack. |
| + ZoneList<Expression*>* args = expr->arguments(); |
| + int arg_count = args->length(); |
| + for (int i = 0; i < arg_count; i++) { |
| + VisitForStackValue(args->at(i)); |
| + } |
| + |
| + // Call the construct call builtin that handles allocation and |
| + // constructor invocation. |
| + SetSourcePosition(expr->position()); |
| + |
| + // Load function and argument count into edi and eax. |
| + __ Move(eax, Immediate(arg_count)); |
| + __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
| + |
| + // Record call targets in unoptimized code. |
| + if (FLAG_pretenuring_call_new) { |
| + CHECK(false); |
|
arv (Not doing code reviews)
2015/01/21 19:18:56
UNREACHABLE()
Dmitry Lomov (no reviews)
2015/01/22 11:59:00
Done.
|
| + /* |
| + EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
|
arv (Not doing code reviews)
2015/01/21 19:18:56
TODO
Dmitry Lomov (no reviews)
2015/01/22 11:59:00
Done.
|
| + DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
| + expr->CallNewFeedbackSlot().ToInt() + 1); |
| + */ |
| + } |
| + |
| + __ LoadHeapObject(ebx, FeedbackVector()); |
| + __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); |
| + |
| + CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
|
arv (Not doing code reviews)
2015/01/21 19:18:55
It is not clear to me where NewTarget is pushed on
Dmitry Lomov (no reviews)
2015/01/22 11:59:00
Not yet, added a todo.
|
| + __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| + |
| + RecordJSReturnSite(expr); |
| + |
| + PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| + EmitVariableAssignment(super_ref->this_var()->var(), Token::INIT_LET); |
|
arv (Not doing code reviews)
2015/01/21 19:18:56
Or INIT_CONST?
Dmitry Lomov (no reviews)
2015/01/22 11:59:00
Added a TODO to revisit this after TDZ is implemen
|
| + context()->Plug(eax); |
| +} |
| + |
| + |
| void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
| ZoneList<Expression*>* args = expr->arguments(); |
| DCHECK(args->length() == 1); |