| Index: src/ia32/lithium-codegen-ia32.cc
|
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
|
| index 54624e7b19513bbdf57ddeca4e8b36987ae3fa91..0a6723170ca049f9e6176b301d9da7f984c2bac4 100644
|
| --- a/src/ia32/lithium-codegen-ia32.cc
|
| +++ b/src/ia32/lithium-codegen-ia32.cc
|
| @@ -182,9 +182,6 @@ bool LCodeGen::GeneratePrologue() {
|
| info_->is_classic_mode() &&
|
| !info_->is_native()) {
|
| Label ok;
|
| - __ test(ecx, ecx);
|
| - __ j(zero, &ok, Label::kNear);
|
| -
|
| // +1 for return address.
|
| int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize;
|
| __ mov(ecx, Operand(esp, receiver_offset));
|
| @@ -3726,8 +3723,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
|
| SafepointGenerator safepoint_generator(
|
| this, pointers, Safepoint::kLazyDeopt);
|
| ParameterCount actual(eax);
|
| - __ InvokeFunction(function, actual, CALL_FUNCTION,
|
| - safepoint_generator, CALL_AS_FUNCTION);
|
| + __ InvokeFunction(function, actual, CALL_FUNCTION, safepoint_generator);
|
| }
|
|
|
|
|
| @@ -3800,7 +3796,6 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| int formal_parameter_count,
|
| int arity,
|
| LInstruction* instr,
|
| - CallKind call_kind,
|
| EDIState edi_state) {
|
| bool dont_adapt_arguments =
|
| formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
|
| @@ -3822,7 +3817,6 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| }
|
|
|
| // Invoke function directly.
|
| - __ SetCallKind(ecx, call_kind);
|
| if (function.is_identical_to(info()->closure())) {
|
| __ CallSelf();
|
| } else {
|
| @@ -3836,20 +3830,59 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| this, pointers, Safepoint::kLazyDeopt);
|
| ParameterCount count(arity);
|
| ParameterCount expected(formal_parameter_count);
|
| - __ InvokeFunction(
|
| - function, expected, count, CALL_FUNCTION, generator, call_kind);
|
| + __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
|
| }
|
| }
|
|
|
|
|
| -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_FUNCTION,
|
| - 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->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);
|
| }
|
|
|
|
|
| @@ -4209,42 +4242,17 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
|
| SafepointGenerator generator(
|
| this, pointers, Safepoint::kLazyDeopt);
|
| ParameterCount count(instr->arity());
|
| - __ InvokeFunction(edi, count, CALL_FUNCTION, generator, CALL_AS_FUNCTION);
|
| + __ InvokeFunction(edi, count, CALL_FUNCTION, generator);
|
| } else {
|
| CallKnownFunction(known_function,
|
| instr->hydrogen()->formal_parameter_count(),
|
| instr->arity(),
|
| instr,
|
| - CALL_AS_FUNCTION,
|
| EDI_CONTAINS_TARGET);
|
| }
|
| }
|
|
|
|
|
| -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();
|
| - Handle<Code> ic =
|
| - isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL);
|
| - __ mov(ecx, instr->name());
|
| - CallCode(ic, RelocInfo::CODE_TARGET, instr);
|
| -}
|
| -
|
| -
|
| void LCodeGen::DoCallFunction(LCallFunction* instr) {
|
| ASSERT(ToRegister(instr->context()).is(esi));
|
| ASSERT(ToRegister(instr->function()).is(edi));
|
| @@ -4261,29 +4269,6 @@ void LCodeGen::DoCallFunction(LCallFunction* instr) {
|
| }
|
|
|
|
|
| -void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
|
| - ASSERT(ToRegister(instr->context()).is(esi));
|
| - ASSERT(ToRegister(instr->result()).is(eax));
|
| -
|
| - int arity = instr->arity();
|
| - Handle<Code> ic =
|
| - isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL);
|
| - __ mov(ecx, instr->name());
|
| - CallCode(ic, RelocInfo::CODE_TARGET, 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));
|
| @@ -5605,7 +5590,7 @@ void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) {
|
| PushSafepointRegistersScope scope(this);
|
| __ push(object);
|
| __ xor_(esi, esi);
|
| - __ CallRuntimeSaveDoubles(Runtime::kMigrateInstance);
|
| + __ CallRuntimeSaveDoubles(Runtime::kTryMigrateInstance);
|
| RecordSafepointWithRegisters(
|
| instr->pointer_map(), 1, Safepoint::kNoLazyDeopt);
|
|
|
|
|