v8/test/mjsunit/regress/regress-string-from-char-code-tonumber.js
bmeurer 7554360f28 [builtins] Migrate String.fromCharCode to TurboFan code stub.
When we moved the String.fromCharCode builtin to C++, we slightly
regressed the fast single character code argument case. Recovered some
of the performance by implementing the builtin using the TurboFan
CodeStubAssembler.

Drive-by-fix: Make sure the stack trace from the implicit ToNumber
conversion in String.fromCharCode includes the builtin by adding a
regression test for that.

R=yangguo@chromium.org
BUG=chromium:609831,chromium:613947,v8:5049

Review-Url: https://codereview.chromium.org/2021143003
Cr-Commit-Position: refs/heads/master@{#36611}
2016-05-31 11:39:05 +00:00

27 lines
587 B
JavaScript

// Copyright 2016 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
var thrower = { [Symbol.toPrimitive]: function() { FAIL } };
function testTrace(func) {
try {
func(thrower);
assertUnreachable();
} catch (e) {
assertTrue(e.stack.indexOf("fromCharCode") >= 0);
}
}
testTrace(String.fromCharCode);
function foo(x) { return String.fromCharCode(x); }
foo(1);
foo(2);
testTrace(foo);
%OptimizeFunctionOnNextCall(foo);
testTrace(foo);