Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: test/mjsunit/regress/regress-crbug-138887.js

Issue 10834031: Always set the callee's context when calling a function from optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-crbug-138887.js
diff --git a/test/mjsunit/pixel-array-rounding.js b/test/mjsunit/regress/regress-crbug-138887.js
old mode 100755
new mode 100644
similarity index 75%
copy from test/mjsunit/pixel-array-rounding.js
copy to test/mjsunit/regress/regress-crbug-138887.js
index 0c307e62e55297faefe3e2ae253e7a344f4ee6c6..8d8e1694b620aa36941f4b2e17a90f69f6a17cfa
--- a/test/mjsunit/pixel-array-rounding.js
+++ b/test/mjsunit/regress/regress-crbug-138887.js
@@ -27,18 +27,22 @@
// Flags: --allow-natives-syntax
-var pixels = new Uint8ClampedArray(8);
+function worker1(ignored) {
+ return 100;
+}
-function f() {
- for (var i = 0; i < 8; i++) {
- pixels[i] = (i * 1.1);
+function factory(worker) {
+ return function(call_depth) {
+ if (call_depth == 0) return 10;
+ return 1 + worker(call_depth - 1);
}
- return pixels[1] + pixels[6];
}
-f();
-f();
-assertEquals(6, pixels[5]);
-%OptimizeFunctionOnNextCall(f);
-f();
-assertEquals(6, pixels[5]);
+var f1 = factory(worker1);
+var f2 = factory(f1);
+assertEquals(11, f2(1)); // Result: 1 + f1(0) == 1 + 10.
+assertEquals(11, f2(1));
+%OptimizeFunctionOnNextCall(f1);
+assertEquals(10, f1(0)); // Terminates immediately -> returns 10.
+%OptimizeFunctionOnNextCall(f2);
+assertEquals(102, f2(1000)); // 1 + f1(999) == 1 + 1 + worker1(998) == 102
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698