Reviewers: Yang,
Description:
MIPS: Minor cleanup change to arguments slots constants.
This is the bleeding_edge port of our crankshaft commit 41cab38.
BUG=
TEST=
Please review this at http://codereview.chromium.org/7834017/
Affected files:
M src/mips/code-stubs-mips.cc
M src/mips/constants-mips.h
M src/mips/frames-mips.h
M src/mips/macro-assembler-mips.h
M src/mips/macro-assembler-mips.cc
M src/mips/simulator-mips.cc
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index
7ca78f6ad72ab5abd65825bb0e1a8a2e5645bb90..cded21fd42df209991dd35cce0b0e75164cb173f
100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -3538,7 +3538,7 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
const int kNumInstructionsToJump = 6;
masm->Addu(ra, ra, kNumInstructionsToJump * kPointerSize);
masm->sw(ra, MemOperand(sp)); // This spot was reserved in
EnterExitFrame.
- masm->Subu(sp, sp, StandardFrameConstants::kCArgsSlotsSize);
+ masm->Subu(sp, sp, kCArgsSlotsSize);
// Stack is still aligned.
// Call the C routine.
@@ -3551,7 +3551,7 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
}
// Restore stack (remove arg slots).
- __ Addu(sp, sp, StandardFrameConstants::kCArgsSlotsSize);
+ __ Addu(sp, sp, kCArgsSlotsSize);
if (always_allocate) {
// It's okay to clobber a2 and a3 here. v0 & v1 contain result.
@@ -3707,8 +3707,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm,
bool is_construct) {
offset_to_argv += kNumCalleeSavedFPU * kDoubleSize;
}
- __ lw(s0, MemOperand(sp, offset_to_argv +
- StandardFrameConstants::kCArgsSlotsSize));
+ __ lw(s0, MemOperand(sp, offset_to_argv + kCArgsSlotsSize));
// We build an EntryFrame.
__ li(t3, Operand(-1)); // Push a bad frame pointer to fail if it is
used.
Index: src/mips/constants-mips.h
diff --git a/src/mips/constants-mips.h b/src/mips/constants-mips.h
index
6bf2570ebd6d8d7b283fb1a8e06b65f640d6ec78..ede9688a682fba32d74d7b25166d0d9106c1873e
100644
--- a/src/mips/constants-mips.h
+++ b/src/mips/constants-mips.h
@@ -743,11 +743,9 @@ class Instruction {
//
-----------------------------------------------------------------------------
// MIPS assembly various constants.
-
-static const int kArgsSlotsSize = 4 * Instruction::kInstrSize;
-static const int kArgsSlotsNum = 4;
// C/C++ argument slots size.
-static const int kCArgsSlotsSize = 4 * Instruction::kInstrSize;
+static const int kCArgSlotCount = 4;
+static const int kCArgsSlotsSize = kCArgSlotCount *
Instruction::kInstrSize;
// JS argument slots size.
static const int kJSArgsSlotsSize = 0 * Instruction::kInstrSize;
// Assembly builtins argument slots size.
Index: src/mips/frames-mips.h
diff --git a/src/mips/frames-mips.h b/src/mips/frames-mips.h
index
467eec5dbf05bd94d3046a0157689d701c57b12c..798ef23b2ed023dbe10913b8f4a36f81aa524d1f
100644
--- a/src/mips/frames-mips.h
+++ b/src/mips/frames-mips.h
@@ -194,9 +194,6 @@ class StandardFrameConstants : public AllStatic {
static const int kRArgsSlotsSize = 4 * kPointerSize;
static const int kRegularArgsSlotsSize = kRArgsSlotsSize;
- // C/C++ argument slots size.
- static const int kCArgSlotCount = 4;
- static const int kCArgsSlotsSize = kCArgSlotCount * kPointerSize;
// JS argument slots size.
static const int kJSArgsSlotsSize = 0 * kPointerSize;
// Assembly builtins argument slots size.
Index: src/mips/macro-assembler-mips.cc
diff --git a/src/mips/macro-assembler-mips.cc
b/src/mips/macro-assembler-mips.cc
index
45e901bdb91d3eef2c97f9c99dfbd32e2947228d..dc4398ba57fdfd51a64ee7b7d1156f6911f3da47
100644
--- a/src/mips/macro-assembler-mips.cc
+++ b/src/mips/macro-assembler-mips.cc
@@ -4213,11 +4213,9 @@ void MacroAssembler::PrepareCallCFunction(int
num_arguments, Register scratch) {
// mips, even though those argument slots are not normally used.
// Remaining arguments are pushed on the stack, above (higher address
than)
// the argument slots.
- ASSERT(StandardFrameConstants::kCArgsSlotsSize % kPointerSize == 0);
int stack_passed_arguments = ((num_arguments <=
kRegisterPassedArguments) ?
0 : num_arguments -
kRegisterPassedArguments) +
- (StandardFrameConstants::kCArgsSlotsSize /
- kPointerSize);
+ kCArgSlotCount;
if (frame_alignment > kPointerSize) {
// Make stack end at alignment and make room for num_arguments - 4
words
// and the original value of sp.
@@ -4289,11 +4287,9 @@ void MacroAssembler::CallCFunctionHelper(Register
function,
Call(function);
- ASSERT(StandardFrameConstants::kCArgsSlotsSize % kPointerSize == 0);
int stack_passed_arguments = ((num_arguments <=
kRegisterPassedArguments) ?
0 : num_arguments -
kRegisterPassedArguments) +
- (StandardFrameConstants::kCArgsSlotsSize /
- kPointerSize);
+ kCArgSlotCount;
if (OS::ActivationFrameAlignment() > kPointerSize) {
lw(sp, MemOperand(sp, stack_passed_arguments * kPointerSize));
Index: src/mips/macro-assembler-mips.h
diff --git a/src/mips/macro-assembler-mips.h
b/src/mips/macro-assembler-mips.h
index
ec0b2029e4e151c5b911e67a7f2ef07e6f08aa79..ac5bf8e122fc348dccaa4d4b59d264474f8b6ac7
100644
--- a/src/mips/macro-assembler-mips.h
+++ b/src/mips/macro-assembler-mips.h
@@ -1203,10 +1203,9 @@ static inline MemOperand FieldMemOperand(Register
object, int offset) {
// Generate a MemOperand for storing arguments 5..N on the stack
// when calling CallCFunction().
static inline MemOperand CFunctionArgumentOperand(int index) {
- ASSERT(index > StandardFrameConstants::kCArgSlotCount);
+ ASSERT(index > kCArgSlotCount);
// Argument 5 takes the slot just past the four Arg-slots.
- int offset =
- (index - 5) * kPointerSize + StandardFrameConstants::kCArgsSlotsSize;
+ int offset = (index - 5) * kPointerSize + kCArgsSlotsSize;
return MemOperand(sp, offset);
}
Index: src/mips/simulator-mips.cc
diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc
index
3b3869532cc9cb8f90dfd9a4f232e3f6a8dfa806..7628237037e4fa9ef0535ee599c7756a87675cb8
100644
--- a/src/mips/simulator-mips.cc
+++ b/src/mips/simulator-mips.cc
@@ -2716,7 +2716,7 @@ int32_t Simulator::Call(byte* entry, int
argument_count, ...) {
// Store remaining arguments on stack, from low to high memory.
intptr_t* stack_argument = reinterpret_cast<intptr_t*>(entry_stack);
for (int i = 4; i < argument_count; i++) {
- stack_argument[i - 4 + kArgsSlotsNum] = va_arg(parameters, int32_t);
+ stack_argument[i - 4 + kCArgSlotCount] = va_arg(parameters, int32_t);
}
va_end(parameters);
set_register(sp, entry_stack);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev