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

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

Issue 1161243005: Revert of [es6] Super call in arrows and eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/variables.h ('k') | test/mjsunit/harmony/super.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/full-codegen-x64.cc
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
index 2aef9d1256625d1fe5f9eda9cbd706a2a09db77a..947de32072f0e0a1a9bb6d620746184fc91b16c6 100644
--- a/src/x64/full-codegen-x64.cc
+++ b/src/x64/full-codegen-x64.cc
@@ -232,24 +232,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, rdi, rbx, rdx);
- }
-
- 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;
- __ movp(rax, Operand(rbp, offset));
- SetVar(new_target_var, rax, rbx, rdx);
}
Variable* home_object_var = scope()->home_object_var();
@@ -1977,10 +1959,9 @@
}
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(rsp, kPointerSize));
@@ -1988,10 +1969,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()) {
@@ -2583,9 +2563,9 @@
}
case NAMED_SUPER_PROPERTY: {
__ Push(rax);
- 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; rax: home_object
Register scratch = rcx;
Register scratch2 = rdx;
@@ -2600,9 +2580,8 @@
}
case KEYED_SUPER_PROPERTY: {
__ Push(rax);
- 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 = rcx;
Register scratch2 = rdx;
@@ -2821,9 +2800,8 @@
__ movp(LoadDescriptor::ReceiverRegister(), rax);
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 {
@@ -2834,9 +2812,8 @@
__ Pop(LoadDescriptor::ReceiverRegister());
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);
}
@@ -2894,7 +2871,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 = prop->obj()->AsSuperReference();
VisitForStackValue(super_ref->home_object_var());
VisitForAccumulatorValue(super_ref->this_var());
__ Push(rax);
@@ -2951,7 +2928,7 @@
SetSourcePosition(prop->position());
// Load the function from the receiver.
- SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
+ SuperReference* super_ref = prop->obj()->AsSuperReference();
VisitForStackValue(super_ref->home_object_var());
VisitForAccumulatorValue(super_ref->this_var());
__ Push(rax);
@@ -3032,8 +3009,14 @@
}
+void FullCodeGenerator::EmitLoadSuperConstructor() {
+ __ Push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
+ __ CallRuntime(Runtime::kGetPrototype, 1);
+}
+
+
void FullCodeGenerator::EmitInitializeThisAfterSuper(
- SuperCallReference* super_ref, FeedbackVectorICSlot slot) {
+ SuperReference* super_ref, FeedbackVectorICSlot slot) {
Variable* this_var = super_ref->this_var()->var();
GetVar(rcx, this_var);
__ CompareRoot(rcx, Heap::kTheHoleValueRootIndex);
@@ -3183,7 +3166,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.
@@ -3219,14 +3202,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(result_register(), new_target_var);
+ __ Push(result_register());
+
+ EmitLoadSuperConstructor();
__ Push(result_register());
// Push the arguments ("left-to-right") on the stack.
@@ -3264,7 +3244,8 @@
RecordJSReturnSite(expr);
- EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot());
+ EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference(),
+ expr->CallFeedbackICSlot());
context()->Plug(rax);
}
@@ -4131,15 +4112,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(result_register(), new_target_var);
+ __ Push(result_register());
+
+ EmitLoadSuperConstructor();
__ Push(result_register());
// Check if the calling frame is an arguments adaptor frame.
@@ -4591,14 +4568,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);
@@ -4607,8 +4581,8 @@
__ Push(Operand(rsp, 0));
__ movp(Operand(rsp, kPointerSize), rax);
- // Push super constructor
- EmitLoadSuperConstructor(super_call_ref);
+ // Push super
+ EmitLoadSuperConstructor();
__ Push(result_register());
// Push arguments array
@@ -4625,7 +4599,7 @@
context()->DropAndPlug(1, rax);
// TODO(mvstanton): with FLAG_vector_stores this needs a slot id.
- EmitInitializeThisAfterSuper(super_call_ref);
+ EmitInitializeThisAfterSuper(super_reference);
}
@@ -4850,9 +4824,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(rsp, kPointerSize));
__ Push(result_register());
@@ -4861,9 +4835,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(rsp, 2 * kPointerSize));
« no previous file with comments | « src/variables.h ('k') | test/mjsunit/harmony/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698