From: Jacob.Bramley@arm.com Date: Mon, 21 Jul 2014 10:31:23 +0000 (+0000) Subject: ARM64: never record safepoint with doubles X-Git-Tag: upstream/4.7.83~8142 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e41b8661fd315a8f825298d82f45973d5147b71;p=platform%2Fupstream%2Fv8.git ARM64: never record safepoint with doubles R=bmeurer@chromium.org, ulan@chromium.org BUG= Review URL: https://codereview.chromium.org/400223002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22498 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc index 035ab18..6a98589 100644 --- a/src/arm64/code-stubs-arm64.cc +++ b/src/arm64/code-stubs-arm64.cc @@ -990,11 +990,7 @@ void StoreRegistersStateStub::Generate(MacroAssembler* masm) { // Restore lr with the value it had before the call to this stub (the value // which must be pushed). __ Mov(lr, saved_lr); - if (save_doubles_ == kSaveFPRegs) { - __ PushSafepointRegistersAndDoubles(); - } else { - __ PushSafepointRegisters(); - } + __ PushSafepointRegisters(); __ Ret(return_address); } @@ -1005,11 +1001,7 @@ void RestoreRegistersStateStub::Generate(MacroAssembler* masm) { Register return_address = temps.AcquireX(); // Preserve the return address (lr will be clobbered by the pop). __ Mov(return_address, lr); - if (save_doubles_ == kSaveFPRegs) { - __ PopSafepointRegistersAndDoubles(); - } else { - __ PopSafepointRegisters(); - } + __ PopSafepointRegisters(); __ Ret(return_address); } @@ -1281,18 +1273,14 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { void StoreRegistersStateStub::GenerateAheadOfTime(Isolate* isolate) { - StoreRegistersStateStub stub1(isolate, kDontSaveFPRegs); - stub1.GetCode(); - StoreRegistersStateStub stub2(isolate, kSaveFPRegs); - stub2.GetCode(); + StoreRegistersStateStub stub(isolate); + stub.GetCode(); } void RestoreRegistersStateStub::GenerateAheadOfTime(Isolate* isolate) { - RestoreRegistersStateStub stub1(isolate, kDontSaveFPRegs); - stub1.GetCode(); - RestoreRegistersStateStub stub2(isolate, kSaveFPRegs); - stub2.GetCode(); + RestoreRegistersStateStub stub(isolate); + stub.GetCode(); } diff --git a/src/arm64/code-stubs-arm64.h b/src/arm64/code-stubs-arm64.h index a21f315..8548ea52 100644 --- a/src/arm64/code-stubs-arm64.h +++ b/src/arm64/code-stubs-arm64.h @@ -56,15 +56,14 @@ class StringHelper : public AllStatic { class StoreRegistersStateStub: public PlatformCodeStub { public: - StoreRegistersStateStub(Isolate* isolate, SaveFPRegsMode with_fp) - : PlatformCodeStub(isolate), save_doubles_(with_fp) {} + explicit StoreRegistersStateStub(Isolate* isolate) + : PlatformCodeStub(isolate) {} static Register to_be_pushed_lr() { return ip0; } static void GenerateAheadOfTime(Isolate* isolate); private: Major MajorKey() const { return StoreRegistersState; } - int MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } - SaveFPRegsMode save_doubles_; + int MinorKey() const { return 0; } void Generate(MacroAssembler* masm); }; @@ -72,14 +71,13 @@ class StoreRegistersStateStub: public PlatformCodeStub { class RestoreRegistersStateStub: public PlatformCodeStub { public: - RestoreRegistersStateStub(Isolate* isolate, SaveFPRegsMode with_fp) - : PlatformCodeStub(isolate), save_doubles_(with_fp) {} + explicit RestoreRegistersStateStub(Isolate* isolate) + : PlatformCodeStub(isolate) {} static void GenerateAheadOfTime(Isolate* isolate); private: Major MajorKey() const { return RestoreRegistersState; } - int MinorKey() const { return (save_doubles_ == kSaveFPRegs) ? 1 : 0; } - SaveFPRegsMode save_doubles_; + int MinorKey() const { return 0; } void Generate(MacroAssembler* masm); }; diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc index d3db5dc..6ea4ae8 100644 --- a/src/arm64/lithium-codegen-arm64.cc +++ b/src/arm64/lithium-codegen-arm64.cc @@ -580,13 +580,6 @@ void LCodeGen::RecordSafepointWithRegisters(LPointerMap* pointers, } -void LCodeGen::RecordSafepointWithRegistersAndDoubles( - LPointerMap* pointers, int arguments, Safepoint::DeoptMode deopt_mode) { - RecordSafepoint( - pointers, Safepoint::kWithRegistersAndDoubles, arguments, deopt_mode); -} - - bool LCodeGen::GenerateCode() { LPhase phase("Z_Code generation", chunk()); ASSERT(is_unused()); @@ -1631,7 +1624,7 @@ void LCodeGen::DoDeferredAllocate(LAllocate* instr) { // contained in the register pointer map. __ Mov(ToRegister(instr->result()), Smi::FromInt(0)); - PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); + PushSafepointRegistersScope scope(this); // We're in a SafepointRegistersScope so we can use any scratch registers. Register size = x0; if (instr->size()->IsConstantOperand()) { @@ -2146,7 +2139,7 @@ void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { Register temp = ToRegister(instr->temp()); { - PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); + PushSafepointRegistersScope scope(this); __ Push(object); __ Mov(cp, 0); __ CallRuntimeSaveDoubles(Runtime::kTryMigrateInstance); @@ -3145,7 +3138,7 @@ void LCodeGen::DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr) { flags = static_cast( flags | InstanceofStub::kCallSiteInlineCheck); - PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); + PushSafepointRegistersScope scope(this); LoadContextFromDeferred(instr->context()); // Prepare InstanceofStub arguments. @@ -3794,7 +3787,7 @@ void LCodeGen::DoDeferredMathAbsTagged(LMathAbsTagged* instr, __ Bind(&result_ok); } - { PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); + { PushSafepointRegistersScope scope(this); CallRuntimeFromDeferred(Runtime::kAllocateHeapNumber, 0, instr, instr->context()); __ StoreToSafepointRegisterSlot(x0, result); @@ -4518,7 +4511,7 @@ void LCodeGen::DoDeferredNumberTagD(LNumberTagD* instr) { Register result = ToRegister(instr->result()); __ Mov(result, 0); - PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); + PushSafepointRegistersScope scope(this); // NumberTagU and NumberTagD use the context from the frame, rather than // the environment's HContext or HInlinedContext value. // They only call Runtime::kAllocateHeapNumber. @@ -4583,7 +4576,7 @@ void LCodeGen::DoDeferredNumberTagU(LInstruction* instr, __ Mov(dst, 0); { // Preserve the value of all registers. - PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); + PushSafepointRegistersScope scope(this); // NumberTagU and NumberTagD use the context from the frame, rather than // the environment's HContext or HInlinedContext value. @@ -5026,7 +5019,7 @@ void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) { - PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); + PushSafepointRegistersScope scope(this); LoadContextFromDeferred(instr->context()); __ CallRuntimeSaveDoubles(Runtime::kStackGuard); RecordSafepointWithLazyDeopt( @@ -5481,7 +5474,7 @@ void LCodeGen::DoDeferredStringCharCodeAt(LStringCharCodeAt* instr) { // contained in the register pointer map. __ Mov(result, 0); - PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); + PushSafepointRegistersScope scope(this); __ Push(string); // Push the index as a smi. This is safe because of the checks in // DoStringCharCodeAt above. @@ -5534,7 +5527,7 @@ void LCodeGen::DoDeferredStringCharFromCode(LStringCharFromCode* instr) { // contained in the register pointer map. __ Mov(result, 0); - PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); + PushSafepointRegistersScope scope(this); __ SmiTagAndPush(char_code); CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context()); __ StoreToSafepointRegisterSlot(x0, result); @@ -5763,13 +5756,12 @@ void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { } ASSERT(object.is(x0)); ASSERT(ToRegister(instr->context()).is(cp)); - PushSafepointRegistersScope scope( - this, Safepoint::kWithRegistersAndDoubles); + PushSafepointRegistersScope scope(this); __ Mov(x1, Operand(to_map)); bool is_js_array = from_map->instance_type() == JS_ARRAY_TYPE; TransitionElementsKindStub stub(isolate(), from_kind, to_kind, is_js_array); __ CallStub(&stub); - RecordSafepointWithRegistersAndDoubles( + RecordSafepointWithRegisters( instr->pointer_map(), 0, Safepoint::kLazyDeopt); } __ Bind(¬_applicable); @@ -5954,7 +5946,7 @@ void LCodeGen::DoDeferredLoadMutableDouble(LLoadFieldByIndex* instr, Register result, Register object, Register index) { - PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); + PushSafepointRegistersScope scope(this); __ Push(object); __ Push(index); __ Mov(cp, 0); diff --git a/src/arm64/lithium-codegen-arm64.h b/src/arm64/lithium-codegen-arm64.h index 43cf13f..dca4334 100644 --- a/src/arm64/lithium-codegen-arm64.h +++ b/src/arm64/lithium-codegen-arm64.h @@ -348,9 +348,6 @@ class LCodeGen: public LCodeGenBase { void RecordSafepointWithRegisters(LPointerMap* pointers, int arguments, Safepoint::DeoptMode mode); - void RecordSafepointWithRegistersAndDoubles(LPointerMap* pointers, - int arguments, - Safepoint::DeoptMode mode); void RecordSafepointWithLazyDeopt(LInstruction* instr, SafepointMode safepoint_mode); @@ -388,12 +385,11 @@ class LCodeGen: public LCodeGenBase { class PushSafepointRegistersScope BASE_EMBEDDED { public: - PushSafepointRegistersScope(LCodeGen* codegen, - Safepoint::Kind kind) + explicit PushSafepointRegistersScope(LCodeGen* codegen) : codegen_(codegen) { ASSERT(codegen_->info()->is_calling()); ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); - codegen_->expected_safepoint_kind_ = kind; + codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; UseScratchRegisterScope temps(codegen_->masm_); // Preserve the value of lr which must be saved on the stack (the call to @@ -401,39 +397,14 @@ class LCodeGen: public LCodeGenBase { Register to_be_pushed_lr = temps.UnsafeAcquire(StoreRegistersStateStub::to_be_pushed_lr()); codegen_->masm_->Mov(to_be_pushed_lr, lr); - switch (codegen_->expected_safepoint_kind_) { - case Safepoint::kWithRegisters: { - StoreRegistersStateStub stub(codegen_->isolate(), kDontSaveFPRegs); - codegen_->masm_->CallStub(&stub); - break; - } - case Safepoint::kWithRegistersAndDoubles: { - StoreRegistersStateStub stub(codegen_->isolate(), kSaveFPRegs); - codegen_->masm_->CallStub(&stub); - break; - } - default: - UNREACHABLE(); - } + StoreRegistersStateStub stub(codegen_->isolate()); + codegen_->masm_->CallStub(&stub); } ~PushSafepointRegistersScope() { - Safepoint::Kind kind = codegen_->expected_safepoint_kind_; - ASSERT((kind & Safepoint::kWithRegisters) != 0); - switch (kind) { - case Safepoint::kWithRegisters: { - RestoreRegistersStateStub stub(codegen_->isolate(), kDontSaveFPRegs); - codegen_->masm_->CallStub(&stub); - break; - } - case Safepoint::kWithRegistersAndDoubles: { - RestoreRegistersStateStub stub(codegen_->isolate(), kSaveFPRegs); - codegen_->masm_->CallStub(&stub); - break; - } - default: - UNREACHABLE(); - } + ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); + RestoreRegistersStateStub stub(codegen_->isolate()); + codegen_->masm_->CallStub(&stub); codegen_->expected_safepoint_kind_ = Safepoint::kSimple; }