Index: test/mjsunit/array-literal-transitions.js |
diff --git a/test/mjsunit/array-literal-transitions.js b/test/mjsunit/array-literal-transitions.js |
index ca6033b217741aeb2d7b1987f9ed19509a84271d..e1624553f4abef56be92c50a7f7c3c81cdb4e2bf 100644 |
--- a/test/mjsunit/array-literal-transitions.js |
+++ b/test/mjsunit/array-literal-transitions.js |
@@ -25,22 +25,7 @@ |
// (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 --smi-only-arrays --expose-gc |
- |
-// Test element kind of objects. |
-// Since --smi-only-arrays affects builtins, its default setting at compile |
-// time sticks if built with snapshot. If --smi-only-arrays is deactivated |
-// by default, only a no-snapshot build actually has smi-only arrays enabled |
-// in this test case. Depending on whether smi-only arrays are actually |
-// enabled, this test takes the appropriate code path to check smi-only arrays. |
- |
-support_smi_only_arrays = %HasFastSmiElements([1,2,3,4,5,6,7,8,9,10]); |
- |
-if (support_smi_only_arrays) { |
- print("Tests include smi-only arrays."); |
-} else { |
- print("Tests do NOT include smi-only arrays."); |
-} |
+// Flags: --allow-natives-syntax --expose-gc |
// IC and Crankshaft support for smi-only elements in dynamic array literals. |
function get(foo) { return foo; } // Used to generate dynamic values. |
@@ -94,114 +79,112 @@ function array_literal_test() { |
assertEquals(1, f0[0]); |
} |
-if (support_smi_only_arrays) { |
- for (var i = 0; i < 3; i++) { |
- array_literal_test(); |
- } |
- %OptimizeFunctionOnNextCall(array_literal_test); |
+for (var i = 0; i < 3; i++) { |
array_literal_test(); |
+} |
+ %OptimizeFunctionOnNextCall(array_literal_test); |
+array_literal_test(); |
+ |
+function test_large_literal() { |
- function test_large_literal() { |
- |
- function d() { |
- gc(); |
- return 2.5; |
- } |
- |
- function o() { |
- gc(); |
- return new Object(); |
- } |
- |
- large = |
- [ 0, 1, 2, 3, 4, 5, d(), d(), d(), d(), d(), d(), o(), o(), o(), o() ]; |
- assertFalse(%HasDictionaryElements(large)); |
- assertFalse(%HasFastSmiElements(large)); |
- assertFalse(%HasFastDoubleElements(large)); |
- assertTrue(%HasFastObjectElements(large)); |
- assertEquals(large, |
- [0, 1, 2, 3, 4, 5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, |
- new Object(), new Object(), new Object(), new Object()]); |
+ function d() { |
+ gc(); |
+ return 2.5; |
} |
- for (var i = 0; i < 3; i++) { |
- test_large_literal(); |
+ function o() { |
+ gc(); |
+ return new Object(); |
} |
- %OptimizeFunctionOnNextCall(test_large_literal); |
+ |
+ large = |
+ [ 0, 1, 2, 3, 4, 5, d(), d(), d(), d(), d(), d(), o(), o(), o(), o() ]; |
+ assertFalse(%HasDictionaryElements(large)); |
+ assertFalse(%HasFastSmiElements(large)); |
+ assertFalse(%HasFastDoubleElements(large)); |
+ assertTrue(%HasFastObjectElements(large)); |
+ assertEquals(large, |
+ [0, 1, 2, 3, 4, 5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, |
+ new Object(), new Object(), new Object(), new Object()]); |
+} |
+ |
+for (var i = 0; i < 3; i++) { |
test_large_literal(); |
+} |
+ %OptimizeFunctionOnNextCall(test_large_literal); |
+test_large_literal(); |
- function deopt_array(use_literal) { |
- if (use_literal) { |
- return [.5, 3, 4]; |
- } else { |
- return new Array(); |
- } |
+function deopt_array(use_literal) { |
+ if (use_literal) { |
+ return [.5, 3, 4]; |
+ } else { |
+ return new Array(); |
} |
+} |
- deopt_array(false); |
- deopt_array(false); |
- deopt_array(false); |
+deopt_array(false); |
+deopt_array(false); |
+deopt_array(false); |
%OptimizeFunctionOnNextCall(deopt_array); |
- var array = deopt_array(false); |
- assertOptimized(deopt_array); |
- deopt_array(true); |
- assertOptimized(deopt_array); |
- array = deopt_array(false); |
- assertOptimized(deopt_array); |
- |
- // Check that unexpected changes in the objects stored into the boilerplate |
- // also force a deopt. |
- function deopt_array_literal_all_smis(a) { |
- return [0, 1, a]; |
- } |
+var array = deopt_array(false); |
+assertOptimized(deopt_array); |
+deopt_array(true); |
+assertOptimized(deopt_array); |
+array = deopt_array(false); |
+assertOptimized(deopt_array); |
+ |
+// Check that unexpected changes in the objects stored into the boilerplate |
+// also force a deopt. |
+function deopt_array_literal_all_smis(a) { |
+ return [0, 1, a]; |
+} |
- deopt_array_literal_all_smis(2); |
- deopt_array_literal_all_smis(3); |
- deopt_array_literal_all_smis(4); |
- array = deopt_array_literal_all_smis(4); |
- assertEquals(0, array[0]); |
- assertEquals(1, array[1]); |
- assertEquals(4, array[2]); |
+deopt_array_literal_all_smis(2); |
+deopt_array_literal_all_smis(3); |
+deopt_array_literal_all_smis(4); |
+array = deopt_array_literal_all_smis(4); |
+assertEquals(0, array[0]); |
+assertEquals(1, array[1]); |
+assertEquals(4, array[2]); |
%OptimizeFunctionOnNextCall(deopt_array_literal_all_smis); |
- array = deopt_array_literal_all_smis(5); |
- array = deopt_array_literal_all_smis(6); |
- assertOptimized(deopt_array_literal_all_smis); |
- assertEquals(0, array[0]); |
- assertEquals(1, array[1]); |
- assertEquals(6, array[2]); |
- |
- array = deopt_array_literal_all_smis(.5); |
- assertUnoptimized(deopt_array_literal_all_smis); |
- assertEquals(0, array[0]); |
- assertEquals(1, array[1]); |
- assertEquals(.5, array[2]); |
- |
- function deopt_array_literal_all_doubles(a) { |
- return [0.5, 1, a]; |
- } |
+array = deopt_array_literal_all_smis(5); |
+array = deopt_array_literal_all_smis(6); |
+assertOptimized(deopt_array_literal_all_smis); |
+assertEquals(0, array[0]); |
+assertEquals(1, array[1]); |
+assertEquals(6, array[2]); |
+ |
+array = deopt_array_literal_all_smis(.5); |
+assertUnoptimized(deopt_array_literal_all_smis); |
+assertEquals(0, array[0]); |
+assertEquals(1, array[1]); |
+assertEquals(.5, array[2]); |
+ |
+function deopt_array_literal_all_doubles(a) { |
+ return [0.5, 1, a]; |
+} |
- deopt_array_literal_all_doubles(.5); |
- deopt_array_literal_all_doubles(.5); |
- deopt_array_literal_all_doubles(.5); |
- array = deopt_array_literal_all_doubles(0.5); |
- assertEquals(0.5, array[0]); |
- assertEquals(1, array[1]); |
- assertEquals(0.5, array[2]); |
+deopt_array_literal_all_doubles(.5); |
+deopt_array_literal_all_doubles(.5); |
+deopt_array_literal_all_doubles(.5); |
+array = deopt_array_literal_all_doubles(0.5); |
+assertEquals(0.5, array[0]); |
+assertEquals(1, array[1]); |
+assertEquals(0.5, array[2]); |
%OptimizeFunctionOnNextCall(deopt_array_literal_all_doubles); |
- array = deopt_array_literal_all_doubles(5); |
- array = deopt_array_literal_all_doubles(6); |
- assertOptimized(deopt_array_literal_all_doubles); |
- assertEquals(0.5, array[0]); |
- assertEquals(1, array[1]); |
- assertEquals(6, array[2]); |
- |
- var foo = new Object(); |
- array = deopt_array_literal_all_doubles(foo); |
- assertUnoptimized(deopt_array_literal_all_doubles); |
- assertEquals(0.5, array[0]); |
- assertEquals(1, array[1]); |
- assertEquals(foo, array[2]); |
-} |
+array = deopt_array_literal_all_doubles(5); |
+array = deopt_array_literal_all_doubles(6); |
+assertOptimized(deopt_array_literal_all_doubles); |
+assertEquals(0.5, array[0]); |
+assertEquals(1, array[1]); |
+assertEquals(6, array[2]); |
+ |
+var foo = new Object(); |
+array = deopt_array_literal_all_doubles(foo); |
+assertUnoptimized(deopt_array_literal_all_doubles); |
+assertEquals(0.5, array[0]); |
+assertEquals(1, array[1]); |
+assertEquals(foo, array[2]); |
(function literals_after_osr() { |
var color = [0]; |