Chromium Code Reviews| Index: src/x64/full-codegen-x64.cc |
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
| index 90df54995f3362a0922f7cb6ff913c5deabe4773..e85722738d3198d41b6b98e038b6230ed273ceea 100644 |
| --- a/src/x64/full-codegen-x64.cc |
| +++ b/src/x64/full-codegen-x64.cc |
| @@ -2867,6 +2867,13 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
| } |
| +void FullCodeGenerator::EmitLoadSuperConstructor(SuperReference* expr) { |
| + DCHECK(super_ref != NULL); |
| + __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| + __ CallRuntime(Runtime::kGetPrototype, 1); |
| +} |
| + |
| + |
| void FullCodeGenerator::VisitCall(Call* expr) { |
| #ifdef DEBUG |
| // We want to verify that RecordJSReturnSite gets called on all paths |
| @@ -2977,8 +2984,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
| } else if (call_type == Call::SUPER_CALL) { |
| SuperReference* super_ref = callee->AsSuperReference(); |
| DCHECK(super_ref != NULL); |
|
Igor Sheludko
2014/10/23 07:37:23
We have this DCHECK inside EmitLoadSuperConstructo
Dmitry Lomov (no reviews)
2014/10/23 07:55:19
Done.
|
| - __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| - __ CallRuntime(Runtime::kGetPrototype, 1); |
| + EmitLoadSuperConstructor(super_ref); |
| __ Push(result_register()); |
| VisitForStackValue(super_ref->this_var()); |
| EmitCall(expr, CallICState::METHOD); |
| @@ -3009,7 +3015,12 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
| // 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. |
| - VisitForStackValue(expr->expression()); |
| + if (expr->expression()->IsSuperReference()) { |
| + EmitLoadSuperConstructor(expr->expression()->AsSuperReference()); |
| + __ Push(result_register()); |
| + } else { |
| + VisitForStackValue(expr->expression()); |
| + } |
| // Push the arguments ("left-to-right") on the stack. |
| ZoneList<Expression*>* args = expr->arguments(); |