v8/test/mjsunit/compiler/rest-parameters.js
Michael Starzinger 8d921ca7f3 [turbofan] Remove --turbo shorthand for --turbo-filter.
This removes the --turbo flag and solely relies on the filter pattern
provided via --turbo-filter when deciding whether to use TurboFan. Note
that disabling optimization wholesale can still be done with --no-opt,
which should be used in favor of --no-turbo everywhere.

Also note that this contains semantic changes to the TurboFan activation
criteria. We respect the filter pattern more stringently and no longer
activate TurboFan just because the source contains patterns forcing use
of Ignition via {AstNumberingVisitor::DisableFullCodegenAndCrankshaft}.

R=rmcilroy@chromium.org
BUG=v8:6408

Change-Id: I0c855f6a62350eb62283a3431c8cc1baa750950e
Reviewed-on: https://chromium-review.googlesource.com/528121
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46167}
2017-06-23 11:19:19 +00:00

55 lines
1.2 KiB
JavaScript

// Copyright 2017 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 Rest0Params() {
function f(x, y) {
return x+y;
}
function test(...rest) {
return [rest, f.apply(null, rest)];
}
assertEquals(test(), [[], NaN]);
assertEquals(test(1), [[1], NaN])
assertEquals(test(1, 2), [[1,2], 3]);
assertEquals(test(1, 2, 3), [[1,2,3], 3]);
%OptimizeFunctionOnNextCall(test);
assertEquals(test(), [[], NaN]);
assertEquals(test(1), [[1], NaN])
assertEquals(test(1, 2), [[1,2], 3]);
assertEquals(test(1, 2, 3), [[1,2,3], 3]);
})();
(function Rest1Params() {
function f(x, y) {
return x+y
}
function test(a, ...rest) {
return [rest, a, f.apply(null, rest)];
}
assertEquals(test(), [[], undefined, NaN]);
assertEquals(test(1), [[], 1, NaN]);
assertEquals(test(1, 2), [[2], 1, NaN]);
assertEquals(test(1, 2, 3), [[2,3], 1, 5]);
assertEquals(test(1, 2, 3, 4), [[2,3,4], 1, 5]);
%OptimizeFunctionOnNextCall(test);
assertEquals(test(), [[], undefined, NaN]);
assertEquals(test(1), [[], 1, NaN]);
assertEquals(test(1, 2), [[2], 1, NaN]);
assertEquals(test(1, 2, 3), [[2,3], 1, 5]);
assertEquals(test(1, 2, 3, 4), [[2,3,4], 1, 5]);
})();