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 5a242e4b6d576c12e37983354b169ce711eea7b0..9bb25a38120373fdc1fabcc391f8bcf685dea083 100644 |
| --- a/src/ia32/full-codegen-ia32.cc |
| +++ b/src/ia32/full-codegen-ia32.cc |
| @@ -1277,6 +1277,29 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
| } |
| +void FullCodeGenerator::VisitSuperReference(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); |
| + __ push(Immediate(isolate()->factory()->empty_string())); |
| + __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| + __ bind(&done); |
| + __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); |
| + __ mov(eax, FieldOperand(eax, Map::kPrototypeOffset)); |
|
Dmitry Lomov (no reviews)
2014/09/15 13:18:25
As discussed offline, this skips the access check
Dmitry Lomov (no reviews)
2014/09/16 13:15:55
Done.
|
| + context()->Plug(eax); |
| +} |
| + |
| + |
| void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
| TypeofState typeof_state, |
| Label* slow) { |
| @@ -2219,6 +2242,17 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| SetSourcePosition(prop->position()); |
| Literal* key = prop->key()->AsLiteral(); |
| DCHECK(!key->value()->IsSmi()); |
| + |
| + if (prop->IsSuperAccess()) { |
| + __ push(LoadConvention::ReceiverRegister()); |
| + |
| + SuperReference* super_ref = prop->obj()->AsSuperReference(); |
| + 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(), |
| @@ -2561,6 +2595,20 @@ 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(); |
| + 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()); |
| @@ -2592,8 +2640,14 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, |
| PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
| // Push the target function under the receiver. |
| - __ push(Operand(esp, 0)); |
| - __ mov(Operand(esp, kPointerSize), eax); |
| + if (callee->AsProperty()->IsSuperAccess()) { |
| + __ mov(Operand(esp, 0), eax); |
| + SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference(); |
| + VisitForStackValue(super_ref->this_var()); |
| + } else { |
| + __ push(Operand(esp, 0)); |
| + __ mov(Operand(esp, kPointerSize), eax); |
| + } |
| EmitCall(expr, CallIC::METHOD); |
| } |