Index: src/deoptimizer.cc |
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc |
index a730b48d2e8c41c26c8346637f21cf2d7d21d4ff..30a7840358530b4d87424193aa09924a5bf0abc4 100644 |
--- a/src/deoptimizer.cc |
+++ b/src/deoptimizer.cc |
@@ -1554,10 +1554,13 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator, |
// The output frame must have room for all pushed register parameters |
// and the standard stack frame slots. Include space for an argument |
// object to the callee and optionally the space to pass the argument |
- // object to the stub failure handler. |
- CHECK_GE(descriptor->register_param_count(), 0); |
- int height_in_bytes = kPointerSize * descriptor->register_param_count() + |
- sizeof(Arguments) + kPointerSize; |
+ // object to the stub failure handler. The descriptor's first register |
+ // parameter is the context register, which we deal with separately. |
+ int param_count = descriptor->register_param_count() - 1; |
danno
2014/07/16 13:19:59
Use GetEnvironmentParameterLength(), then comment
mvstanton
2014/07/17 09:04:05
Done.
|
+ CHECK_GE(param_count, 0); |
+ |
+ int height_in_bytes = kPointerSize * param_count + sizeof(Arguments) + |
+ kPointerSize; |
int fixed_frame_size = StandardFrameConstants::kFixedFrameSize; |
int input_frame_size = input_->GetFrameSize(); |
int output_frame_size = height_in_bytes + fixed_frame_size; |
@@ -1699,11 +1702,14 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator, |
// Copy the register parameters to the failure frame. |
int arguments_length_offset = -1; |
- for (int i = 0; i < descriptor->register_param_count(); ++i) { |
+ for (int i = 0; i < param_count; ++i) { |
output_frame_offset -= kPointerSize; |
DoTranslateCommand(iterator, 0, output_frame_offset); |
- if (!arg_count_known && descriptor->IsParameterCountRegister(i)) { |
+ // In the frame we only have descriptor->ParameterRegisters [1..param_count] |
+ // because we don't include the context register. Adjust our index into |
+ // the descriptor parameter array accordingly. |
danno
2014/07/16 13:19:59
Why not move this up to the loop iteration? e.g.
mvstanton
2014/07/17 09:04:05
Well, I would have to make the terminating conditi
|
+ if (!arg_count_known && descriptor->IsParameterCountRegister(i + 1)) { |
arguments_length_offset = output_frame_offset; |
} |
} |