Chromium Code Reviews| Index: src/ia32/full-codegen-ia32.cc |
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
| index a5065aa47f678431b318c793039c133e682fac63..50e40c8e5455df398258326eb3921339e7267e89 100644 |
| --- a/src/ia32/full-codegen-ia32.cc |
| +++ b/src/ia32/full-codegen-ia32.cc |
| @@ -1816,13 +1816,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. |
| @@ -1830,6 +1836,13 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
| case VARIABLE: |
| // Nothing to do here. |
| break; |
| + case NAMED_SUPER_PROPERTY: |
| + VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
| + EmitLoadHomeObject(property->obj()->AsSuperReference()); |
| + __ push(result_register()); |
| + __ push(MemOperand(esp, kPointerSize)); |
| + __ push(result_register()); |
| + break; |
|
Igor Sheludko
2014/09/25 08:06:02
I'm afraid that the second pair of receiver-home o
|
| case NAMED_PROPERTY: |
| if (expr->is_compound()) { |
| // We need the receiver both on the stack and in the register. |
| @@ -1863,6 +1876,10 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
| EmitVariableLoad(expr->target()->AsVariableProxy()); |
| PrepareForBailout(expr->target(), TOS_REG); |
| break; |
| + case NAMED_SUPER_PROPERTY: |
| + EmitNamedSuperPropertyLoad(property); |
| + PrepareForBailoutForId(property->LoadId(), TOS_REG); |
| + break; |
| case NAMED_PROPERTY: |
| EmitNamedPropertyLoad(property); |
| PrepareForBailoutForId(property->LoadId(), TOS_REG); |
| @@ -1912,6 +1929,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; |
| @@ -2251,15 +2271,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(eax); |
| - VisitForStackValue(super_ref->this_var()); |
| __ push(Immediate(key->value())); |
| __ CallRuntime(Runtime::kLoadFromSuper, 3); |
| } |
| @@ -2530,6 +2547,23 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
| } |
| +void FullCodeGenerator::EmitNamedSuperPropertyAssignment(Assignment* expr) { |
| + // Assignment to named property of super. |
| + // eax : value |
| + // stack : receiver ('this'), home_object |
| + Property* prop = expr->target()->AsProperty(); |
| + DCHECK(prop != NULL); |
| + Literal* key = prop->key()->AsLiteral(); |
| + DCHECK(key != NULL); |
| + |
| + __ push(eax); |
| + __ push(Immediate(key->value())); |
| + __ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict |
| + : Runtime::kStoreToSuper_Sloppy), |
| + 4); |
| +} |
| + |
| + |
| void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
| // Assignment to a property, using a keyed store IC. |
| // eax : value |
| @@ -2559,6 +2593,9 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
| __ Move(LoadDescriptor::ReceiverRegister(), result_register()); |
| EmitNamedPropertyLoad(expr); |
| } else { |
| + VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
| + EmitLoadHomeObject(expr->obj()->AsSuperReference()); |
| + __ push(result_register()); |
| EmitNamedSuperPropertyLoad(expr); |
| } |
| PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
| @@ -2627,14 +2664,14 @@ void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { |
| __ push(eax); |
| VisitForAccumulatorValue(super_ref->this_var()); |
| __ push(eax); |
| - __ push(Operand(esp, kPointerSize)); |
| __ push(eax); |
| + __ push(Operand(esp, kPointerSize * 2)); |
| __ push(Immediate(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); |