Commit fd88af9e authored by Patrick Thier's avatar Patrick Thier Committed by V8 LUCI CQ

Fix ParameterCount for JSBuiltinContinuationFrame

JavascriptBuiltinContinuationFrame and BuiltinFrame didn't correctly
handle the receiver when it was included in the argument count.

Bug: v8:11112, chromium:1249941
Change-Id: I4d79bd152ea7e992fa3b87a4de2a509b79fcb37c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3165058
Commit-Queue: Patrick Thier <pthier@chromium.org>
Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76881}
parent e6491ecb
......@@ -1393,7 +1393,7 @@ int JavaScriptBuiltinContinuationFrame::ComputeParametersCount() const {
kJavaScriptCallArgCountRegister.code());
Object argc_object(
Memory<Address>(fp() + BuiltinContinuationFrameConstants::kArgCOffset));
return Smi::ToInt(argc_object);
return Smi::ToInt(argc_object) - kJSArgcReceiverSlots;
}
intptr_t JavaScriptBuiltinContinuationFrame::GetSPToFPDelta() const {
......@@ -1875,7 +1875,8 @@ JSFunction BuiltinFrame::function() const {
int BuiltinFrame::ComputeParametersCount() const {
const int offset = BuiltinFrameConstants::kLengthOffset;
return Smi::ToInt(Object(base::Memory<Address>(fp() + offset)));
return Smi::ToInt(Object(base::Memory<Address>(fp() + offset))) -
kJSArgcReceiverSlots;
}
#if V8_ENABLE_WEBASSEMBLY
......
// Copyright 2021 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 --always-opt
(function() {
function foo() {
assertThrowsAsync(new Promise(() => { %DeoptimizeFunction(foo); throw new Error(); }));
}
%PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
foo();
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment