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

Unified Diff: test/mjsunit/regress/regress-2326.js

Issue 10933088: Fix caching of optimized code for OSR. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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/compiler.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-2326.js
diff --git a/test/mjsunit/object-is.js b/test/mjsunit/regress/regress-2326.js
similarity index 67%
copy from test/mjsunit/object-is.js
copy to test/mjsunit/regress/regress-2326.js
index b9fdc8442068b4d7c50c06cb0eb8a134b8e9a7f3..d2edf2b1648b10a0800779af59d9bb98d673f05f 100644
--- a/test/mjsunit/object-is.js
+++ b/test/mjsunit/regress/regress-2326.js
@@ -25,23 +25,30 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Test both the Harmony egal operator and it's function equivalent.
+// This tests that we do not share optimized code across closures that
+// were optimized using OSR (for a particular OSR entry AST id) even if
+// caching of optimized code kicks in.
-function TestEgal(expected, x, y) {
- // TODO(mstarzinger): Once we have the egal operator, we can test it here.
- assertSame(expected, Object.is(x, y));
-}
-
-var test_set = [ {}, [], 1/0, -1/0, "s", 0, 0/-1, null, undefined ];
-print(test_set);
-for (var i = 0; i < test_set.length; i++) {
- for (var j = 0; j < test_set.length; j++) {
- if (i == j) {
- assertSame(test_set[i], test_set[j]);
- TestEgal(true, test_set[i], test_set[j]);
+function makeClosure() {
+ function f(mode, iterations) {
+ var accumulator = 0;
+ if (mode == 1) {
+ while (--iterations > 0) accumulator = Math.ceil(accumulator);
+ return 1;
} else {
- TestEgal(false, test_set[i], test_set[j]);
- TestEgal(false, test_set[j], test_set[i]);
+ while (--iterations > 0) accumulator = Math.floor(accumulator);
+ return 2;
}
}
+ return f;
}
+
+// Generate two closures sharing the same underlying function literal.
+var f1 = makeClosure();
+var f2 = makeClosure();
+
+// This function should be optimized via OSR in the first tight loop.
+assertSame(1, f1(1, 100000));
+
+// This function should be optimized via OSR in the second tight loop.
+assertSame(2, f2(2, 100000));
« no previous file with comments | « src/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698