OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 21 matching lines...) Expand all Loading... | |
32 // time sticks if built with snapshot. If --smi-only-arrays is deactivated | 32 // time sticks if built with snapshot. If --smi-only-arrays is deactivated |
33 // by default, only a no-snapshot build actually has smi-only arrays enabled | 33 // by default, only a no-snapshot build actually has smi-only arrays enabled |
34 // in this test case. Depending on whether smi-only arrays are actually | 34 // in this test case. Depending on whether smi-only arrays are actually |
35 // enabled, this test takes the appropriate code path to check smi-only arrays. | 35 // enabled, this test takes the appropriate code path to check smi-only arrays. |
36 | 36 |
37 support_smi_only_arrays = %HasFastSmiOnlyElements([1,2,3,4,5,6,7,8,9,10]); | 37 support_smi_only_arrays = %HasFastSmiOnlyElements([1,2,3,4,5,6,7,8,9,10]); |
38 | 38 |
39 if (support_smi_only_arrays) { | 39 if (support_smi_only_arrays) { |
40 print("Tests include smi-only arrays."); | 40 print("Tests include smi-only arrays."); |
41 } else { | 41 } else { |
42 print("Tests do NOT include smi-only arrays."); | 42 print("Tests do NOT include smi-only."); |
Jakob Kummerow
2012/01/04 20:55:17
intentional removal?
| |
43 } | 43 } |
44 | 44 |
45 // Ensure that there is a global bais for not aggressively transitioning Arrays | |
Jakob Kummerow
2012/01/04 20:55:17
suggestion: "Ensure that Arrays default to SMI_ONL
| |
46 // to FAST_ELEMENTs. | |
47 // TODO(danno): Remove this code when bias for early ElementsKind transition is | |
48 // tracked per allocation site and not globally. | |
49 [1,2,3][0] = 1.5; | |
50 [1,2,3][0] = 1.5; | |
51 [1,2,3][0] = 1.5; | |
52 [1,2,3][0] = 1.5; | |
53 [1,2,3][0] = 1.5; | |
54 | |
45 var elements_kind = { | 55 var elements_kind = { |
46 fast_smi_only : 'fast smi only elements', | 56 fast_smi_only : 'fast smi only elements', |
47 fast : 'fast elements', | 57 fast : 'fast elements', |
48 fast_double : 'fast double elements', | 58 fast_double : 'fast double elements', |
49 dictionary : 'dictionary elements', | 59 dictionary : 'dictionary elements', |
50 external_byte : 'external byte elements', | 60 external_byte : 'external byte elements', |
51 external_unsigned_byte : 'external unsigned byte elements', | 61 external_unsigned_byte : 'external unsigned byte elements', |
52 external_short : 'external short elements', | 62 external_short : 'external short elements', |
53 external_unsigned_short : 'external unsigned short elements', | 63 external_unsigned_short : 'external unsigned short elements', |
54 external_int : 'external int elements', | 64 external_int : 'external int elements', |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 me.drink = 0xC0C0A; | 118 me.drink = 0xC0C0A; |
109 assertKind(elements_kind.fast, me); | 119 assertKind(elements_kind.fast, me); |
110 | 120 |
111 var too = [1,2,3]; | 121 var too = [1,2,3]; |
112 assertKind(elements_kind.fast_smi_only, too); | 122 assertKind(elements_kind.fast_smi_only, too); |
113 too.dance = 0xD15C0; | 123 too.dance = 0xD15C0; |
114 too.drink = 0xC0C0A; | 124 too.drink = 0xC0C0A; |
115 assertKind(elements_kind.fast_smi_only, too); | 125 assertKind(elements_kind.fast_smi_only, too); |
116 | 126 |
117 // Make sure the element kind transitions from smionly when a non-smi is stored. | 127 // Make sure the element kind transitions from smionly when a non-smi is stored. |
118 var you = new Array(); | 128 var you = new Array(1); |
119 assertKind(elements_kind.fast_smi_only, you); | 129 assertKind(elements_kind.fast_smi_only, you); |
120 for (var i = 0; i < 1337; i++) { | 130 for (var i = 0; i < 1337; i++) { |
121 var val = i; | 131 var val = i; |
122 if (i == 1336) { | 132 if (i == 1336) { |
123 assertKind(elements_kind.fast_smi_only, you); | 133 assertKind(elements_kind.fast_smi_only, you); |
124 val = new Object(); | 134 val = new Object(); |
125 } | 135 } |
126 you[i] = val; | 136 you[i] = val; |
127 } | 137 } |
128 assertKind(elements_kind.fast, you); | 138 assertKind(elements_kind.fast, you); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 var a = ["foo", "bar"]; | 341 var a = ["foo", "bar"]; |
332 assertKind(elements_kind.fast, a); | 342 assertKind(elements_kind.fast, a); |
333 var b = a.splice(0, 1); | 343 var b = a.splice(0, 1); |
334 assertKind(elements_kind.fast, b); | 344 assertKind(elements_kind.fast, b); |
335 var c = a.slice(0, 1); | 345 var c = a.slice(0, 1); |
336 assertKind(elements_kind.fast, c); | 346 assertKind(elements_kind.fast, c); |
337 } | 347 } |
338 | 348 |
339 // Throw away type information in the ICs for next stress run. | 349 // Throw away type information in the ICs for next stress run. |
340 gc(); | 350 gc(); |
OLD | NEW |