From 721d8d5b573501ab9ed6c08f75b6b207859436e5 Mon Sep 17 00:00:00 2001 From: "whesse@chromium.org" Date: Thu, 3 Mar 2011 15:36:13 +0000 Subject: [PATCH] X64 Crankshaft: Fix and enable StoreContextSlot in lithium codegen on x64. Review URL: http://codereview.chromium.org/6614017 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7048 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x64/lithium-codegen-x64.cc | 11 ++++++----- src/x64/lithium-x64.cc | 17 +++++++---------- src/x64/lithium-x64.h | 18 ++++++++---------- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 1007784..c5a877e 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -1966,19 +1966,20 @@ void LCodeGen::DoStoreGlobal(LStoreGlobal* instr) { void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { - Register context = ToRegister(instr->context()); Register result = ToRegister(instr->result()); - __ movq(result, ContextOperand(context, instr->slot_index())); + __ movq(result, ContextOperand(rsi, instr->slot_index())); } void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { - Register context = ToRegister(instr->context()); Register value = ToRegister(instr->value()); - __ movq(ContextOperand(context, instr->slot_index()), value); + __ movq(ContextOperand(rsi, instr->slot_index()), value); if (instr->needs_write_barrier()) { int offset = Context::SlotOffset(instr->slot_index()); - __ RecordWrite(context, offset, value, kScratchRegister); + Register scratch_1 = ToRegister(instr->TempAt(0)); + Register scratch_2 = ToRegister(instr->TempAt(1)); + __ movq(scratch_1, rsi); + __ RecordWrite(scratch_1, offset, value, scratch_2); } } diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 7c26468..052a5b7 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -291,15 +291,13 @@ void LUnaryMathOperation::PrintDataTo(StringStream* stream) { void LLoadContextSlot::PrintDataTo(StringStream* stream) { - InputAt(0)->PrintTo(stream); stream->Add("[%d]", slot_index()); } void LStoreContextSlot::PrintDataTo(StringStream* stream) { - InputAt(0)->PrintTo(stream); stream->Add("[%d] <- ", slot_index()); - InputAt(1)->PrintTo(stream); + InputAt(0)->PrintTo(stream); } @@ -1720,23 +1718,22 @@ LInstruction* LChunkBuilder::DoStoreGlobal(HStoreGlobal* instr) { LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { - LOperand* context = UseRegisterAtStart(instr->value()); - return DefineAsRegister(new LLoadContextSlot(context)); + return DefineAsRegister(new LLoadContextSlot()); } LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { - Abort("Unimplemented: DoStoreContextSlot"); // Temporarily disabled (whesse). - LOperand* context; LOperand* value; + LOperand* temp_1 = NULL; + LOperand* temp_2 = NULL; if (instr->NeedsWriteBarrier()) { - context = UseTempRegister(instr->context()); value = UseTempRegister(instr->value()); + temp_1 = TempRegister(); + temp_2 = TempRegister(); } else { - context = UseRegister(instr->context()); value = UseRegister(instr->value()); } - return new LStoreContextSlot(context, value); + return new LStoreContextSlot(value, temp_1, temp_2); } diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h index bdc5b2b..0cc329f 100644 --- a/src/x64/lithium-x64.h +++ b/src/x64/lithium-x64.h @@ -1242,34 +1242,32 @@ class LStoreGlobal: public LTemplateInstruction<0, 1, 1> { }; -class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> { +class LLoadContextSlot: public LTemplateInstruction<1, 0, 0> { public: - explicit LLoadContextSlot(LOperand* context) { - inputs_[0] = context; + explicit LLoadContextSlot() { } DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) - LOperand* context() { return InputAt(0); } int slot_index() { return hydrogen()->slot_index(); } virtual void PrintDataTo(StringStream* stream); }; -class LStoreContextSlot: public LTemplateInstruction<0, 2, 0> { +class LStoreContextSlot: public LTemplateInstruction<0, 1, 2> { public: - LStoreContextSlot(LOperand* context, LOperand* value) { - inputs_[0] = context; - inputs_[1] = value; + LStoreContextSlot(LOperand* value, LOperand* temp_1, LOperand* temp_2) { + inputs_[0] = value; + temps_[0] = temp_1; + temps_[1] = temp_2; } DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot") DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot) - LOperand* context() { return InputAt(0); } - LOperand* value() { return InputAt(1); } + LOperand* value() { return InputAt(0); } int slot_index() { return hydrogen()->slot_index(); } int needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); } -- 2.7.4