From 632e79bfe7b34d21825352ffb7457b2de30cc6a7 Mon Sep 17 00:00:00 2001 From: "whesse@chromium.org" Date: Mon, 7 Mar 2011 11:26:43 +0000 Subject: [PATCH] X64 Crankshaft: Revert r7071 and fix DoStoreContextSlot in a different way. Review URL: http://codereview.chromium.org/6627048 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7073 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x64/lithium-codegen-x64.cc | 3 ++- src/x64/lithium-x64.cc | 5 ++++- src/x64/lithium-x64.h | 5 +++-- src/x64/macro-assembler-x64.cc | 8 +------- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 5350017..ffb4632 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -1993,7 +1993,8 @@ void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { __ movq(ContextOperand(context, instr->slot_index()), value); if (instr->needs_write_barrier()) { int offset = Context::SlotOffset(instr->slot_index()); - __ RecordWrite(context, offset, value, kScratchRegister); + Register scratch = ToRegister(instr->TempAt(0)); + __ RecordWrite(context, offset, value, scratch); } } diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index cab0bd4..f8f0a3f 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -1728,14 +1728,17 @@ LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { LOperand* context; LOperand* value; + LOperand* temp; if (instr->NeedsWriteBarrier()) { context = UseTempRegister(instr->context()); value = UseTempRegister(instr->value()); + temp = TempRegister(); } else { context = UseRegister(instr->context()); value = UseRegister(instr->value()); + temp = NULL; } - return new LStoreContextSlot(context, value); + return new LStoreContextSlot(context, value, temp); } diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h index bdc5b2b..4b10f81 100644 --- a/src/x64/lithium-x64.h +++ b/src/x64/lithium-x64.h @@ -1258,11 +1258,12 @@ class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> { }; -class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> { +class LStoreContextSlot: public LTemplateInstruction<0, 2, 1> { public: - LStoreContextSlot(LOperand* context, LOperand* value) { + LStoreContextSlot(LOperand* context, LOperand* value, LOperand* temp) { inputs_[0] = context; inputs_[1] = value; + temps_[0] = temp; } DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot") diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc index 28e039c..b468e82 100644 --- a/src/x64/macro-assembler-x64.cc +++ b/src/x64/macro-assembler-x64.cc @@ -95,13 +95,7 @@ void MacroAssembler::RecordWriteHelper(Register object, if (FLAG_debug_code) { // Check that the object is not in new space. NearLabel not_in_new_space; - if (addr.is(kScratchRegister)) { - push(kScratchRegister); - InNewSpace(object, scratch, not_equal, ¬_in_new_space); - pop(kScratchRegister); - } else { - InNewSpace(object, scratch, not_equal, ¬_in_new_space); - } + InNewSpace(object, scratch, not_equal, ¬_in_new_space); Abort("new-space object passed to RecordWriteHelper"); bind(¬_in_new_space); } -- 2.7.4