// Always use the actual stack slots when calculating the fp to sp
// delta adding two for the function and context.
unsigned stack_slots = code->stack_slots();
+ unsigned arguments_stack_height =
+ Deoptimizer::ComputeOutgoingArgumentSize(code, deoptimization_index);
unsigned fp_to_sp_delta = (stack_slots * kPointerSize) +
- StandardFrameConstants::kFixedFrameSizeFromFp;
+ StandardFrameConstants::kFixedFrameSizeFromFp +
+ arguments_stack_height;
Deoptimizer* deoptimizer = new Deoptimizer(isolate,
function,
StandardFrameConstants::kFixedFrameSizeFromFp;
if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
unsigned stack_slots = compiled_code_->stack_slots();
- unsigned outgoing_size = ComputeOutgoingArgumentSize();
+ unsigned outgoing_size =
+ ComputeOutgoingArgumentSize(compiled_code_, bailout_id_);
CHECK(result == fixed_size + (stack_slots * kPointerSize) + outgoing_size);
}
return result;
}
-unsigned Deoptimizer::ComputeOutgoingArgumentSize() const {
+// static
+unsigned Deoptimizer::ComputeOutgoingArgumentSize(Code* code,
+ unsigned bailout_id) {
DeoptimizationInputData* data =
- DeoptimizationInputData::cast(compiled_code_->deoptimization_data());
- unsigned height = data->ArgumentsStackHeight(bailout_id_)->value();
+ DeoptimizationInputData::cast(code->deoptimization_data());
+ unsigned height = data->ArgumentsStackHeight(bailout_id)->value();
return height * kPointerSize;
}
unsigned ComputeFixedSize(JSFunction* function) const;
unsigned ComputeIncomingArgumentSize(JSFunction* function) const;
- unsigned ComputeOutgoingArgumentSize() const;
+ static unsigned ComputeOutgoingArgumentSize(Code* code, unsigned bailout_id);
Object* ComputeLiteral(int index) const;
--- /dev/null
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --expose-debug-as debug
+
+function bar(x) { debugger; }
+function foo() { bar(arguments[0]); }
+function wrap() { return foo(1); }
+
+wrap();
+wrap();
+%OptimizeFunctionOnNextCall(wrap);
+
+var Debug = debug.Debug;
+Debug.setListener(function(event, exec_state, event_data, data) {
+ if (event != Debug.DebugEvent.Break) return;
+ for (var i = 0; i < exec_state.frameCount(); i++) exec_state.frame(i);
+});
+
+wrap();