a2d61597ca
This is a reland of 9eca23e9ed
Adds a deopt continuation, which fixes JavaScript stack traces
to contain the number constructor after inlining.
Original change's description:
> [turbofan] Inline Number constructor in certain cases
>
> This CL adds inlining for the Number constructor if new.target is not
> present. The lowering is BigInt compatible, i.e. it converts BigInts to
> numbers.
>
> Bug: v8:7904
> Change-Id: If03b9f872d82e50b6ded7709069181c33dc44e82
> Reviewed-on: https://chromium-review.googlesource.com/1118557
> Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Reviewed-by: Georg Neis <neis@chromium.org>
> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#54454}
Bug: v8:7904
Change-Id: Ic416e5ba81fa3a0f59ae4afa80df83c46a759487
Reviewed-on: https://chromium-review.googlesource.com/1146581
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54609}
33 lines
565 B
JavaScript
33 lines
565 B
JavaScript
// Copyright 2018 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
|
|
|
|
// This test writes {} to x to trigger lazy deopt
|
|
// from inside the number constructor.
|
|
var x = "5";
|
|
var b = false;
|
|
|
|
check = function() {
|
|
if (b) x = {};
|
|
return 0;
|
|
}
|
|
|
|
var obj = {};
|
|
obj.valueOf = check;
|
|
|
|
function f() {
|
|
try {
|
|
return x + Number(obj);
|
|
} catch(e) {
|
|
console.log(e.stack);
|
|
}
|
|
}
|
|
|
|
f();
|
|
f();
|
|
%OptimizeFunctionOnNextCall(f);
|
|
b = true;
|
|
f();
|