v8/test/mjsunit/regress/regress-crbug-724153.js
Leszek Swirski 53d4dfc377 [sfi] Compress function arg counts to 16 bit
Compress the parameter count (and function length) stored in
SharedFunctionInfo to a uint16_t. This limits us to 2^16 - 1 parameters
per function, minus one for the "don't adapt arguments" sentinel value,
which is one fewer than Code::kMaxArguments was already. Anyway, 65534
arguments should be enough for anyone!

This drops SFI size by 4 bytes.

Bug: chromium:818642
Change-Id: I126bfb24453dcdc5087a104d3a12cf195a56fa9f
Reviewed-on: https://chromium-review.googlesource.com/1076627
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53447}
2018-05-30 16:35:50 +00:00

19 lines
528 B
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 --no-turbo-verify
(function TestParameterLimit() {
var src = '(function f(a,';
for (var i = 0; i < 65534 - 2; i++) {
src += 'b' + i + ',';
}
src += 'c) { return a + c })';
var f = eval(src);
assertEquals(NaN, f(1));
assertEquals(NaN, f(2));
%OptimizeFunctionOnNextCall(f);
assertEquals(NaN, f(3));
})();