Reviewers: danno, mvstanton, Paul Lind, palfia, kisg,
Description:
MIPS: Simplify behavior of code stubs that accept a variable number of stack
arguments in addition to their parameters.
Port r17680 (cc0b972)
Original commit message:
Before, we'd add a special
variable to the environment with the value of a register with the
number of arguments. Now, that register just appears as a parameter to
the code stub.
BUG=
Please review this at https://codereview.chromium.org/70163006/
SVN Base: https://github.com/v8/v8.git@gbl
Affected files (+24, -11 lines):
M src/mips/code-stubs-mips.cc
M src/mips/deoptimizer-mips.cc
M src/mips/lithium-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
f053c7942cb4acef733139aac2f8246ee9b54360..1982c647ebc7e37cc2daaf45428dc561e19cd6a8
100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -178,14 +178,21 @@ static void InitializeArrayConstructorDescriptor(
// a0 -- number of arguments
// a1 -- function
// a2 -- type info cell with elements kind
- static Register registers[] = { a1, a2 };
- descriptor->register_param_count_ = 2;
- if (constant_stack_parameter_count != 0) {
+ static Register registers_variable_args[] = { a1, a2, a0 };
+ static Register registers_no_args[] = { a1, a2 };
+
+ if (constant_stack_parameter_count == 0) {
+ descriptor->register_param_count_ = 2;
+ descriptor->register_params_ = registers_no_args;
+ } else {
// stack param count needs (constructor pointer, and single argument)
+ descriptor->handler_arguments_mode_ = PASS_ARGUMENTS;
descriptor->stack_parameter_count_ = a0;
+ descriptor->register_param_count_ = 3;
+ descriptor->register_params_ = registers_variable_args;
}
+
descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
- descriptor->register_params_ = registers;
descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
descriptor->deoptimization_handler_ =
Runtime::FunctionForId(Runtime::kArrayConstructor)->entry;
@@ -199,15 +206,21 @@ static void
InitializeInternalArrayConstructorDescriptor(
// register state
// a0 -- number of arguments
// a1 -- constructor function
- static Register registers[] = { a1 };
- descriptor->register_param_count_ = 1;
+ static Register registers_variable_args[] = { a1, a0 };
+ static Register registers_no_args[] = { a1 };
- if (constant_stack_parameter_count != 0) {
- // Stack param count needs (constructor pointer, and single argument).
+ if (constant_stack_parameter_count == 0) {
+ descriptor->register_param_count_ = 1;
+ descriptor->register_params_ = registers_no_args;
+ } else {
+ // stack param count needs (constructor pointer, and single argument)
+ descriptor->handler_arguments_mode_ = PASS_ARGUMENTS;
descriptor->stack_parameter_count_ = a0;
+ descriptor->register_param_count_ = 2;
+ descriptor->register_params_ = registers_variable_args;
}
+
descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count;
- descriptor->register_params_ = registers;
descriptor->function_mode_ = JS_FUNCTION_STUB_MODE;
descriptor->deoptimization_handler_ =
Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry;
Index: src/mips/deoptimizer-mips.cc
diff --git a/src/mips/deoptimizer-mips.cc b/src/mips/deoptimizer-mips.cc
index
d31990be5c7eb8a7aeef73f2e47bc9e6ff03828b..c66472f289856b8db488adadfec6deb7d0cd780c
100644
--- a/src/mips/deoptimizer-mips.cc
+++ b/src/mips/deoptimizer-mips.cc
@@ -104,7 +104,7 @@ void Deoptimizer::SetPlatformCompiledStubRegisters(
ApiFunction function(descriptor->deoptimization_handler_);
ExternalReference xref(&function, ExternalReference::BUILTIN_CALL,
isolate_);
intptr_t handler = reinterpret_cast<intptr_t>(xref.address());
- int params = descriptor->environment_length();
+ int params = descriptor->GetHandlerParameterCount();
output_frame->SetRegister(s0.code(), params);
output_frame->SetRegister(s1.code(), (params - 1) * kPointerSize);
output_frame->SetRegister(s2.code(), handler);
Index: src/mips/lithium-mips.cc
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc
index
70dd60d6560cdb6a6938ff709130a72c0c00c101..03c64d9d2784282bbf763d3f5fb65501a4f2fc84
100644
--- a/src/mips/lithium-mips.cc
+++ b/src/mips/lithium-mips.cc
@@ -2421,7 +2421,7 @@ LInstruction* LChunkBuilder::DoParameter(HParameter*
instr) {
CodeStubInterfaceDescriptor* descriptor =
info()->code_stub()->GetInterfaceDescriptor(info()->isolate());
int index = static_cast<int>(instr->index());
- Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index);
+ Register reg = descriptor->GetParameterRegister(index);
return DefineFixed(result, reg);
}
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.