Index: src/mips64/full-codegen-mips64.cc |
diff --git a/src/mips64/full-codegen-mips64.cc b/src/mips64/full-codegen-mips64.cc |
index 7430c8e36186fa513a2ef024be777d4cc6fe3f44..38798873159810af7e7092157092aada3ec73e80 100644 |
--- a/src/mips64/full-codegen-mips64.cc |
+++ b/src/mips64/full-codegen-mips64.cc |
@@ -1875,22 +1875,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
Comment cmnt(masm_, "[ Assignment"); |
- // Left-hand side can only be a property, a global or a (parameter or local) |
- // slot. |
- enum LhsKind { |
- VARIABLE, |
- NAMED_PROPERTY, |
- KEYED_PROPERTY, |
- NAMED_SUPER_PROPERTY |
- }; |
- LhsKind assign_type = VARIABLE; |
Property* property = expr->target()->AsProperty(); |
- if (property != NULL) { |
- assign_type = (property->key()->IsPropertyName()) |
- ? (property->IsSuperAccess() ? NAMED_SUPER_PROPERTY |
- : NAMED_PROPERTY) |
- : KEYED_PROPERTY; |
- } |
+ LhsKind assign_type = GetAssignType(property); |
// Evaluate LHS expression. |
switch (assign_type) { |
@@ -1916,6 +1902,20 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
__ Push(scratch, result_register()); |
} |
break; |
+ case KEYED_SUPER_PROPERTY: { |
+ const Register scratch = a1; |
+ VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
+ EmitLoadHomeObject(property->obj()->AsSuperReference()); |
+ __ Move(scratch, result_register()); |
+ VisitForAccumulatorValue(property->key()); |
+ __ Push(scratch, result_register()); |
+ if (expr->is_compound()) { |
+ const Register scratch1 = a4; |
+ __ ld(scratch1, MemOperand(sp, 2 * kPointerSize)); |
+ __ Push(scratch1, scratch, result_register()); |
+ } |
+ break; |
+ } |
case KEYED_PROPERTY: |
// We need the key and receiver on both the stack and in v0 and a1. |
if (expr->is_compound()) { |
@@ -1948,6 +1948,10 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
EmitNamedSuperPropertyLoad(property); |
PrepareForBailoutForId(property->LoadId(), TOS_REG); |
break; |
+ case KEYED_SUPER_PROPERTY: |
+ EmitKeyedSuperPropertyLoad(property); |
+ PrepareForBailoutForId(property->LoadId(), TOS_REG); |
+ break; |
case KEYED_PROPERTY: |
EmitKeyedPropertyLoad(property); |
PrepareForBailoutForId(property->LoadId(), TOS_REG); |
@@ -1998,6 +2002,10 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
EmitNamedSuperPropertyStore(property); |
context()->Plug(v0); |
break; |
+ case KEYED_SUPER_PROPERTY: |
+ EmitKeyedSuperPropertyStore(property); |
+ context()->Plug(v0); |
+ break; |
case KEYED_PROPERTY: |
EmitKeyedPropertyAssignment(expr); |
break; |
@@ -2636,14 +2644,27 @@ void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { |
Literal* key = prop->key()->AsLiteral(); |
DCHECK(key != NULL); |
- __ Push(v0); |
__ Push(key->value()); |
+ __ Push(v0); |
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict |
: Runtime::kStoreToSuper_Sloppy), |
4); |
} |
+void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) { |
+ // Assignment to named property of super. |
+ // v0 : value |
+ // stack : receiver ('this'), home_object, key |
+ DCHECK(prop != NULL); |
+ |
+ __ Push(v0); |
+ __ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreKeyedToSuper_Strict |
+ : Runtime::kStoreKeyedToSuper_Sloppy), |
+ 4); |
+} |
+ |
+ |
void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
// Assignment to a property, using a keyed store IC. |
@@ -4441,24 +4462,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
Comment cmnt(masm_, "[ CountOperation"); |
SetSourcePosition(expr->position()); |
- // Expression can only be a property, a global or a (parameter or local) |
- // slot. |
- enum LhsKind { |
- VARIABLE, |
- NAMED_PROPERTY, |
- KEYED_PROPERTY, |
- NAMED_SUPER_PROPERTY |
- }; |
- LhsKind assign_type = VARIABLE; |
Property* prop = expr->expression()->AsProperty(); |
- // In case of a property we use the uninitialized expression context |
- // of the key to detect a named property. |
- if (prop != NULL) { |
- assign_type = |
- (prop->key()->IsPropertyName()) |
- ? (prop->IsSuperAccess() ? NAMED_SUPER_PROPERTY : NAMED_PROPERTY) |
- : KEYED_PROPERTY; |
- } |
+ LhsKind assign_type = GetAssignType(prop); |
// Evaluate expression and get value. |
if (assign_type == VARIABLE) { |
@@ -4471,26 +4476,51 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
__ li(at, Operand(Smi::FromInt(0))); |
__ push(at); |
} |
- if (assign_type == NAMED_PROPERTY) { |
- // Put the object both on the stack and in the register. |
- VisitForStackValue(prop->obj()); |
- __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
- EmitNamedPropertyLoad(prop); |
- } else if (assign_type == NAMED_SUPER_PROPERTY) { |
- VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
- EmitLoadHomeObject(prop->obj()->AsSuperReference()); |
- __ Push(result_register()); |
- const Register scratch = a1; |
- __ ld(scratch, MemOperand(sp, kPointerSize)); |
- __ Push(scratch, result_register()); |
- EmitNamedSuperPropertyLoad(prop); |
- } else { |
- VisitForStackValue(prop->obj()); |
- VisitForStackValue(prop->key()); |
- __ ld(LoadDescriptor::ReceiverRegister(), |
- MemOperand(sp, 1 * kPointerSize)); |
- __ ld(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); |
- EmitKeyedPropertyLoad(prop); |
+ switch (assign_type) { |
+ case NAMED_PROPERTY: { |
+ // Put the object both on the stack and in the register. |
+ VisitForStackValue(prop->obj()); |
+ __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
+ EmitNamedPropertyLoad(prop); |
+ break; |
+ } |
+ |
+ case NAMED_SUPER_PROPERTY: { |
+ VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
+ EmitLoadHomeObject(prop->obj()->AsSuperReference()); |
+ __ Push(result_register()); |
+ const Register scratch = a1; |
+ __ ld(scratch, MemOperand(sp, kPointerSize)); |
+ __ Push(scratch, result_register()); |
+ EmitNamedSuperPropertyLoad(prop); |
+ break; |
+ } |
+ |
+ case KEYED_SUPER_PROPERTY: { |
+ VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
+ EmitLoadHomeObject(prop->obj()->AsSuperReference()); |
+ const Register scratch = a1; |
+ const Register scratch1 = a4; |
+ __ Move(scratch, result_register()); |
+ VisitForAccumulatorValue(prop->key()); |
+ __ Push(scratch, result_register()); |
+ __ ld(scratch1, MemOperand(sp, 2 * kPointerSize)); |
+ __ Push(scratch1, scratch, result_register()); |
+ EmitKeyedSuperPropertyLoad(prop); |
+ break; |
+ } |
+ |
+ case KEYED_PROPERTY: { |
+ VisitForStackValue(prop->obj()); |
+ VisitForStackValue(prop->key()); |
+ __ ld(LoadDescriptor::ReceiverRegister(), |
+ MemOperand(sp, 1 * kPointerSize)); |
+ __ ld(LoadDescriptor::NameRegister(), MemOperand(sp, 0)); |
+ EmitKeyedPropertyLoad(prop); |
+ } |
+ |
+ case VARIABLE: |
+ UNREACHABLE(); |
} |
} |
@@ -4531,6 +4561,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
case KEYED_PROPERTY: |
__ sd(v0, MemOperand(sp, 2 * kPointerSize)); |
break; |
+ case KEYED_SUPER_PROPERTY: |
+ __ sd(v0, MemOperand(sp, 3 * kPointerSize)); |
+ break; |
} |
} |
} |
@@ -4567,6 +4600,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
case KEYED_PROPERTY: |
__ sd(v0, MemOperand(sp, 2 * kPointerSize)); |
break; |
+ case KEYED_SUPER_PROPERTY: |
+ __ sd(v0, MemOperand(sp, 3 * kPointerSize)); |
+ break; |
} |
} |
} |
@@ -4633,6 +4669,17 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
} |
break; |
} |
+ case KEYED_SUPER_PROPERTY: { |
+ EmitKeyedSuperPropertyStore(prop); |
+ if (expr->is_postfix()) { |
+ if (!context()->IsEffect()) { |
+ context()->PlugTOS(); |
+ } |
+ } else { |
+ context()->Plug(v0); |
+ } |
+ break; |
+ } |
case KEYED_PROPERTY: { |
__ mov(StoreDescriptor::ValueRegister(), result_register()); |
__ Pop(StoreDescriptor::ReceiverRegister(), |