| Index: src/code-stubs-hydrogen.cc
|
| diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
|
| index ae198bc24942bef2dd2dcddcd1b40262fe99863f..a8766414a1ae26a1f0f4d591b8800bff0abde2ba 100644
|
| --- a/src/code-stubs-hydrogen.cc
|
| +++ b/src/code-stubs-hydrogen.cc
|
| @@ -128,7 +128,8 @@ bool CodeStubGraphBuilderBase::BuildGraph() {
|
| if (descriptor_->stack_parameter_count_ != NULL) {
|
| ASSERT(descriptor_->environment_length() == (param_count + 1));
|
| stack_parameter_count = new(zone) HParameter(param_count,
|
| - HParameter::REGISTER_PARAMETER);
|
| + HParameter::REGISTER_PARAMETER,
|
| + Representation::Integer32());
|
| // it's essential to bind this value to the environment in case of deopt
|
| start_environment->Bind(param_count, stack_parameter_count);
|
| AddInstruction(stack_parameter_count);
|
| @@ -139,6 +140,8 @@ bool CodeStubGraphBuilderBase::BuildGraph() {
|
| arguments_length_ = graph()->GetConstant0();
|
| }
|
|
|
| + HInstruction* stack_pop_count = stack_parameter_count;
|
| +
|
| context_ = new(zone) HContext();
|
| AddInstruction(context_);
|
| start_environment->BindContext(context_);
|
| @@ -146,13 +149,25 @@ bool CodeStubGraphBuilderBase::BuildGraph() {
|
| AddSimulate(BailoutId::StubEntry());
|
|
|
| HValue* return_value = BuildCodeStub();
|
| +
|
| + // We might have extra expressions to pop from the stack in addition to the
|
| + // arguments above
|
| + if (descriptor_->acting_as_js_function_) {
|
| + HInstruction* amount = graph()->GetConstant1();
|
| + stack_pop_count = AddInstruction(
|
| + HAdd::New(zone, context_, stack_parameter_count, amount));
|
| + stack_pop_count->ChangeRepresentation(Representation::Integer32());
|
| + stack_pop_count->ClearFlag(HValue::kCanOverflow);
|
| + }
|
| +
|
| HReturn* hreturn_instruction = new(zone) HReturn(return_value,
|
| context_,
|
| - stack_parameter_count);
|
| + stack_pop_count);
|
| current_block()->Finish(hreturn_instruction);
|
| return true;
|
| }
|
|
|
| +
|
| template <class Stub>
|
| class CodeStubGraphBuilder: public CodeStubGraphBuilderBase {
|
| public:
|
|
|