From 94506cc3c295dc8a47d55afa9f249b273bd5d7f1 Mon Sep 17 00:00:00 2001 From: "paul.lind" Date: Wed, 1 Apr 2015 11:18:34 -0700 Subject: [PATCH] MIPS: Fix stack claim and store to slot for large sizes. Could not encode the large slot number in opcode MiscField. TEST=mozilla/js/tests/js1_5/Regress/regress-396684.js BUG= Review URL: https://codereview.chromium.org/1043393002 Cr-Commit-Position: refs/heads/master@{#27574} --- src/compiler/mips/code-generator-mips.cc | 6 ++---- src/compiler/mips/instruction-selector-mips.cc | 7 ++++--- src/compiler/mips64/code-generator-mips64.cc | 6 ++---- src/compiler/mips64/instruction-selector-mips64.cc | 7 ++++--- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc index f9068644bb..b23734a191 100644 --- a/src/compiler/mips/code-generator-mips.cc +++ b/src/compiler/mips/code-generator-mips.cc @@ -721,13 +721,11 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { __ Push(i.InputRegister(0)); break; case kMipsStackClaim: { - int words = MiscField::decode(instr->opcode()); - __ Subu(sp, sp, Operand(words << kPointerSizeLog2)); + __ Subu(sp, sp, Operand(i.InputInt32(0))); break; } case kMipsStoreToStackSlot: { - int slot = MiscField::decode(instr->opcode()); - __ sw(i.InputRegister(0), MemOperand(sp, slot << kPointerSizeLog2)); + __ sw(i.InputRegister(0), MemOperand(sp, i.InputInt32(1))); break; } case kMipsStoreWriteBarrier: { diff --git a/src/compiler/mips/instruction-selector-mips.cc b/src/compiler/mips/instruction-selector-mips.cc index 98ed5ae450..149d4bc7a7 100644 --- a/src/compiler/mips/instruction-selector-mips.cc +++ b/src/compiler/mips/instruction-selector-mips.cc @@ -505,13 +505,14 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { // Possibly align stack here for functions. int push_count = buffer.pushed_nodes.size(); if (push_count > 0) { - Emit(kMipsStackClaim | MiscField::encode(push_count), g.NoOutput()); + Emit(kMipsStackClaim, g.NoOutput(), + g.TempImmediate(push_count << kPointerSizeLog2)); } int slot = buffer.pushed_nodes.size() - 1; for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); ++i) { - Emit(kMipsStoreToStackSlot | MiscField::encode(slot), g.NoOutput(), - g.UseRegister(*i)); + Emit(kMipsStoreToStackSlot, g.NoOutput(), g.UseRegister(*i), + g.TempImmediate(slot << kPointerSizeLog2)); slot--; } diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc index adf890679d..3edf6e36be 100644 --- a/src/compiler/mips64/code-generator-mips64.cc +++ b/src/compiler/mips64/code-generator-mips64.cc @@ -789,13 +789,11 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { __ Push(i.InputRegister(0)); break; case kMips64StackClaim: { - int words = MiscField::decode(instr->opcode()); - __ Dsubu(sp, sp, Operand(words << kPointerSizeLog2)); + __ Dsubu(sp, sp, Operand(i.InputInt32(0))); break; } case kMips64StoreToStackSlot: { - int slot = MiscField::decode(instr->opcode()); - __ sd(i.InputRegister(0), MemOperand(sp, slot << kPointerSizeLog2)); + __ sd(i.InputRegister(0), MemOperand(sp, i.InputInt32(1))); break; } case kMips64StoreWriteBarrier: { diff --git a/src/compiler/mips64/instruction-selector-mips64.cc b/src/compiler/mips64/instruction-selector-mips64.cc index 5f3f503c7a..379ada8a3f 100644 --- a/src/compiler/mips64/instruction-selector-mips64.cc +++ b/src/compiler/mips64/instruction-selector-mips64.cc @@ -654,13 +654,14 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { int push_count = buffer.pushed_nodes.size(); if (push_count > 0) { - Emit(kMips64StackClaim | MiscField::encode(push_count), g.NoOutput()); + Emit(kMips64StackClaim, g.NoOutput(), + g.TempImmediate(push_count << kPointerSizeLog2)); } int slot = buffer.pushed_nodes.size() - 1; for (auto i = buffer.pushed_nodes.rbegin(); i != buffer.pushed_nodes.rend(); ++i) { - Emit(kMips64StoreToStackSlot | MiscField::encode(slot), g.NoOutput(), - g.UseRegister(*i)); + Emit(kMips64StoreToStackSlot, g.NoOutput(), g.UseRegister(*i), + g.TempImmediate(slot << kPointerSizeLog2)); slot--; }