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 13f24d5d1076e2950ff25208614cae91169c96b0..c82ed3d59fab3899aaf229448521ba2525ada7ab 100644 |
| --- a/src/ia32/full-codegen-ia32.cc |
| +++ b/src/ia32/full-codegen-ia32.cc |
| @@ -2300,6 +2300,14 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| } |
| +void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| + // Stack: receiver, home_object, key. |
| + SetSourcePosition(prop->position()); |
| + |
| + __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| +} |
| + |
| + |
| void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| Token::Value op, |
| OverwriteMode mode, |
| @@ -2605,11 +2613,19 @@ void FullCodeGenerator::VisitProperty(Property* expr) { |
| PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
| context()->Plug(eax); |
| } else { |
| - VisitForStackValue(expr->obj()); |
| - VisitForAccumulatorValue(expr->key()); |
| - __ pop(LoadDescriptor::ReceiverRegister()); // Object. |
| - __ Move(LoadDescriptor::NameRegister(), result_register()); // Key. |
| - EmitKeyedPropertyLoad(expr); |
| + if (!expr->IsSuperAccess()) { |
| + VisitForStackValue(expr->obj()); |
| + VisitForAccumulatorValue(expr->key()); |
| + __ pop(LoadDescriptor::ReceiverRegister()); // Object. |
| + __ Move(LoadDescriptor::NameRegister(), result_register()); // Key. |
| + EmitKeyedPropertyLoad(expr); |
| + } else { |
| + VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
| + EmitLoadHomeObject(expr->obj()->AsSuperReference()); |
| + __ push(result_register()); |
| + VisitForStackValue(expr->key()); |
| + EmitKeyedSuperPropertyLoad(expr); |
| + } |
| context()->Plug(eax); |
| } |
| } |
| @@ -2712,6 +2728,40 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, |
| } |
| +void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
| + Expression* callee = expr->expression(); |
| + DCHECK(callee->IsProperty()); |
| + Property* prop = callee->AsProperty(); |
| + DCHECK(prop->IsSuperAccess()); |
| + |
| + SetSourcePosition(prop->position()); |
| + // Load the function from the receiver. |
| + SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference(); |
| + EmitLoadHomeObject(super_ref); |
| + __ push(eax); |
| + VisitForAccumulatorValue(super_ref->this_var()); |
| + __ push(eax); |
| + __ push(eax); |
| + __ push(Operand(esp, kPointerSize * 2)); |
| + VisitForStackValue(prop->key()); |
| + // Stack here: |
| + // - home_object |
| + // - this (receiver) |
| + // - this (receiver) <-- LoadFromSuper will pop here and below. |
|
Igor Sheludko
2014/10/02 09:32:05
LoadKeyedFromSuper in the comment
Dmitry Lomov (no reviews)
2014/10/02 09:54:12
Done in all ports
|
| + // - home_object |
| + // - key |
| + __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| + |
| + // Replace home_object with target function. |
| + __ mov(Operand(esp, kPointerSize), eax); |
| + |
| + // Stack here: |
| + // - target function |
| + // - this (receiver) |
| + EmitCall(expr, CallICState::METHOD); |
| +} |
| + |
| + |
| void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
| // Load the arguments. |
| ZoneList<Expression*>* args = expr->arguments(); |
| @@ -2853,9 +2903,12 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
| } else if (call_type == Call::PROPERTY_CALL) { |
| Property* property = callee->AsProperty(); |
| bool is_named_call = property->key()->IsPropertyName(); |
| - // super.x() is handled in EmitCallWithLoadIC. |
| - if (property->IsSuperAccess() && is_named_call) { |
| - EmitSuperCallWithLoadIC(expr); |
| + if (property->IsSuperAccess()) { |
| + if (is_named_call) { |
| + EmitSuperCallWithLoadIC(expr); |
| + } else { |
| + EmitKeyedSuperCallWithLoadIC(expr); |
| + } |
| } else { |
| { |
| PreservePositionScope scope(masm()->positions_recorder()); |