OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 15 matching lines...) Expand all Loading... |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 // Flags: --allow-natives-syntax --expose-gc | 28 // Flags: --allow-natives-syntax --expose-gc |
29 | 29 |
30 // Limit the number of stress runs to reduce polymorphism it defeats some of the | 30 // Limit the number of stress runs to reduce polymorphism it defeats some of the |
31 // assumptions made about how elements transitions work because transition stubs | 31 // assumptions made about how elements transitions work because transition stubs |
32 // end up going generic. | 32 // end up going generic. |
33 // Flags: --stress-runs=2 | 33 // Flags: --stress-runs=2 |
34 | 34 |
35 var elements_kind = { | 35 var elements_kind = { |
36 fast_smi_only : 'fast smi only elements', | 36 fast_smi_only : 'fast smi only elements', |
37 fast : 'fast elements', | 37 fast : 'fast elements', |
38 fast_double : 'fast double elements', | 38 fast_double : 'fast double elements', |
39 dictionary : 'dictionary elements', | 39 dictionary : 'dictionary elements', |
40 external_byte : 'external byte elements', | 40 fixed_int32 : 'fixed int8 elements', |
41 external_unsigned_byte : 'external unsigned byte elements', | 41 fixed_uint8 : 'fixed uint8 elements', |
42 external_short : 'external short elements', | 42 fixed_int16 : 'fixed int16 elements', |
43 external_unsigned_short : 'external unsigned short elements', | 43 fixed_uint16 : 'fixed uint16 elements', |
44 external_int : 'external int elements', | 44 fixed_int32 : 'fixed int32 elements', |
45 external_unsigned_int : 'external unsigned int elements', | 45 fixed_uint32 : 'fixed uint32 elements', |
46 external_float : 'external float elements', | 46 fixed_float32 : 'fixed float32 elements', |
47 external_double : 'external double elements', | 47 fixed_float64 : 'fixed float64 elements', |
48 external_pixel : 'external pixel elements' | 48 fixed_uint8_clamped : 'fixed uint8_clamped elements' |
49 } | 49 } |
50 | 50 |
51 function getKind(obj) { | 51 function getKind(obj) { |
52 if (%HasFastSmiElements(obj)) return elements_kind.fast_smi_only; | 52 if (%HasFastSmiElements(obj)) return elements_kind.fast_smi_only; |
53 if (%HasFastObjectElements(obj)) return elements_kind.fast; | 53 if (%HasFastObjectElements(obj)) return elements_kind.fast; |
54 if (%HasFastDoubleElements(obj)) return elements_kind.fast_double; | 54 if (%HasFastDoubleElements(obj)) return elements_kind.fast_double; |
55 if (%HasDictionaryElements(obj)) return elements_kind.dictionary; | 55 if (%HasDictionaryElements(obj)) return elements_kind.dictionary; |
56 // Every external kind is also an external array. | 56 |
57 assertTrue(%HasExternalArrayElements(obj)); | 57 if (%HasFixedInt8Elements(obj)) { |
58 if (%HasExternalByteElements(obj)) { | 58 return elements_kind.fixed_int8; |
59 return elements_kind.external_byte; | |
60 } | 59 } |
61 if (%HasExternalUnsignedByteElements(obj)) { | 60 if (%HasFixedUint8Elements(obj)) { |
62 return elements_kind.external_unsigned_byte; | 61 return elements_kind.fixed_uint8; |
63 } | 62 } |
64 if (%HasExternalShortElements(obj)) { | 63 if (%HasFixedInt16Elements(obj)) { |
65 return elements_kind.external_short; | 64 return elements_kind.fixed_int16; |
66 } | 65 } |
67 if (%HasExternalUnsignedShortElements(obj)) { | 66 if (%HasFixedUint16Elements(obj)) { |
68 return elements_kind.external_unsigned_short; | 67 return elements_kind.fixed_uint16; |
69 } | 68 } |
70 if (%HasExternalIntElements(obj)) { | 69 if (%HasFixedInt32Elements(obj)) { |
71 return elements_kind.external_int; | 70 return elements_kind.fixed_int32; |
72 } | 71 } |
73 if (%HasExternalUnsignedIntElements(obj)) { | 72 if (%HasFixedUint32Elements(obj)) { |
74 return elements_kind.external_unsigned_int; | 73 return elements_kind.fixed_uint32; |
75 } | 74 } |
76 if (%HasExternalFloatElements(obj)) { | 75 if (%HasFixedFloat32Elements(obj)) { |
77 return elements_kind.external_float; | 76 return elements_kind.fixed_float32; |
78 } | 77 } |
79 if (%HasExternalDoubleElements(obj)) { | 78 if (%HasFixedFloat64Elements(obj)) { |
80 return elements_kind.external_double; | 79 return elements_kind.fixed_float64; |
81 } | 80 } |
82 if (%HasExternalPixelElements(obj)) { | 81 if (%HasFixedUint8ClampedElements(obj)) { |
83 return elements_kind.external_pixel; | 82 return elements_kind.fixed_uint8_clamped; |
84 } | 83 } |
85 } | 84 } |
86 | 85 |
87 function assertKind(expected, obj, name_opt) { | 86 function assertKind(expected, obj, name_opt) { |
88 assertEquals(expected, getKind(obj), name_opt); | 87 assertEquals(expected, getKind(obj), name_opt); |
89 } | 88 } |
90 | 89 |
91 %NeverOptimizeFunction(construct_smis); | 90 %NeverOptimizeFunction(construct_smis); |
92 %NeverOptimizeFunction(construct_doubles); | 91 %NeverOptimizeFunction(construct_doubles); |
93 %NeverOptimizeFunction(convert_mixed); | 92 %NeverOptimizeFunction(convert_mixed); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 convert_mixed(construct_doubles(), "three", elements_kind.fast); | 133 convert_mixed(construct_doubles(), "three", elements_kind.fast); |
135 | 134 |
136 smis = construct_smis(); | 135 smis = construct_smis(); |
137 doubles = construct_doubles(); | 136 doubles = construct_doubles(); |
138 convert_mixed(smis, 1, elements_kind.fast); | 137 convert_mixed(smis, 1, elements_kind.fast); |
139 convert_mixed(doubles, 1, elements_kind.fast); | 138 convert_mixed(doubles, 1, elements_kind.fast); |
140 assertTrue(%HaveSameMap(smis, doubles)); | 139 assertTrue(%HaveSameMap(smis, doubles)); |
141 | 140 |
142 // Throw away type information in the ICs for next stress run. | 141 // Throw away type information in the ICs for next stress run. |
143 gc(); | 142 gc(); |
OLD | NEW |