26c00f4a4c
The `FAST_` prefix doesn’t make much sense — they’re all just different cases with their own optimizations. Packedness being implicit (e.g. `FAST_ELEMENTS` vs. `FAST_HOLEY_ELEMENTS`) is not ideal, either. This patch renames the FAST elements kinds as follows: - e.g. FAST_ELEMENTS => PACKED_ELEMENTS - e.g. FAST_HOLEY_ELEMENTS => HOLEY_ELEMENTS The following exceptions are left intact, for lack of a better name: - FAST_SLOPPY_ARGUMENTS_ELEMENTS - SLOW_SLOPPY_ARGUMENTS_ELEMENTS - FAST_STRING_WRAPPER_ELEMENTS - SLOW_STRING_WRAPPER_ELEMENTS This makes it easier to reason about elements kinds, and less confusing to explain how they’re used. R=jkummerow@chromium.org, cbruni@chromium.org BUG=v8:6548 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: Ie7c6bee85583c3d84b730f7aebbd70c1efa38af9 Reviewed-on: https://chromium-review.googlesource.com/556032 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org> Cr-Commit-Position: refs/heads/master@{#46361}
97 lines
2.6 KiB
JavaScript
97 lines
2.6 KiB
JavaScript
// Copyright 2015 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.
|
|
|
|
new BenchmarkSuite('Basic1', [1000], [
|
|
new Benchmark('BasicRest1', false, false, 0,
|
|
BasicRest1, BasicRest1Setup, BasicRest1TearDown)
|
|
]);
|
|
|
|
new BenchmarkSuite('ReturnArgsBabel', [10000], [
|
|
new Benchmark('ReturnArgsBabel', false, false, 0,
|
|
ReturnArgsBabel, ReturnArgsBabelSetup,
|
|
ReturnArgsBabelTearDown)
|
|
]);
|
|
|
|
new BenchmarkSuite('ReturnArgsNative', [10000], [
|
|
new Benchmark('ReturnArgsNative', false, false, 0,
|
|
ReturnArgsNative, ReturnArgsNativeSetup,
|
|
ReturnArgsNativeTearDown)
|
|
]);
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
var result;
|
|
|
|
function basic_rest_fn_1(factor, ...values) {
|
|
var result = 0;
|
|
for (var i = 0; i < values.length; ++i) {
|
|
result += (factor * values[i]);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function BasicRest1Setup() {}
|
|
|
|
function BasicRest1() {
|
|
result = basic_rest_fn_1(10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
|
|
}
|
|
|
|
function BasicRest1TearDown() {
|
|
return result == 550;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
var length = 50;
|
|
var numbers = Array.apply(null, {length}).map(Number.call, Number);
|
|
var strings = numbers.map(String.call, String);
|
|
|
|
function ReturnArgsBabelFunction(unused) {
|
|
"use strict";
|
|
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0),
|
|
_key = 1;
|
|
_key < _len; _key++) {
|
|
args[_key - 1] = arguments[_key];
|
|
}
|
|
return args;
|
|
}
|
|
|
|
function ReturnArgsBabelSetup() {
|
|
// Warm up with HOLEY_ELEMENTS
|
|
result = ReturnArgsBabelFunction(...strings);
|
|
// Warm up with HOLEY_SMI_ELEMENTS
|
|
result = ReturnArgsBabelFunction(...numbers);
|
|
}
|
|
|
|
function ReturnArgsBabel() {
|
|
result = ReturnArgsBabelFunction(...strings);
|
|
result = ReturnArgsBabelFunction(...numbers);
|
|
}
|
|
|
|
function ReturnArgsBabelTearDown() {
|
|
return result.indexOf(0) === 0;
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
function ReturnArgsNativeFunction(unused, ...args) {
|
|
return args;
|
|
}
|
|
|
|
function ReturnArgsNativeSetup() {
|
|
// Warm up with HOLEY_ELEMENTS
|
|
result = ReturnArgsNativeFunction(...strings);
|
|
// Warm up with HOLEY_SMI_ELEMENTS
|
|
result = ReturnArgsNativeFunction(...numbers);
|
|
}
|
|
|
|
function ReturnArgsNative() {
|
|
result = ReturnArgsNativeFunction(...strings);
|
|
result = ReturnArgsNativeFunction(...numbers);
|
|
}
|
|
|
|
function ReturnArgsNativeTearDown() {
|
|
return result.indexOf(0) === 0;
|
|
}
|