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..edb235943b19fcb26819c03c17f260acff60afd9 100644 |
| --- a/src/ia32/full-codegen-ia32.cc |
| +++ b/src/ia32/full-codegen-ia32.cc |
| @@ -1277,6 +1277,32 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
| } |
| +void FullCodeGenerator::VisitSuperReference(SuperReference* expr) { |
| + Comment cnmt(masm_, "[ SuperReference "); |
| + |
| + Label super_lookup_failure; |
| + __ 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()); |
| + __ j(equal, &super_lookup_failure); |
|
Toon Verwaest
2014/09/15 11:57:20
What about
j(not_equal, &done)
push(Immediate(...
Dmitry Lomov (no reviews)
2014/09/15 12:31:12
Done.
|
| + __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); |
| + __ mov(eax, FieldOperand(eax, Map::kPrototypeOffset)); |
| + Label done; |
| + __ jmp(&done); |
| + __ bind(&super_lookup_failure); |
| + __ push(Immediate(isolate()->factory()->empty_string())); |
|
arv (Not doing code reviews)
2014/09/15 15:22:57
Can we do a better error message than an empty str
|
| + __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| + __ bind(&done); |
| + context()->Plug(eax); |
| +} |
| + |
| + |
| void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
| TypeofState typeof_state, |
| Label* slow) { |
| @@ -2195,6 +2221,7 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
| __ mov(context_register(), |
| Operand(ebp, StandardFrameConstants::kContextOffset)); |
| + |
| __ bind(&allocated); |
| __ mov(ebx, map); |
| __ pop(ecx); |
| @@ -2219,6 +2246,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(), |
| @@ -2232,6 +2270,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| SetSourcePosition(prop->position()); |
| + |
| Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); |
| if (FLAG_vector_ics) { |
| __ mov(VectorLoadConvention::SlotRegister(), |
| @@ -2561,6 +2600,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 +2645,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); |
| } |