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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 external_pixel : 'external pixel elements' | 58 external_pixel : 'external pixel elements' |
59 } | 59 } |
60 | 60 |
61 function getKind(obj) { | 61 function getKind(obj) { |
62 if (%HasFastSmiElements(obj)) return elements_kind.fast_smi_only; | 62 if (%HasFastSmiElements(obj)) return elements_kind.fast_smi_only; |
63 if (%HasFastObjectElements(obj)) return elements_kind.fast; | 63 if (%HasFastObjectElements(obj)) return elements_kind.fast; |
64 if (%HasFastDoubleElements(obj)) return elements_kind.fast_double; | 64 if (%HasFastDoubleElements(obj)) return elements_kind.fast_double; |
65 if (%HasDictionaryElements(obj)) return elements_kind.dictionary; | 65 if (%HasDictionaryElements(obj)) return elements_kind.dictionary; |
66 // Every external kind is also an external array. | 66 // Every external kind is also an external array. |
67 assertTrue(%HasExternalArrayElements(obj)); | 67 assertTrue(%HasExternalArrayElements(obj)); |
68 if (%HasExternalByteElements(obj)) { | 68 if (%HasExternalInt8Elements(obj)) { |
69 return elements_kind.external_byte; | 69 return elements_kind.external_byte; |
70 } | 70 } |
71 if (%HasExternalUnsignedByteElements(obj)) { | 71 if (%HasExternalUint8Elements(obj)) { |
72 return elements_kind.external_unsigned_byte; | 72 return elements_kind.external_unsigned_byte; |
73 } | 73 } |
74 if (%HasExternalShortElements(obj)) { | 74 if (%HasExternalInt16Elements(obj)) { |
75 return elements_kind.external_short; | 75 return elements_kind.external_short; |
76 } | 76 } |
77 if (%HasExternalUnsignedShortElements(obj)) { | 77 if (%HasExternalUint16Elements(obj)) { |
78 return elements_kind.external_unsigned_short; | 78 return elements_kind.external_unsigned_short; |
79 } | 79 } |
80 if (%HasExternalIntElements(obj)) { | 80 if (%HasExternalInt32Elements(obj)) { |
81 return elements_kind.external_int; | 81 return elements_kind.external_int; |
82 } | 82 } |
83 if (%HasExternalUnsignedIntElements(obj)) { | 83 if (%HasExternalUint32Elements(obj)) { |
84 return elements_kind.external_unsigned_int; | 84 return elements_kind.external_unsigned_int; |
85 } | 85 } |
86 if (%HasExternalFloatElements(obj)) { | 86 if (%HasExternalFloat32Elements(obj)) { |
87 return elements_kind.external_float; | 87 return elements_kind.external_float; |
88 } | 88 } |
89 if (%HasExternalDoubleElements(obj)) { | 89 if (%HasExternalFloat64Elements(obj)) { |
90 return elements_kind.external_double; | 90 return elements_kind.external_double; |
91 } | 91 } |
92 if (%HasExternalPixelElements(obj)) { | 92 if (%HasExternalUint8ClampedElements(obj)) { |
93 return elements_kind.external_pixel; | 93 return elements_kind.external_pixel; |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 function assertKind(expected, obj, name_opt) { | 97 function assertKind(expected, obj, name_opt) { |
98 if (!support_smi_only_arrays && | 98 if (!support_smi_only_arrays && |
99 expected == elements_kind.fast_smi_only) { | 99 expected == elements_kind.fast_smi_only) { |
100 expected = elements_kind.fast; | 100 expected = elements_kind.fast; |
101 } | 101 } |
102 assertEquals(expected, getKind(obj), name_opt); | 102 assertEquals(expected, getKind(obj), name_opt); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 var a = ["foo", "bar"]; | 363 var a = ["foo", "bar"]; |
364 assertKind(elements_kind.fast, a); | 364 assertKind(elements_kind.fast, a); |
365 var b = a.splice(0, 1); | 365 var b = a.splice(0, 1); |
366 assertKind(elements_kind.fast, b); | 366 assertKind(elements_kind.fast, b); |
367 var c = a.slice(0, 1); | 367 var c = a.slice(0, 1); |
368 assertKind(elements_kind.fast, c); | 368 assertKind(elements_kind.fast, c); |
369 } | 369 } |
370 | 370 |
371 // Throw away type information in the ICs for next stress run. | 371 // Throw away type information in the ICs for next stress run. |
372 gc(); | 372 gc(); |
OLD | NEW |