Tune mjsunit/compiler/expression-trees.

R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/43703002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17404 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ee87c867
......@@ -55,46 +55,43 @@ function makeTrees(op, leaves) {
}
}
// All 429 possible bitwise OR trees with eight leaves.
var identifiers = ['a','b','c','d','e','f','g','h'];
// All possible bitwise OR trees with six leaves, i.e. CatalanNumber[5] = 42,
// see http://mathworld.wolfram.com/CatalanNumber.html.
var identifiers = ['a','b','c','d','e','f'];
var or_trees = makeTrees("|", identifiers);
var and_trees = makeTrees("&", identifiers);
// Set up leaf masks to set 8 least-significant bits.
// Set up leaf masks to set 6 least-significant bits.
var a = 1 << 0;
var b = 1 << 1;
var c = 1 << 2;
var d = 1 << 3;
var e = 1 << 4;
var f = 1 << 5;
var g = 1 << 6;
var h = 1 << 7;
for (var i = 0; i < or_trees.length; ++i) {
for (var j = 0; j < 8; ++j) {
for (var j = 0; j < 6; ++j) {
var or_fun = new Function("return " + or_trees[i]);
if (j == 0) assertEquals(255, or_fun());
if (j == 0) assertEquals(63, or_fun());
// Set the j'th variable to a string to force a bailout.
eval(identifiers[j] + "+= ''");
assertEquals(255, or_fun());
assertEquals(63, or_fun());
// Set it back to a number for the next iteration.
eval(identifiers[j] + "= +" + identifiers[j]);
}
}
// Set up leaf masks to clear 8 least-significant bits.
a ^= 255;
b ^= 255;
c ^= 255;
d ^= 255;
e ^= 255;
f ^= 255;
g ^= 255;
h ^= 255;
// Set up leaf masks to clear 6 least-significant bits.
a ^= 63;
b ^= 63;
c ^= 63;
d ^= 63;
e ^= 63;
f ^= 63;
for (i = 0; i < and_trees.length; ++i) {
for (var j = 0; j < 8; ++j) {
for (var j = 0; j < 6; ++j) {
var and_fun = new Function("return " + and_trees[i]);
if (j == 0) assertEquals(0, and_fun());
......
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