Index: src/arm64/full-codegen-arm64.cc |
diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc |
index 619568fb08384999d91abb40d8787eb39746bcc0..9d544825e41b9a7d5998edc7bf7f903572badb55 100644 |
--- a/src/arm64/full-codegen-arm64.cc |
+++ b/src/arm64/full-codegen-arm64.cc |
@@ -1864,13 +1864,19 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
// Left-hand side can only be a property, a global or a (parameter or local) |
// slot. |
- enum LhsKind { VARIABLE, NAMED_PROPERTY, KEYED_PROPERTY }; |
+ 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()) |
- ? NAMED_PROPERTY |
- : KEYED_PROPERTY; |
+ ? (property->IsSuperAccess() ? NAMED_SUPER_PROPERTY |
+ : NAMED_PROPERTY) |
+ : KEYED_PROPERTY; |
} |
// Evaluate LHS expression. |
@@ -1887,6 +1893,16 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
VisitForStackValue(property->obj()); |
} |
break; |
+ case NAMED_SUPER_PROPERTY: |
+ VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
+ EmitLoadHomeObject(property->obj()->AsSuperReference()); |
+ __ Push(result_register()); |
+ if (expr->is_compound()) { |
+ const Register scratch = x10; |
+ __ Peek(scratch, kPointerSize); |
+ __ Push(scratch, result_register()); |
+ } |
+ break; |
case KEYED_PROPERTY: |
if (expr->is_compound()) { |
VisitForStackValue(property->obj()); |
@@ -1913,6 +1929,10 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
EmitNamedPropertyLoad(property); |
PrepareForBailoutForId(property->LoadId(), TOS_REG); |
break; |
+ case NAMED_SUPER_PROPERTY: |
+ EmitNamedSuperPropertyLoad(property); |
+ PrepareForBailoutForId(property->LoadId(), TOS_REG); |
+ break; |
case KEYED_PROPERTY: |
EmitKeyedPropertyLoad(property); |
PrepareForBailoutForId(property->LoadId(), TOS_REG); |
@@ -1959,6 +1979,9 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
case NAMED_PROPERTY: |
EmitNamedPropertyAssignment(expr); |
break; |
+ case NAMED_SUPER_PROPERTY: |
+ EmitNamedSuperPropertyAssignment(expr); |
+ break; |
case KEYED_PROPERTY: |
EmitKeyedPropertyAssignment(expr); |
break; |
@@ -1983,15 +2006,12 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
+ // Stack: receiver, home_object. |
SetSourcePosition(prop->position()); |
Literal* key = prop->key()->AsLiteral(); |
DCHECK(!key->value()->IsSmi()); |
DCHECK(prop->IsSuperAccess()); |
- SuperReference* super_ref = prop->obj()->AsSuperReference(); |
- EmitLoadHomeObject(super_ref); |
- __ Push(x0); |
- VisitForStackValue(super_ref->this_var()); |
__ Push(key->value()); |
__ CallRuntime(Runtime::kLoadFromSuper, 3); |
} |
@@ -2277,6 +2297,24 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
} |
+void FullCodeGenerator::EmitNamedSuperPropertyAssignment(Assignment* expr) { |
+ // Assignment to named property of super. |
+ // x0 : value |
+ // stack : receiver ('this'), home_object |
+ Property* prop = expr->target()->AsProperty(); |
+ DCHECK(prop != NULL); |
+ Literal* key = prop->key()->AsLiteral(); |
+ DCHECK(key != NULL); |
+ |
+ __ Push(x0); |
+ __ Push(key->value()); |
+ __ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict |
+ : Runtime::kStoreToSuper_Sloppy), |
+ 4); |
+ context()->Plug(x0); |
+} |
+ |
+ |
void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
ASM_LOCATION("FullCodeGenerator::EmitKeyedPropertyAssignment"); |
// Assignment to a property, using a keyed store IC. |
@@ -2305,6 +2343,9 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
__ Move(LoadDescriptor::ReceiverRegister(), x0); |
EmitNamedPropertyLoad(expr); |
} else { |
+ VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
+ EmitLoadHomeObject(expr->obj()->AsSuperReference()); |
+ __ Push(result_register()); |
EmitNamedSuperPropertyLoad(expr); |
} |
PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
@@ -2379,14 +2420,14 @@ void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { |
VisitForAccumulatorValue(super_ref->this_var()); |
__ Push(x0); |
__ Peek(scratch, kPointerSize); |
- __ Push(scratch, x0); |
+ __ Push(x0, scratch); |
__ Push(key->value()); |
// Stack here: |
// - home_object |
// - this (receiver) |
- // - home_object <-- LoadFromSuper will pop here and below. |
- // - this (receiver) |
+ // - this (receiver) <-- LoadFromSuper will pop here and below. |
+ // - home_object |
// - key |
__ CallRuntime(Runtime::kLoadFromSuper, 3); |
@@ -4006,6 +4047,11 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
if (prop != NULL) { |
assign_type = |
(prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; |
+ if (prop->IsSuperAccess()) { |
+ // throw exception. |
+ VisitSuperReference(prop->obj()->AsSuperReference()); |
+ return; |
+ } |
} |
// Evaluate expression and get value. |