| Index: src/arm/lithium-codegen-arm.cc
|
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
|
| index 47376d113c1a98f02f8c6287a1f8e5e709d11db0..b8478bcf11586ed73179255141c0d134b3ba7a57 100644
|
| --- a/src/arm/lithium-codegen-arm.cc
|
| +++ b/src/arm/lithium-codegen-arm.cc
|
| @@ -154,9 +154,6 @@ bool LCodeGen::GeneratePrologue() {
|
| info_->is_classic_mode() &&
|
| !info_->is_native()) {
|
| Label ok;
|
| - __ cmp(r5, Operand::Zero());
|
| - __ b(eq, &ok);
|
| -
|
| int receiver_offset = info_->scope()->num_parameters() * kPointerSize;
|
| __ ldr(r2, MemOperand(sp, receiver_offset));
|
| __ CompareRoot(r2, Heap::kUndefinedValueRootIndex);
|
| @@ -723,7 +720,6 @@ void LCodeGen::CallCodeGeneric(Handle<Code> code,
|
| LInstruction* instr,
|
| SafepointMode safepoint_mode,
|
| TargetAddressStorageMode storage_mode) {
|
| - EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
|
| ASSERT(instr != NULL);
|
| // Block literal pool emission to ensure nop indicating no inlined smi code
|
| // is in the correct position.
|
| @@ -3508,8 +3504,7 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
|
| __ bind(&global_object);
|
| __ ldr(receiver, FieldMemOperand(function, JSFunction::kContextOffset));
|
| __ ldr(receiver,
|
| - ContextOperand(receiver,
|
| - Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
|
| + ContextOperand(receiver, Context::GLOBAL_OBJECT_INDEX));
|
| __ ldr(receiver,
|
| FieldMemOperand(receiver, GlobalObject::kGlobalReceiverOffset));
|
|
|
| @@ -3568,8 +3563,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
|
| // The number of arguments is stored in receiver which is r0, as expected
|
| // by InvokeFunction.
|
| ParameterCount actual(receiver);
|
| - __ InvokeFunction(function, actual, CALL_FUNCTION,
|
| - safepoint_generator, CALL_AS_FUNCTION);
|
| + __ InvokeFunction(function, actual, CALL_FUNCTION, safepoint_generator);
|
| }
|
|
|
|
|
| @@ -3644,7 +3638,6 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| int formal_parameter_count,
|
| int arity,
|
| LInstruction* instr,
|
| - CallKind call_kind,
|
| R1State r1_state) {
|
| bool dont_adapt_arguments =
|
| formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
|
| @@ -3668,7 +3661,6 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| }
|
|
|
| // Invoke function.
|
| - __ SetCallKind(r5, call_kind);
|
| __ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
|
| __ Call(ip);
|
|
|
| @@ -3678,23 +3670,11 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
| SafepointGenerator generator(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) {
|
| - ASSERT(ToRegister(instr->result()).is(r0));
|
| - CallKnownFunction(instr->hydrogen()->function(),
|
| - instr->hydrogen()->formal_parameter_count(),
|
| - instr->arity(),
|
| - instr,
|
| - CALL_AS_FUNCTION,
|
| - R1_UNINITIALIZED);
|
| -}
|
| -
|
| -
|
| void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) {
|
| ASSERT(instr->context() != NULL);
|
| ASSERT(ToRegister(instr->context()).is(cp));
|
| @@ -3968,38 +3948,58 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
|
| LPointerMap* pointers = instr->pointer_map();
|
| SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
|
| ParameterCount count(instr->arity());
|
| - __ InvokeFunction(r1, count, CALL_FUNCTION, generator, CALL_AS_FUNCTION);
|
| + __ InvokeFunction(r1, count, CALL_FUNCTION, generator);
|
| } else {
|
| CallKnownFunction(known_function,
|
| instr->hydrogen()->formal_parameter_count(),
|
| instr->arity(),
|
| instr,
|
| - CALL_AS_FUNCTION,
|
| R1_CONTAINS_TARGET);
|
| }
|
| }
|
|
|
|
|
| -void LCodeGen::DoCallKeyed(LCallKeyed* instr) {
|
| - ASSERT(ToRegister(instr->context()).is(cp));
|
| +void LCodeGen::DoCallWithDescriptor(LCallWithDescriptor* instr) {
|
| ASSERT(ToRegister(instr->result()).is(r0));
|
|
|
| - int arity = instr->arity();
|
| - Handle<Code> ic =
|
| - isolate()->stub_cache()->ComputeKeyedCallInitialize(arity);
|
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
|
| + 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));
|
| + PlatformCallInterfaceDescriptor* call_descriptor =
|
| + instr->descriptor()->platform_specific_descriptor();
|
| + __ Call(code, RelocInfo::CODE_TARGET, TypeFeedbackId::None(), al,
|
| + call_descriptor->storage_mode());
|
| + } else {
|
| + ASSERT(instr->target()->IsRegister());
|
| + Register target = ToRegister(instr->target());
|
| + generator.BeforeCall(__ CallSize(target));
|
| + __ add(target, target, Operand(Code::kHeaderSize - kHeapObjectTag));
|
| + __ Call(target);
|
| + }
|
| + generator.AfterCall();
|
| }
|
|
|
|
|
| -void LCodeGen::DoCallNamed(LCallNamed* instr) {
|
| - ASSERT(ToRegister(instr->context()).is(cp));
|
| +void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
|
| + ASSERT(ToRegister(instr->function()).is(r1));
|
| ASSERT(ToRegister(instr->result()).is(r0));
|
|
|
| - int arity = instr->arity();
|
| - Handle<Code> ic =
|
| - isolate()->stub_cache()->ComputeCallInitialize(arity, NOT_CONTEXTUAL);
|
| - __ mov(r2, Operand(instr->name()));
|
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
|
| + if (instr->hydrogen()->pass_argument_count()) {
|
| + __ mov(r0, Operand(instr->arity()));
|
| + }
|
| +
|
| + // Change context.
|
| + __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
|
| +
|
| + // Load the code entry address
|
| + __ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
|
| + __ Call(ip);
|
| +
|
| + RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
|
| }
|
|
|
|
|
| @@ -4019,29 +4019,6 @@ void LCodeGen::DoCallFunction(LCallFunction* instr) {
|
| }
|
|
|
|
|
| -void LCodeGen::DoCallGlobal(LCallGlobal* instr) {
|
| - ASSERT(ToRegister(instr->context()).is(cp));
|
| - ASSERT(ToRegister(instr->result()).is(r0));
|
| -
|
| - int arity = instr->arity();
|
| - Handle<Code> ic =
|
| - isolate()->stub_cache()->ComputeCallInitialize(arity, CONTEXTUAL);
|
| - __ mov(r2, Operand(instr->name()));
|
| - CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS);
|
| -}
|
| -
|
| -
|
| -void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
|
| - ASSERT(ToRegister(instr->result()).is(r0));
|
| - CallKnownFunction(instr->hydrogen()->target(),
|
| - instr->hydrogen()->formal_parameter_count(),
|
| - instr->arity(),
|
| - instr,
|
| - CALL_AS_FUNCTION,
|
| - R1_UNINITIALIZED);
|
| -}
|
| -
|
| -
|
| void LCodeGen::DoCallNew(LCallNew* instr) {
|
| ASSERT(ToRegister(instr->context()).is(cp));
|
| ASSERT(ToRegister(instr->constructor()).is(r1));
|
| @@ -5184,7 +5161,7 @@ void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) {
|
| PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters);
|
| __ push(object);
|
| __ mov(cp, Operand::Zero());
|
| - __ CallRuntimeSaveDoubles(Runtime::kMigrateInstance);
|
| + __ CallRuntimeSaveDoubles(Runtime::kTryMigrateInstance);
|
| RecordSafepointWithRegisters(
|
| instr->pointer_map(), 1, Safepoint::kNoLazyDeopt);
|
| __ StoreToSafepointRegisterSlot(r0, scratch0());
|
| @@ -5601,26 +5578,27 @@ void LCodeGen::EmitIsConstructCall(Register temp1, Register temp2) {
|
|
|
|
|
| void LCodeGen::EnsureSpaceForLazyDeopt(int space_needed) {
|
| - if (info()->IsStub()) return;
|
| - // Ensure that we have enough space after the previous lazy-bailout
|
| - // instruction for patching the code here.
|
| - int current_pc = masm()->pc_offset();
|
| - if (current_pc < last_lazy_deopt_pc_ + space_needed) {
|
| - // Block literal pool emission for duration of padding.
|
| - Assembler::BlockConstPoolScope block_const_pool(masm());
|
| - int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
|
| - ASSERT_EQ(0, padding_size % Assembler::kInstrSize);
|
| - while (padding_size > 0) {
|
| - __ nop();
|
| - padding_size -= Assembler::kInstrSize;
|
| + if (!info()->IsStub()) {
|
| + // Ensure that we have enough space after the previous lazy-bailout
|
| + // instruction for patching the code here.
|
| + int current_pc = masm()->pc_offset();
|
| + if (current_pc < last_lazy_deopt_pc_ + space_needed) {
|
| + // Block literal pool emission for duration of padding.
|
| + Assembler::BlockConstPoolScope block_const_pool(masm());
|
| + int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
|
| + ASSERT_EQ(0, padding_size % Assembler::kInstrSize);
|
| + while (padding_size > 0) {
|
| + __ nop();
|
| + padding_size -= Assembler::kInstrSize;
|
| + }
|
| }
|
| }
|
| + last_lazy_deopt_pc_ = masm()->pc_offset();
|
| }
|
|
|
|
|
| void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
|
| EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
|
| - last_lazy_deopt_pc_ = masm()->pc_offset();
|
| ASSERT(instr->HasEnvironment());
|
| LEnvironment* env = instr->environment();
|
| RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
|
| @@ -5695,7 +5673,6 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) {
|
| RelocInfo::CODE_TARGET,
|
| instr);
|
| EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
|
| - last_lazy_deopt_pc_ = masm()->pc_offset();
|
| __ bind(&done);
|
| RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
|
| safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
|
| @@ -5708,7 +5685,6 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) {
|
| __ cmp(sp, Operand(ip));
|
| __ b(lo, deferred_stack_check->entry());
|
| EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
|
| - last_lazy_deopt_pc_ = masm()->pc_offset();
|
| __ bind(instr->done_label());
|
| deferred_stack_check->SetExit(instr->done_label());
|
| RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
|
|
|