Index: src/deoptimizer.cc |
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc |
index 96871d610f48d09f367d30d56149d6001aaa3d95..f72157d2532017dc69db79d922a3c3c078e9b746 100644 |
--- a/src/deoptimizer.cc |
+++ b/src/deoptimizer.cc |
@@ -1538,27 +1538,44 @@ 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) { |
output_frame_offset -= kPointerSize; |
DoTranslateCommand(iterator, 0, output_frame_offset); |
+ |
+ if (!arg_count_known && descriptor->IsParameterCountRegister(i)) { |
+ arguments_length_offset = output_frame_offset; |
+ } |
} |
+ ASSERT(0 == output_frame_offset); |
+ |
if (!arg_count_known) { |
- DoTranslateCommand(iterator, 0, length_frame_offset, |
- TRANSLATED_VALUE_IS_NATIVE); |
Toon Verwaest
2013/11/12 15:43:06
Now we can get rid of TRANSLATED_VALUE_IS_NATIVE I
|
- caller_arg_count = output_frame->GetFrameSlot(length_frame_offset); |
+ ASSERT(arguments_length_offset >= 0); |
+ // We know it's a smi because 1) the code stub guarantees the stack |
+ // parameter count is in smi range, and 2) the DoTranslateCommand in the |
+ // parameter loop above translated that to a tagged value. |
+ Smi* smi_caller_arg_count = reinterpret_cast<Smi*>( |
+ output_frame->GetFrameSlot(arguments_length_offset)); |
+ caller_arg_count = smi_caller_arg_count->value(); |
+ output_frame->SetFrameSlot(length_frame_offset, caller_arg_count); |
+ if (trace_) { |
+ PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
+ V8PRIxPTR " ; args.length\n", |
+ top_address + length_frame_offset, length_frame_offset, |
+ caller_arg_count); |
+ } |
value = frame_ptr + StandardFrameConstants::kCallerSPOffset + |
(caller_arg_count - 1) * kPointerSize; |
output_frame->SetFrameSlot(args_arguments_offset, value); |
if (trace_) { |
PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
V8PRIxPTR " ; args.arguments\n", |
- top_address + args_arguments_offset, args_arguments_offset, value); |
+ top_address + args_arguments_offset, args_arguments_offset, |
+ value); |
} |
} |
- ASSERT(0 == output_frame_offset); |
- |
// Copy the double registers from the input into the output frame. |
CopyDoubleRegisters(output_frame); |