Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1035)

Unified Diff: src/x64/full-codegen-x64.cc

Issue 938443002: [es6] implement spread calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove --harmony-spread flag Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/x64/full-codegen-x64.cc
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
index b85b612d1373527570eaa3da55ad13ef0bdd190f..0a272cf16e2a771fe773731663cc43249f2e0fc3 100644
--- a/src/x64/full-codegen-x64.cc
+++ b/src/x64/full-codegen-x64.cc
@@ -3024,6 +3024,21 @@ void FullCodeGenerator::EmitLoadSuperConstructor() {
}
+void FullCodeGenerator::EmitInitializeThisAfterSuper(
+ SuperReference* super_ref) {
+ Variable* this_var = super_ref->this_var()->var();
+ GetVar(rcx, this_var);
+ __ CompareRoot(rcx, Heap::kTheHoleValueRootIndex);
+ Label uninitialized_this;
+ __ j(equal, &uninitialized_this);
+ __ Push(this_var->name());
+ __ CallRuntime(Runtime::kThrowReferenceError, 1);
+ __ bind(&uninitialized_this);
+
+ EmitVariableAssignment(this_var, Token::INIT_CONST);
+}
+
+
void FullCodeGenerator::VisitCall(Call* expr) {
#ifdef DEBUG
// We want to verify that RecordJSReturnSite gets called on all paths
@@ -3238,17 +3253,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
RecordJSReturnSite(expr);
- SuperReference* super_ref = expr->expression()->AsSuperReference();
- Variable* this_var = super_ref->this_var()->var();
- GetVar(rcx, this_var);
- __ CompareRoot(rcx, Heap::kTheHoleValueRootIndex);
- Label uninitialized_this;
- __ j(equal, &uninitialized_this);
- __ Push(this_var->name());
- __ CallRuntime(Runtime::kThrowReferenceError, 1);
- __ bind(&uninitialized_this);
-
- EmitVariableAssignment(this_var, Token::INIT_CONST);
+ EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference());
context()->Plug(rax);
}
@@ -4596,7 +4601,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
// Push the arguments ("left-to-right").
for (int i = 0; i < arg_count; i++) {
- VisitForStackValue(args->at(i));
+ VisitForStackValue(args->at(i), true);
}
// Record source position of the IC call.
@@ -4608,7 +4613,9 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
// Restore context register.
__ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
context()->DropAndPlug(1, rax);
-
+ if (expr->IsSuperCall()) {
arv (Not doing code reviews) 2015/03/30 22:19:49 This is a bit strange/hacky. I assume this comes f
caitp (gmail) 2015/03/30 22:38:12 it's kind of a hack, yeah... but, without it, `thi
Dmitry Lomov (no reviews) 2015/03/31 10:09:42 IsSuperCall flag on CallRuntime node is super-hack
+ EmitInitializeThisAfterSuper(args->at(0)->AsSuperReference());
+ }
} else {
const Runtime::Function* function = expr->function();
switch (function->function_id) {

Powered by Google App Engine
This is Rietveld 408576698