Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index 43752cbf84160c4e40e36e37a7a970990e82fe1e..6e5f49512c3f40a85eab26e30632a2df6c38c58c 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -41,17 +41,27 @@ class CodeStubGraphBuilderBase : public HGraphBuilder { |
info_(info), |
descriptor_(info->code_stub()), |
context_(NULL) { |
- int parameter_count = descriptor_.GetEnvironmentParameterCount(); |
+ int parameter_count = GetParameterCount(); |
parameters_.Reset(new HParameter*[parameter_count]); |
} |
virtual bool BuildGraph(); |
protected: |
virtual HValue* BuildCodeStub() = 0; |
+ int GetParameterCount() const { |
+ return descriptor_.GetRegisterParameterCount(); |
+ } |
HParameter* GetParameter(int parameter) { |
- DCHECK(parameter < descriptor_.GetEnvironmentParameterCount()); |
+ DCHECK(parameter < GetParameterCount()); |
return parameters_[parameter]; |
} |
+ Representation GetParameterRepresentation(int parameter) { |
+ return RepresentationFromType(descriptor_.GetParameterType(parameter)); |
+ } |
+ bool IsParameterCountRegister(int index) const { |
+ return descriptor_.GetRegisterParameter(index) |
+ .is(descriptor_.stack_parameter_count()); |
+ } |
HValue* GetArgumentsLength() { |
// This is initialized in BuildGraph() |
DCHECK(arguments_length_ != NULL); |
@@ -128,7 +138,7 @@ bool CodeStubGraphBuilderBase::BuildGraph() { |
isolate()->GetHTracer()->TraceCompilation(info()); |
} |
- int param_count = descriptor_.GetEnvironmentParameterCount(); |
+ int param_count = GetParameterCount(); |
HEnvironment* start_environment = graph()->start_environment(); |
HBasicBlock* next_block = CreateBasicBlock(start_environment); |
Goto(next_block); |
@@ -138,13 +148,12 @@ bool CodeStubGraphBuilderBase::BuildGraph() { |
bool runtime_stack_params = descriptor_.stack_parameter_count().is_valid(); |
HInstruction* stack_parameter_count = NULL; |
for (int i = 0; i < param_count; ++i) { |
- Representation r = |
- RepresentationFromType(descriptor_.GetEnvironmentParameterType(i)); |
+ Representation r = GetParameterRepresentation(i); |
HParameter* param = Add<HParameter>(i, |
HParameter::REGISTER_PARAMETER, r); |
start_environment->Bind(i, param); |
parameters_[i] = param; |
- if (descriptor_.IsEnvironmentParameterCountRegister(i)) { |
+ if (IsParameterCountRegister(i)) { |
param->set_type(HType::Smi()); |
stack_parameter_count = param; |
arguments_length_ = stack_parameter_count; |