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

Unified Diff: test/mjsunit/compiler/inline-closures.js

Issue 12071002: Allow inlining of multiple closures from shared function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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/hydrogen.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/compiler/inline-closures.js
diff --git a/test/mjsunit/regress/regress-171641.js b/test/mjsunit/compiler/inline-closures.js
similarity index 75%
copy from test/mjsunit/regress/regress-171641.js
copy to test/mjsunit/compiler/inline-closures.js
index 8db6781821325f8f6253eb2df4abb2b362b001c0..69161e505e5f28c25c0d5a8a87d48e0cedf6c389 100644
--- a/test/mjsunit/regress/regress-171641.js
+++ b/test/mjsunit/compiler/inline-closures.js
@@ -27,14 +27,23 @@
// Flags: --allow-natives-syntax
-function foo(k, p) {
- for (var i = 0; i < 1; i++) {
- p = Math.min(p, i);
+// Test inlining of multiple closures derived from one shared function.
+
+function mkClosure(continuation) {
+ return function(value) {
+ if (continuation == 'g') return this.g(value);
+ if (continuation == 'h') return this.h(value);
+ return value.value;
}
- m = Math.floor((k | 0) / p);
}
-foo(0, 1);
-foo(0, 1);
-%OptimizeFunctionOnNextCall(foo);
-foo(0, 1);
+var object = {};
+object.f = mkClosure('g');
+object.g = mkClosure('h');
+object.h = mkClosure('x');
+
+assertSame(1, object.f({value:1}));
+assertSame(2, object.f({value:2}));
+%OptimizeFunctionOnNextCall(object.f);
+assertSame(3, object.f({value:3}));
+assertSame(undefined, object.f({}));
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698