Index: test/mjsunit/compiler/osr-manual1.js |
diff --git a/test/mjsunit/compiler/osr-manual1.js b/test/mjsunit/compiler/osr-manual1.js |
index 786a70dfefbc34d1bb04868c32361dc9fd95c2ee..29a4948a65f9e19b2ad2a80b4b2ddb00839ee53e 100644 |
--- a/test/mjsunit/compiler/osr-manual1.js |
+++ b/test/mjsunit/compiler/osr-manual1.js |
@@ -4,41 +4,29 @@ |
// Flags: --allow-natives-syntax --use-osr --turbo-osr |
-var counter = 188; |
+var counter = 111; |
-function gen() { // defeat compiler cache. |
+function gen(w) { // defeat compiler cache. |
var num = counter++; |
- var src = |
- "function f" + num + "(Z,a,b,c) {" + |
- " var x = 0;" + |
- " var y = 0;" + |
- " var z = 0;" + |
- " while (a > 0) { Z(0); x += 19; a--; }" + |
- " while (b > 0) { Z(1); y += 23; b--; }" + |
- " while (c > 0) { Z(2); z += 29; c--; }" + |
- " return x + y + z;" + |
- "} f" + num; |
- |
+ var Z = [ "", "", "", ]; |
+ Z[w] = "%OptimizeOsr()"; |
+ var src = |
+ "function f" + num + "(a,b,c) {" + |
+ " var x = 0;" + |
+ " var y = 0;" + |
+ " var z = 0;" + |
+ " while (a > 0) { " + Z[0] + "; x += 19; a--; }" + |
+ " while (b > 0) { " + Z[1] + "; y += 23; b--; }" + |
+ " while (c > 0) { " + Z[2] + "; z += 29; c--; }" + |
+ " return x + y + z;" + |
+ "} f" + num; |
return eval(src); |
} |
-function compiler(a) { // manual control of OSR compiles. |
- var x = 0; |
- function count(l) { |
- if (l == a && (x++) > 0) { |
- %OptimizeFunctionOnNextCall(count.caller, "osr"); |
- } |
- } |
- return count; |
-} |
- |
function check(x,a,b,c) { |
- function none(l) { } |
- |
for (var i = 0; i < 3; i++) { |
- var f = gen(); |
- assertEquals(x, f(compiler(i), a, b, c)); |
- assertEquals(x, f(none, a, b, c)); |
+ var f = gen(i); |
+ assertEquals(x, f(a, b, c)); |
} |
} |