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

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

Issue 109033003: Fix a race between concurrent recompilation and OSR. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress-330046.js
diff --git a/test/mjsunit/regress/regress-int32-truncation.js b/test/mjsunit/regress-330046.js
similarity index 69%
copy from test/mjsunit/regress/regress-int32-truncation.js
copy to test/mjsunit/regress-330046.js
index dec4ac1195a6c4928d84eac8cc8dc9496bf66600..d94b804ac0a974d94de784b02b7a2b1f6c8a6f25 100644
--- a/test/mjsunit/regress/regress-int32-truncation.js
+++ b/test/mjsunit/regress-330046.js
@@ -25,37 +25,37 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax
+// Flags: --use-osr --allow-natives-syntax --crankshaft
-function f(i, b) {
- var a = 0;
- if (b) {
- var c = 1 << i;
- a = c + c;
+var o1 = {a : 10};
+var o2 = { };
+o2.__proto__ = o1;
+var o3 = { };
+o3.__proto__ = o2;
+
+function f(n, x, b) {
+ var sum = x.a;
+ for (var i = 0; i < n; i++) {
+ sum = 1.0 / i;
}
- var x = a >> 3;
- return a;
+ return sum;
}
-f(1, false);
-f(1, true);
-%OptimizeFunctionOnNextCall(f);
-assertEquals((1 << 30) * 2, f(30, true));
-
+f(10, o3);
+f(20, o3);
+f(30, o3);
+%OptimizeFunctionOnNextCall(f, "concurrent");
+f(100000, o3);
+// At this point OSR replaces already optimized code.
+// Check that it evicts old code from cache.
-var global = 1;
+// This causes all code for f to be lazily deopted.
+o2.a = 5;
-function f2(b) {
- var a = 0;
- if (b) {
- a = global;
- }
- var x = a >> 3;
- return a;
-}
+// If OSR did not evict the old code, it will be installed in f here.
+%OptimizeFunctionOnNextCall(f);
+f(10, o3);
-f2(false);
-f2(true);
-%OptimizeFunctionOnNextCall(f2);
-global = 2.5;
-assertEquals(global, f2(true));
+// The old code is already deoptimized, but f still points to it.
+// Disassembling it will crash.
+%DebugDisassembleFunction(f);
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698