Commit 0f0e274b authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[js-perf-tests] Bring basic-import and basic-export in line with basic-namespace

All microbenchmarks now add 20 variables together per iteration, rather than
just a single variable.

Also re-add a sanity check after the loop, and fix a missing variable add (a15)
from the loop.

Bug: v8:1569
Change-Id: Ie54357b5cedaafd85f01c699c08b24a5ee6468c9
Reviewed-on: https://chromium-review.googlesource.com/636284Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47618}
parent 51a15140
......@@ -3,5 +3,54 @@
// found in the LICENSE file.
export let value = 0;
for (let i = 0; i < iterations; ++i) ++value;
if (value != iterations) throw value;
export function set(x) { value = x };
export let a0 = 0;
export let a1 = 1;
export let a2 = 2;
export let a3 = 3;
export let a4 = 4;
export let a5 = 5;
export let a6 = 6;
export let a7 = 7;
export let a8 = 8;
export let a9 = 9;
export let a10 = 10;
export let a11 = 11;
export let a12 = 12;
export let a13 = 13;
export let a14 = 14;
export let a15 = 15;
export let a16 = 16;
export let a17 = 17;
export let a18 = 18;
export let a19 = 19;
for (let i = 0; i < iterations; ++i) {
let accumulator = value;
accumulator += a0;
accumulator += a1;
accumulator += a2;
accumulator += a3;
accumulator += a4;
accumulator += a5;
accumulator += a6;
accumulator += a7;
accumulator += a8;
accumulator += a9;
accumulator += a10;
accumulator += a11;
accumulator += a12;
accumulator += a13;
accumulator += a14;
accumulator += a15;
accumulator += a16;
accumulator += a17;
accumulator += a18;
accumulator += a19;
set(accumulator);
}
if (value !== 190 * iterations) throw new Error;
set(0);
......@@ -2,7 +2,54 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import {value, set} from "value.js";
for (let i = 0; i < iterations; ++i) set(value + 1);
if (value != iterations) throw value;
import { value,
set,
a0,
a1,
a2,
a3,
a4,
a5,
a6,
a7,
a8,
a9,
a10,
a11,
a12,
a13,
a14,
a15,
a16,
a17,
a18,
a19 } from "value.js";
for (let i = 0; i < iterations; ++i) {
let accumulator = value;
accumulator += a0;
accumulator += a1;
accumulator += a2;
accumulator += a3;
accumulator += a4;
accumulator += a5;
accumulator += a6;
accumulator += a7;
accumulator += a8;
accumulator += a9;
accumulator += a10;
accumulator += a11;
accumulator += a12;
accumulator += a13;
accumulator += a14;
accumulator += a15;
accumulator += a16;
accumulator += a17;
accumulator += a18;
accumulator += a19;
set(accumulator);
}
if (value !== 190 * iterations) throw new Error;
set(0);
......@@ -20,10 +20,14 @@ for (let i = 0; i < iterations; ++i) {
accumulator += m.a12;
accumulator += m.a13;
accumulator += m.a14;
accumulator += m.a15;
accumulator += m.a16;
accumulator += m.a17;
accumulator += m.a18;
accumulator += m.a19;
m.set(accumulator);
}
if (m.value !== 190 * iterations) throw new Error;
m.set(0);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment