Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 86118ebf6bdbeeb185b7aec0a762389dcc9da356..653e091e806fa3ed8e8c82297fbaf1a9f458a242 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -3835,14 +3835,55 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function, |
} |
-void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) { |
+void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) { |
ASSERT(ToRegister(instr->result()).is(eax)); |
- CallKnownFunction(instr->hydrogen()->function(), |
- instr->hydrogen()->formal_parameter_count(), |
- instr->arity(), |
- instr, |
- CALL_AS_METHOD, |
- EDI_UNINITIALIZED); |
+ |
+ LPointerMap* pointers = instr->pointer_map(); |
+ SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
+ |
+ if (instr->target()->IsConstantOperand()) { |
+ LConstantOperand* target = LConstantOperand::cast(instr->target()); |
+ Handle<Code> code = Handle<Code>::cast(ToHandle(target)); |
+ generator.BeforeCall(__ CallSize(code, RelocInfo::CODE_TARGET)); |
+ __ call(code, RelocInfo::CODE_TARGET); |
+ } else { |
+ ASSERT(instr->target()->IsRegister()); |
+ Register target = ToRegister(instr->target()); |
+ generator.BeforeCall(__ CallSize(Operand(target))); |
+ __ add(target, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
+ __ call(target); |
+ } |
+ generator.AfterCall(); |
+} |
+ |
+ |
+void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { |
+ ASSERT(ToRegister(instr->function()).is(edi)); |
+ ASSERT(ToRegister(instr->call_kind()).is(ecx)); |
+ ASSERT(ToRegister(instr->result()).is(eax)); |
+ |
+ if (instr->hydrogen()->pass_argument_count()) { |
+ __ mov(eax, instr->arity()); |
+ } |
+ |
+ // Change context. |
+ __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
+ |
+ bool is_self_call = false; |
+ if (instr->hydrogen()->function()->IsConstant()) { |
+ HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); |
+ Handle<JSFunction> jsfun = |
+ Handle<JSFunction>::cast(fun_const->handle(isolate())); |
+ is_self_call = jsfun.is_identical_to(info()->closure()); |
+ } |
+ |
+ if (is_self_call) { |
+ __ CallSelf(); |
+ } else { |
+ __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset)); |
+ } |
+ |
+ RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); |
} |
@@ -4214,31 +4255,6 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { |
} |
-void LCodeGen::DoCallKeyed(LCallKeyed* instr) { |
- ASSERT(ToRegister(instr->context()).is(esi)); |
- ASSERT(ToRegister(instr->key()).is(ecx)); |
- ASSERT(ToRegister(instr->result()).is(eax)); |
- |
- int arity = instr->arity(); |
- Handle<Code> ic = |
- isolate()->stub_cache()->ComputeKeyedCallInitialize(arity); |
- CallCode(ic, RelocInfo::CODE_TARGET, instr); |
-} |
- |
- |
-void LCodeGen::DoCallNamed(LCallNamed* instr) { |
- ASSERT(ToRegister(instr->context()).is(esi)); |
- ASSERT(ToRegister(instr->result()).is(eax)); |
- |
- int arity = instr->arity(); |
- RelocInfo::Mode mode = RelocInfo::CODE_TARGET; |
- Handle<Code> ic = |
- isolate()->stub_cache()->ComputeCallInitialize(arity, mode); |
- __ mov(ecx, instr->name()); |
- CallCode(ic, mode, instr); |
-} |
- |
- |
void LCodeGen::DoCallFunction(LCallFunction* instr) { |
ASSERT(ToRegister(instr->context()).is(esi)); |
ASSERT(ToRegister(instr->function()).is(edi)); |
@@ -4268,17 +4284,6 @@ void LCodeGen::DoCallGlobal(LCallGlobal* instr) { |
} |
-void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) { |
- ASSERT(ToRegister(instr->result()).is(eax)); |
- CallKnownFunction(instr->hydrogen()->target(), |
- instr->hydrogen()->formal_parameter_count(), |
- instr->arity(), |
- instr, |
- CALL_AS_FUNCTION, |
- EDI_UNINITIALIZED); |
-} |
- |
- |
void LCodeGen::DoCallNew(LCallNew* instr) { |
ASSERT(ToRegister(instr->context()).is(esi)); |
ASSERT(ToRegister(instr->constructor()).is(edi)); |