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

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

Issue 10802038: Add dependency to HLoadKeyed* instructions to prevent invalid hoisting (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix bugs 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/hydrogen-instructions.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-137768.js
diff --git a/test/mjsunit/compiler/optimized-closures.js b/test/mjsunit/regress/regress-137768.js
similarity index 64%
copy from test/mjsunit/compiler/optimized-closures.js
copy to test/mjsunit/regress/regress-137768.js
index eaf75f8d00ccd9123ed0f5232a91137845fc3973..10417f1f2213717bc3fcf1a68a75ecc0d466c5a5 100644
--- a/test/mjsunit/compiler/optimized-closures.js
+++ b/test/mjsunit/regress/regress-137768.js
@@ -27,31 +27,37 @@
// Flags: --allow-natives-syntax
-// Test optimized closures.
-
-var a = new Array(100);
-
-function f() {
- var x=0;
- for (var i=0; i<100; i++) {
- var g = function goo(y) {
- function h() {
- if (goo.arguments[0] == 23) return -42;
- return 42;
- }
- return x + y + h(y);
- }
- g(0);
- %OptimizeFunctionOnNextCall(g);
- a[i] = g(i);
+function bad_func(o,a) {
+ var s = 0;
+ for (var i = 0; i < 1; ++i) {
+ o.newFileToChangeMap = undefined;
+ var x = a[0];
+ s += Math.floor(a);
Jakob Kummerow 2012/07/20 08:45:18 Did you mean floor(x)? Either way, this test works
}
+ return s;
}
-f();
-assertEquals(42, a[0]);
-assertEquals(49, a[7]);
-assertEquals(-19, a[23]);
-
-
-
-
+o = new Object();
+a = [1, 2, 3];
+bad_func(o, a);
+
+// Make sure that we're out of pre-monomorphic state for the member add of
+// 'newFileToChangeMap' which causes a map transition.
+o = new Object();
+a = [1, 2, 3];
+bad_func(o, a);
+
+// Optimize, bofre the fix, the element load and subsequent tagged-to-i were
Jakob Kummerow 2012/07/20 08:45:18 nit: messed up comment ("bofre", incomplete senten
+// hoisted above the map check, which can't be hoisted due map-changing store
+// that adds
+o = new Object();
+a = [1, 2, 3];
+%OptimizeFunctionOnNextCall(bad_func);
+bad_func(o, a);
+
+// Pass in a array of doubles. Before the fix, the optimized load and
+// tagged-to-i will treat part of a double value as a pointer and de-ref the
Jakob Kummerow 2012/07/20 08:45:18 nit: slightly messed up comment. s/de-ref the/de-r
+// before the map check was executed that should have deopt.
+o = new Object();
+a = [1.5, 2.5, 3.5];
+bad_func(o, a);
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698