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

Unified Diff: test/mjsunit/array-literal-feedback.js

Issue 17334004: Bugfix in hydrogen array literal code generation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Nit addressed Created 7 years, 6 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/array-literal-feedback.js
diff --git a/test/mjsunit/regress/regress-crbug-245480.js b/test/mjsunit/array-literal-feedback.js
similarity index 75%
copy from test/mjsunit/regress/regress-crbug-245480.js
copy to test/mjsunit/array-literal-feedback.js
index 4769486403cc43c39b243b499c763eadaaed9578..8cc617e93f1df0bbe86b77becff1a614ad44903e 100644
--- a/test/mjsunit/regress/regress-crbug-245480.js
+++ b/test/mjsunit/array-literal-feedback.js
@@ -44,47 +44,32 @@ if (support_smi_only_arrays) {
print("Tests do NOT include smi-only arrays.");
}
-function isHoley(obj) {
- if (%HasFastHoleyElements(obj)) return true;
- return false;
-}
-
-function assertHoley(obj, name_opt) {
- assertEquals(true, isHoley(obj), name_opt);
-}
-
-function assertNotHoley(obj, name_opt) {
- assertEquals(false, isHoley(obj), name_opt);
-}
-
if (support_smi_only_arrays) {
- function create_array(arg) {
- return new Array(arg);
+
+ function get_literal(x) {
+ var literal = [1, 2, x];
+ return literal;
}
- obj = create_array(0);
- assertNotHoley(obj);
- create_array(0);
- %OptimizeFunctionOnNextCall(create_array);
- obj = create_array(10);
- assertHoley(obj);
-}
+ get_literal(3);
+ get_literal(3);
+ %OptimizeFunctionOnNextCall(get_literal);
+ a = get_literal(3);
+ assertTrue(2 != %GetOptimizationStatus(get_literal));
+ assertTrue(%HasFastSmiElements(a));
+ a[0] = 3.5;
-// The code below would assert in debug or crash in release
-function f(length) {
- return new Array(length)
-}
+ // We should have transitioned the boilerplate array to double, and
+ // crankshafted code should de-opt on the unexpected elements kind
+ b = get_literal(3);
+ assertTrue(%HasFastDoubleElements(b));
+ assertEquals([1, 2, 3], b);
+ assertTrue(1 != %GetOptimizationStatus(get_literal));
-f(0);
-f(0);
-%OptimizeFunctionOnNextCall(f);
-var a = f(10);
-
-function g(a) {
- return a[0];
+ // Optimize again
+ get_literal(3);
+ %OptimizeFunctionOnNextCall(get_literal);
+ b = get_literal(3);
+ assertTrue(%HasFastDoubleElements(b));
+ assertTrue(2 != %GetOptimizationStatus(get_literal));
}
-
-var b = [0];
-g(b);
-g(b);
-assertEquals(undefined, g(a));
« 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