Commit 3965c548 authored by Mythri's avatar Mythri Committed by Commit Bot

[Interpreter] Add micro-benchmarks for arithmetic and bitwise operations.

Bug: v8:4280
Change-Id: Iedd3182301ad6cde4e63c65dca6cd280e3f05198
Reviewed-on: https://chromium-review.googlesource.com/524044Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45707}
parent e71e8e83
// 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.
function addBenchmark(name, test) {
new BenchmarkSuite(name, [1000],
[
new Benchmark(name, false, false, 0, test)
]);
}
addBenchmark('Smi-Add', addSmi);
addBenchmark('Number-Add', addNumber);
addBenchmark('Number-Oddball-Add', addOddball);
addBenchmark('String-Add', addString);
addBenchmark('Number-String-Add', addNumberString);
addBenchmark('Object-Add', addObject);
addBenchmark('Smi-Sub', subSmi);
addBenchmark('Number-Sub', subNumber);
addBenchmark('Number-Oddball-Sub', subOddball);
addBenchmark('Object-Sub', subObject);
addBenchmark('Smi-Mul', mulSmi);
addBenchmark('Number-Mul', mulNumber);
addBenchmark('Number-Oddball-Mul', mulOddball);
addBenchmark('Object-Mul', mulObject);
addBenchmark('Smi-Div', divSmi);
addBenchmark('Number-Div', divNumber);
addBenchmark('Number-Oddball-Div', divOddball);
addBenchmark('Object-Div', divObject);
addBenchmark('Smi-Mod', modSmi);
addBenchmark('Number-Mod', modNumber);
addBenchmark('Number-Oddball-Mod', modOddball);
addBenchmark('Object-Mod', modObject);
addBenchmark('Smi-Constant-Add', addSmiConstant);
addBenchmark('Smi-Constant-Sub', subSmiConstant);
addBenchmark('Smi-Constant-Mul', mulSmiConstant);
addBenchmark('Smi-Constant-Div', divSmiConstant);
addBenchmark('Smi-Constant-Mod', modSmiConstant);
addBenchmark('Smi-Increment', SmiIncrement);
addBenchmark('Number-Increment', NumberIncrement);
addBenchmark('Smi-Decrement', SmiDecrement);
addBenchmark('Number-Decrement', NumberDecrement);
function add(a, b) {
for (var i = 0; i < 1000; ++i) {
a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b;
a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b;
a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b;
a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b;
a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b;
a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b;
a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b;
a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b;
a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b;
a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b; a + b;
}
}
function sub(a, b) {
for (var i = 0; i < 1000; ++i) {
a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b;
a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b;
a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b;
a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b;
a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b;
a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b;
a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b;
a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b;
a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b;
a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b; a - b;
}
}
function mul(a, b) {
for (var i = 0; i < 1000; ++i) {
a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b;
a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b;
a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b;
a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b;
a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b;
a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b;
a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b;
a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b;
a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b;
a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b; a * b;
}
}
function div(a, b) {
for (var i = 0; i < 1000; ++i) {
a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b;
a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b;
a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b;
a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b;
a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b;
a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b;
a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b;
a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b;
a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b;
a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b; a / b;
}
}
function mod(a, b) {
for (var i = 0; i < 1000; ++i) {
a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b;
a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b;
a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b;
a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b;
a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b;
a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b;
a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b;
a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b;
a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b;
a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b; a % b;
}
}
function addSmiConstant(a) {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10;
a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10;
a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10;
a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10;
a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10;
a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10;
a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10;
a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10;
a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10;
a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10; a + 10;
}
}
function subSmiConstant() {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10;
a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10;
a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10;
a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10;
a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10;
a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10;
a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10;
a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10;
a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10;
a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10; a - 10;
}
}
function mulSmiConstant() {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10;
a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10;
a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10;
a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10;
a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10;
a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10;
a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10;
a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10;
a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10;
a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10; a * 10;
}
}
function divSmiConstant() {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10;
a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10;
a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10;
a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10;
a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10;
a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10;
a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10;
a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10;
a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10;
a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10; a / 10;
}
}
function modSmiConstant() {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10;
a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10;
a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10;
a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10;
a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10;
a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10;
a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10;
a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10;
a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10;
a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10; a % 10;
}
}
function inc(a) {
for (var i = 0; i < 1000; ++i) {
++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a;
++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a;
++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a;
++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a;
++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a;
++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a;
++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a;
++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a;
++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a;
++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a; ++a;
// To ensure it is always in SmiRange for Smi operation.
a -= 1000;
}
}
function dec(a) {
for (var i = 0; i < 1000; ++i) {
--a; --a; --a; --a; --a; --a; --a; --a; --a; --a;
--a; --a; --a; --a; --a; --a; --a; --a; --a; --a;
--a; --a; --a; --a; --a; --a; --a; --a; --a; --a;
--a; --a; --a; --a; --a; --a; --a; --a; --a; --a;
--a; --a; --a; --a; --a; --a; --a; --a; --a; --a;
--a; --a; --a; --a; --a; --a; --a; --a; --a; --a;
--a; --a; --a; --a; --a; --a; --a; --a; --a; --a;
--a; --a; --a; --a; --a; --a; --a; --a; --a; --a;
--a; --a; --a; --a; --a; --a; --a; --a; --a; --a;
--a; --a; --a; --a; --a; --a; --a; --a; --a; --a;
// To ensure it is always in SmiRange for Smi operation.
a += 1000;
}
}
function addSmi() {
add(10, 20);
}
function addNumber() {
add(0.333, 0.5);
}
function addOddball() {
add(0.333, true);
}
function addString() {
add("abc", "def");
}
function addNumberString() {
add("abc", 1.23);
}
function addObject() {
add({x: 1, y:2}, {x:3, y:4});
}
function subSmi() {
sub(10, 20);
}
function subNumber() {
sub(0.333, 0.5);
}
function subOddball() {
sub(0.333, true);
}
function subObject() {
sub({x: 1, y:2}, {x:3, y:4});
}
function mulSmi() {
mul(10, 20);
}
function mulNumber() {
mul(0.333, 0.5);
}
function mulOddball() {
mul(0.333, true);
}
function mulObject() {
mul({x: 1, y:2}, {x:3, y:4});
}
function divSmi() {
div(10, 20);
}
function divNumber() {
div(0.333, 0.5);
}
function divOddball() {
div(0.333, true);
}
function divObject() {
div({x: 1, y:2}, {x:3, y:4});
}
function modSmi() {
mod(10, 20);
}
function modNumber() {
mod(0.333, 0.5);
}
function modOddball() {
mod(0.333, true);
}
function modObject() {
mod({x: 1, y:2}, {x:3, y:4});
}
function SmiIncrement() {
inc(3);
}
function NumberIncrement() {
inc(0.33);
}
function SmiDecrement() {
dec(3);
}
function NumberDecrement() {
dec(0.33);
}
// 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.
function addBenchmark(name, test) {
new BenchmarkSuite(name, [1000],
[
new Benchmark(name, false, false, 0, test)
]);
}
addBenchmark('Smi-Or', orSmi);
addBenchmark('Number-Or', orNumber);
addBenchmark('Smi-Xor', xorSmi);
addBenchmark('Number-Xor', xorNumber);
addBenchmark('Smi-And', andSmi);
addBenchmark('Number-And', andNumber);
addBenchmark('Smi-Constant-Or', orSmiConstant);
addBenchmark('Smi-Constant-Xor', xorSmiConstant);
addBenchmark('Smi-Constant-And', andSmiConstant);
addBenchmark('Smi-ShiftLeft', orSmi);
addBenchmark('Number-ShiftLeft', orNumber);
addBenchmark('Smi-ShiftRight', xorSmi);
addBenchmark('Number-ShiftRight', xorNumber);
addBenchmark('Smi-ShiftRightLogical', andSmi);
addBenchmark('Number-ShiftRightLogical', andNumber);
addBenchmark('Smi-Constant-ShiftLeft', orSmiConstant);
addBenchmark('Smi-Constant-ShiftRight', xorSmiConstant);
addBenchmark('Smi-Constant-ShiftRightLogical', andSmiConstant);
function bitwiseOr(a, b) {
for (var i = 0; i < 1000; ++i) {
a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b;
a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b;
a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b;
a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b;
a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b;
a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b;
a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b;
a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b;
a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b;
a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b; a | b;
}
}
function bitwiseXor(a, b) {
for (var i = 0; i < 1000; ++i) {
a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b;
a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b;
a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b;
a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b;
a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b;
a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b;
a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b;
a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b;
a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b;
a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b; a ^ b;
}
}
function bitwiseAnd(a, b) {
for (var i = 0; i < 1000; ++i) {
a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b;
a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b;
a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b;
a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b;
a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b;
a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b;
a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b;
a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b;
a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b;
a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b; a & b;
}
}
function shiftLeft(a, b) {
for (var i = 0; i < 1000; ++i) {
a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b;
a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b;
a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b;
a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b;
a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b;
a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b;
a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b;
a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b;
a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b;
a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b; a << b;
}
}
function shiftRight(a, b) {
for (var i = 0; i < 1000; ++i) {
a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b;
a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b;
a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b;
a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b;
a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b;
a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b;
a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b;
a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b;
a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b;
a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b; a >> b;
}
}
function shiftRightLogical(a, b) {
for (var i = 0; i < 1000; ++i) {
a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b;
a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b;
a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b;
a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b;
a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b;
a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b;
a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b;
a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b;
a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b;
a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b; a >>> b;
}
}
function orSmiConstant() {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10;
a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10;
a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10;
a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10;
a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10;
a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10;
a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10;
a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10;
a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10;
a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10; a | 10;
}
}
function xorSmiConstant() {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10;
a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10;
a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10;
a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10;
a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10;
a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10;
a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10;
a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10;
a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10;
a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10; a ^ 10;
}
}
function andSmiConstant() {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10;
a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10;
a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10;
a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10;
a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10;
a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10;
a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10;
a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10;
a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10;
a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10; a & 10;
}
}
function shiftLeftSmiConstant() {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10;
a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10;
a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10;
a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10;
a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10;
a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10;
a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10;
a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10;
a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10;
a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10; a << 10;
}
}
function shiftRightSmiConstant() {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10;
a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10;
a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10;
a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10;
a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10;
a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10;
a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10;
a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10;
a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10;
a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10; a >> 10;
}
}
function shiftRightLogicalSmiConstant() {
var a = 20;
for (var i = 0; i < 1000; ++i) {
a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10;
a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10;
a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10;
a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10;
a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10;
a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10;
a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10;
a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10;
a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10;
a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10; a >>> 10;
}
}
function orSmi() {
bitwiseOr(10, 20);
}
function orNumber() {
bitwiseOr(0.33, 0.5);
}
function xorSmi() {
bitwiseXor(10, 20);
}
function xorNumber() {
bitwiseXor(0.33, 0.5);
}
function andSmi() {
bitwiseAnd(10, 20);
}
function andNumber() {
bitwiseAnd(0.33, 0.5);
}
function shiftLeftSmi() {
shiftLeft(10, 20);
}
function shiftLeftNumber() {
shiftLeft(0.333, 0.5);
}
function shiftRightSmi() {
shiftRight(10, 20);
}
function shiftRightNumber() {
shiftRight(0.333, 0.5);
}
function shiftRightLogicalSmi() {
shiftRightLogical(10, 20);
}
function shiftRightLogicalNumber() {
shiftRightLogical(0.333, 0.5);
}
......@@ -7,6 +7,8 @@ load('../base.js');
load('compare.js');
load('string-concat.js');
load('arithmetic.js');
load('bitwise.js');
var success = true;
......
......@@ -394,7 +394,7 @@
"name": "BytecodeHandlers",
"path": ["BytecodeHandlers"],
"main": "run.js",
"resources": [ "compare.js", "string-concat.js" ],
"resources": [ "compare.js", "string-concat.js", "arithmetic.js", "bitwise.js" ],
"flags": [ "--no-opt" ],
"results_regexp": "^%s\\-BytecodeHandler\\(Score\\): (.+)$",
"tests": [
......@@ -428,7 +428,56 @@
{"name": "NumberString-StringConcat-2"},
{"name": "NumberString-StringConcat-3"},
{"name": "NumberString-StringConcat-5"},
{"name": "NumberString-StringConcat-10"}
{"name": "NumberString-StringConcat-10"},
{"name": "Smi-Add"},
{"name": "Number-Add"},
{"name": "Number-Oddball-Add"},
{"name": "String-Add"},
{"name": "Object-Add"},
{"name": "Number-String-Add"},
{"name": "Smi-Sub"},
{"name": "Number-Sub"},
{"name": "Number-Oddball-Sub"},
{"name": "Object-Sub"},
{"name": "Smi-Mul"},
{"name": "Number-Mul"},
{"name": "Number-Oddball-Mul"},
{"name": "Object-Mul"},
{"name": "Smi-Div"},
{"name": "Number-Div"},
{"name": "Number-Oddball-Div"},
{"name": "Object-Div"},
{"name": "Smi-Mod"},
{"name": "Number-Mod"},
{"name": "Number-Oddball-Mod"},
{"name": "Object-Mod"},
{"name": "Smi-Constant-Add"},
{"name": "Smi-Constant-Sub"},
{"name": "Smi-Constant-Mul"},
{"name": "Smi-Constant-Div"},
{"name": "Smi-Constant-Mod"},
{"name": "Smi-Increment"},
{"name": "Number-Increment"},
{"name": "Smi-Decrement"},
{"name": "Number-Decrement"},
{"name": "Smi-Or"},
{"name": "Number-Or"},
{"name": "Smi-Xor"},
{"name": "Number-Xor"},
{"name": "Smi-And"},
{"name": "Number-And"},
{"name": "Smi-Constant-Or"},
{"name": "Smi-Constant-Xor"},
{"name": "Smi-Constant-And"},
{"name": "Smi-ShiftLeft"},
{"name": "Number-ShiftLeft"},
{"name": "Smi-ShiftRight"},
{"name": "Number-ShiftRight"},
{"name": "Smi-ShiftRightLogical"},
{"name": "Number-ShiftRightLogical"},
{"name": "Smi-Constant-ShiftLeft"},
{"name": "Smi-Constant-ShiftRight"},
{"name": "Smi-Constant-ShiftRightLogical"}
]
}
]
......
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