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

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

Issue 131243003: Turn Runtime_MigrateInstance into Runtime_TryMigrateInstance (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/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-315252.js
diff --git a/test/mjsunit/regress/regress-331416.js b/test/mjsunit/regress/regress-crbug-315252.js
similarity index 62%
copy from test/mjsunit/regress/regress-331416.js
copy to test/mjsunit/regress/regress-crbug-315252.js
index 0c60fced14e1c185919985fd011c9ca46d93ff3f..51454bf28586c7a26395a556af0300ffc719e1d5 100644
--- a/test/mjsunit/regress/regress-331416.js
+++ b/test/mjsunit/regress/regress-crbug-315252.js
@@ -27,26 +27,35 @@
// Flags: --allow-natives-syntax
-function load(a, i) {
- return a[i];
+function f(a, b, c) {
+ this.a = a;
+ this.b = b;
+ this.c = c;
}
-load([1, 2, 3], "length");
-load(3);
-load([1, 2, 3], 3);
-load(0, 0);
-%OptimizeFunctionOnNextCall(load);
-assertEquals(2, load([1, 2, 3], 1));
-assertEquals(undefined, load(0, 0));
-
-function store(a, i, x) {
- a[i] = x;
+var o3 = new f(1, 2, 3.5);
+var o4 = new f(1, 2.5, 3);
+var o1 = new f(1.5, 2, 3);
+var o2 = new f(1.5, 2, 3);
+function migrate(o) {
+ return o.a;
+}
+// Use migrate to stabilize o1, o2 and o4 in [double, double, smi].
+migrate(o4);
+migrate(o1);
+migrate(o2);
+function store_transition(o) {
+ o.d = 1;
}
-store([1, 2, 3], "length", 3);
-store(3);
-store([1, 2, 3], 3, 3);
-store(0, 0, 1);
-%OptimizeFunctionOnNextCall(store);
-var a = [1, 2, 3];
-store(a, 1, 1);
-assertEquals(1, a[1]);
-store(0, 0, 1);
+// Optimize "store_transition" to transition from [double, double, smi] to
+// [double, double, smi, smi]. This adds a dependency on the
+// [double, double, smi] map.
+store_transition(o4);
+store_transition(o1);
+store_transition(o2);
+%OptimizeFunctionOnNextCall(store_transition);
+// Pass in a deprecated object of format [smi, smi, double]. This will migrate
+// the instance, forcing a merge with [double, double, smi], ending up with
+// [double, double, double], which deprecates [double, double, smi] and
+// deoptimizes all dependencies of [double, double, smi], including
+// store_transition itself.
+store_transition(o3);
« 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