v8/test/mjsunit/compiler/string-concat-deopt.js
Igor Sheludko 11aaf0fb84 [api] Move tagging scheme definition up in include/v8.h
... in order to be able to use it in other constants definitions in the header.

Bug: v8:7570
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: Id5d6ae34ab401ecf063bf5897b87b6bb87c24960
Reviewed-on: https://chromium-review.googlesource.com/1032782
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53097}
2018-05-09 13:17:07 +00:00

95 lines
1.8 KiB
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
(() => {
function f(a) {
return "abc".concat();
}
assertEquals("abc", f());
assertEquals("abc", f());
%OptimizeFunctionOnNextCall(f);
assertEquals("abc", f());
})();
(() => {
function f(a) {
return "abc".concat(a);
}
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
assertEquals("abcde", f("de"));
})();
(() => {
function f(a) {
return "abc".concat(a);
}
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
assertEquals("abc1", f(1));
})();
(() => {
function f(a) {
return "abc".concat(a);
}
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
var s = "x".repeat(%StringMaxLength());
assertThrows(() => f(s), RangeError);
})();
(() => {
function f(a) {
return "ab".concat("c");
}
assertEquals("abc", f());
assertEquals("abc", f());
%OptimizeFunctionOnNextCall(f);
assertEquals("abc", f());
})();
(() => {
function f(a) {
return "ab".concat("c", a);
}
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
assertEquals("abcde", f("de"));
})();
(() => {
function f(a) {
return "ab".concat("c", a);
}
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
assertEquals("abc1", f(1));
})();
(() => {
function f(a) {
return "ab".concat("c", a);
}
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
var s = "x".repeat(%StringMaxLength());
assertThrows(() => f(s), RangeError);
})();