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

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

Issue 1135243004: [es6] Support super.property in eval and arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code review cleanup 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/ia32/full-codegen-ia32.cc ('k') | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index f16030539d4258fe01162638558715ccfb10bb92..eaddb87f4921c3477fe042a78b84b4096c522ae6 100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -251,6 +251,11 @@ void FullCodeGenerator::Generate() {
}
}
+ Variable* home_object_var = scope()->home_object_var();
+ if (home_object_var != nullptr) {
+ __ Push(a1);
+ }
+
ArgumentsAccessStub::HasNewTarget has_new_target =
IsSubclassConstructor(info->function()->kind())
? ArgumentsAccessStub::HAS_NEW_TARGET
@@ -317,6 +322,19 @@ void FullCodeGenerator::Generate() {
SetVar(arguments, v0, a1, a2);
}
+ // Possibly set up a local binding to the [[HomeObject]].
+ if (home_object_var != nullptr) {
+ Comment cmnt(masm_, "[ Home object");
+ __ Pop(LoadDescriptor::ReceiverRegister());
+ Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol());
+ __ li(LoadDescriptor::NameRegister(), Operand(home_object_symbol));
+ __ li(LoadDescriptor::SlotRegister(),
+ Operand(SmiFromSlot(function()->HomeObjectFeedbackSlot())));
+ CallLoadIC(NOT_CONTEXTUAL);
+
+ SetVar(home_object_var, v0, a1, a2);
+ }
+
if (FLAG_trace) {
__ CallRuntime(Runtime::kTraceEnter, 0);
}
@@ -1313,26 +1331,6 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
}
-void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) {
- Comment cnmt(masm_, "[ SuperReference ");
-
- __ lw(LoadDescriptor::ReceiverRegister(),
- MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
-
- Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol());
- __ li(LoadDescriptor::NameRegister(), home_object_symbol);
-
- __ li(LoadDescriptor::SlotRegister(),
- Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot())));
- CallLoadIC(NOT_CONTEXTUAL);
-
- Label done;
- __ Branch(&done, ne, v0, Operand(isolate()->factory()->undefined_value()));
- __ CallRuntime(Runtime::kThrowNonMethodError, 0);
- __ bind(&done);
-}
-
-
void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer,
int offset) {
if (NeedsHomeObject(initializer)) {
@@ -1966,7 +1964,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
break;
case NAMED_SUPER_PROPERTY:
VisitForStackValue(property->obj()->AsSuperReference()->this_var());
- EmitLoadHomeObject(property->obj()->AsSuperReference());
+ VisitForAccumulatorValue(
+ property->obj()->AsSuperReference()->home_object_var());
__ Push(result_register());
if (expr->is_compound()) {
const Register scratch = a1;
@@ -1977,7 +1976,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
case KEYED_SUPER_PROPERTY: {
const Register scratch = a1;
VisitForStackValue(property->obj()->AsSuperReference()->this_var());
- EmitLoadHomeObject(property->obj()->AsSuperReference());
+ VisitForAccumulatorValue(
+ property->obj()->AsSuperReference()->home_object_var());
__ Move(scratch, result_register());
VisitForAccumulatorValue(property->key());
__ Push(scratch, result_register());
@@ -2610,7 +2610,8 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
case NAMED_SUPER_PROPERTY: {
__ Push(v0);
VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
- EmitLoadHomeObject(prop->obj()->AsSuperReference());
+ VisitForAccumulatorValue(
+ prop->obj()->AsSuperReference()->home_object_var());
// stack: value, this; v0: home_object
Register scratch = a2;
Register scratch2 = a3;
@@ -2626,8 +2627,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
case KEYED_SUPER_PROPERTY: {
__ Push(v0);
VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
- EmitLoadHomeObject(prop->obj()->AsSuperReference());
- __ Push(result_register());
+ VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var());
VisitForAccumulatorValue(prop->key());
Register scratch = a2;
Register scratch2 = a3;
@@ -2844,8 +2844,7 @@ void FullCodeGenerator::VisitProperty(Property* expr) {
EmitNamedPropertyLoad(expr);
} else {
VisitForStackValue(expr->obj()->AsSuperReference()->this_var());
- EmitLoadHomeObject(expr->obj()->AsSuperReference());
- __ Push(result_register());
+ VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var());
EmitNamedSuperPropertyLoad(expr);
}
} else {
@@ -2857,8 +2856,7 @@ void FullCodeGenerator::VisitProperty(Property* expr) {
EmitKeyedPropertyLoad(expr);
} else {
VisitForStackValue(expr->obj()->AsSuperReference()->this_var());
- EmitLoadHomeObject(expr->obj()->AsSuperReference());
- __ Push(result_register());
+ VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var());
VisitForStackValue(expr->key());
EmitKeyedSuperPropertyLoad(expr);
}
@@ -2921,7 +2919,7 @@ void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) {
// Load the function from the receiver.
const Register scratch = a1;
SuperReference* super_ref = prop->obj()->AsSuperReference();
- EmitLoadHomeObject(super_ref);
+ VisitForAccumulatorValue(super_ref->home_object_var());
__ mov(scratch, v0);
VisitForAccumulatorValue(super_ref->this_var());
__ Push(scratch, v0, v0, scratch);
@@ -2979,7 +2977,7 @@ void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
// Load the function from the receiver.
const Register scratch = a1;
SuperReference* super_ref = prop->obj()->AsSuperReference();
- EmitLoadHomeObject(super_ref);
+ VisitForAccumulatorValue(super_ref->home_object_var());
__ Move(scratch, v0);
VisitForAccumulatorValue(super_ref->this_var());
__ Push(scratch, v0, v0, scratch);
@@ -4851,7 +4849,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
case NAMED_SUPER_PROPERTY: {
VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
- EmitLoadHomeObject(prop->obj()->AsSuperReference());
+ VisitForAccumulatorValue(
+ prop->obj()->AsSuperReference()->home_object_var());
__ Push(result_register());
const Register scratch = a1;
__ lw(scratch, MemOperand(sp, kPointerSize));
@@ -4862,7 +4861,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
case KEYED_SUPER_PROPERTY: {
VisitForStackValue(prop->obj()->AsSuperReference()->this_var());
- EmitLoadHomeObject(prop->obj()->AsSuperReference());
+ VisitForAccumulatorValue(
+ prop->obj()->AsSuperReference()->home_object_var());
const Register scratch = a1;
const Register scratch1 = t0;
__ Move(scratch, result_register());
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698