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 aacaeeb6a6becee2adfab0f392d048d05fc9cb3f..5bc16e8591016df877958b973bca85b39409b674 100644 |
| --- a/src/ia32/full-codegen-ia32.cc |
| +++ b/src/ia32/full-codegen-ia32.cc |
| @@ -1278,6 +1278,28 @@ void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
| } |
| +void FullCodeGenerator::VisitSuperReference(SuperReference* expr) { |
| + Comment cnmt(masm_, "[ SuperReference "); |
| + |
| + const Register r = eax; |
| + Label super_lookup_failure; |
| + __ mov(r, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| + __ mov(r, FieldOperand(r, JSFunction::kHomeObjectOffset)); |
|
adamk
2014/08/07 20:38:04
You mentioned that you're thinking of re-implement
|
| + __ cmp(r, isolate()->factory()->undefined_value()); |
| + __ j(equal, &super_lookup_failure); |
| + __ mov(r, FieldOperand(r, HeapObject::kMapOffset)); |
| + __ mov(r, FieldOperand(r, Map::kPrototypeOffset)); |
| + Label done; |
| + __ jmp(&done); |
| + __ bind(&super_lookup_failure); |
| + __ push(Immediate(isolate()->factory()->empty_string())); |
| + __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| + __ bind(&done); |
| + context()->Plug(eax); |
| +} |
| + |
| + |
| + |
| void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
| TypeofState typeof_state, |
| Label* slow) { |
| @@ -2220,6 +2242,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| SetSourcePosition(prop->position()); |
| Literal* key = prop->key()->AsLiteral(); |
| DCHECK(!key->value()->IsSmi()); |
| + |
| __ mov(LoadIC::NameRegister(), Immediate(key->value())); |
| if (FLAG_vector_ics) { |
| __ mov(LoadIC::SlotRegister(), |
| @@ -2568,8 +2591,15 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { |
| EmitNamedPropertyLoad(callee->AsProperty()); |
| 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, call_type); |
| @@ -2592,8 +2622,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); |
| } |