| Index: src/ia32/full-codegen-ia32.cc
|
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
|
| index 5a242e4b6d576c12e37983354b169ce711eea7b0..74e14a02923465744628676e33c6bd0113a98839 100644
|
| --- a/src/ia32/full-codegen-ia32.cc
|
| +++ b/src/ia32/full-codegen-ia32.cc
|
| @@ -1277,6 +1277,25 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
|
| }
|
|
|
|
|
| +void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) {
|
| + Comment cnmt(masm_, "[ SuperReference ");
|
| +
|
| + __ mov(LoadConvention::ReceiverRegister(),
|
| + Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
|
| +
|
| + Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol());
|
| + __ mov(LoadConvention::NameRegister(), home_object_symbol);
|
| +
|
| + CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId());
|
| +
|
| + __ cmp(eax, isolate()->factory()->undefined_value());
|
| + Label done;
|
| + __ j(not_equal, &done);
|
| + __ CallRuntime(Runtime::kThrowNonMethodError, 0);
|
| + __ bind(&done);
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
|
| TypeofState typeof_state,
|
| Label* slow) {
|
| @@ -2219,6 +2238,17 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
| SetSourcePosition(prop->position());
|
| Literal* key = prop->key()->AsLiteral();
|
| DCHECK(!key->value()->IsSmi());
|
| +
|
| + if (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);
|
| + return;
|
| + }
|
| +
|
| __ mov(LoadConvention::NameRegister(), Immediate(key->value()));
|
| if (FLAG_vector_ics) {
|
| __ mov(VectorLoadConvention::SlotRegister(),
|
| @@ -2522,8 +2552,10 @@ void FullCodeGenerator::VisitProperty(Property* expr) {
|
| Expression* key = expr->key();
|
|
|
| if (key->IsPropertyName()) {
|
| - VisitForAccumulatorValue(expr->obj());
|
| - __ Move(LoadConvention::ReceiverRegister(), result_register());
|
| + if (!expr->IsSuperAccess()) {
|
| + VisitForAccumulatorValue(expr->obj());
|
| + __ Move(LoadConvention::ReceiverRegister(), result_register());
|
| + }
|
| EmitNamedPropertyLoad(expr);
|
| PrepareForBailoutForId(expr->LoadId(), TOS_REG);
|
| context()->Plug(eax);
|
| @@ -2561,6 +2593,22 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
|
| // Push undefined as receiver. This is patched in the method prologue if it
|
| // is a sloppy mode method.
|
| __ push(Immediate(isolate()->factory()->undefined_value()));
|
| + } else if (callee->AsProperty()->IsSuperAccess()) {
|
| + Property* prop = callee->AsProperty();
|
| + SetSourcePosition(prop->position());
|
| + Literal* key = prop->key()->AsLiteral();
|
| + DCHECK(!key->value()->IsSmi());
|
| + // 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(Operand(esp, kPointerSize));
|
| + __ push(eax);
|
| + __ push(Immediate(key->value()));
|
| + __ CallRuntime(Runtime::kLoadFromSuper, 3);
|
| + __ mov(Operand(esp, kPointerSize), eax);
|
| } else {
|
| // Load the function from the receiver.
|
| DCHECK(callee->IsProperty());
|
| @@ -2736,10 +2784,13 @@ void FullCodeGenerator::VisitCall(Call* expr) {
|
|
|
| } else if (call_type == Call::PROPERTY_CALL) {
|
| Property* property = callee->AsProperty();
|
| - { PreservePositionScope scope(masm()->positions_recorder());
|
| + bool is_named_call = property->key()->IsPropertyName();
|
| + // super.x() is handled in EmitCallWithLoadIC.
|
| + if (!property->IsSuperAccess() || !is_named_call) {
|
| + PreservePositionScope scope(masm()->positions_recorder());
|
| VisitForStackValue(property->obj());
|
| }
|
| - if (property->key()->IsPropertyName()) {
|
| + if (is_named_call) {
|
| EmitCallWithLoadIC(expr);
|
| } else {
|
| EmitKeyedCallWithLoadIC(expr, property->key());
|
|
|