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

Side by Side Diff: test/mjsunit/osr-elements-kind.js

Issue 1257223002: Revert of Remove ExternalArray, derived types, and element kinds (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/opt-elements-kind.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 fixed_int32 : 'fixed int8 elements', 40 external_byte : 'external byte elements',
41 fixed_uint8 : 'fixed uint8 elements', 41 external_unsigned_byte : 'external unsigned byte elements',
42 fixed_int16 : 'fixed int16 elements', 42 external_short : 'external short elements',
43 fixed_uint16 : 'fixed uint16 elements', 43 external_unsigned_short : 'external unsigned short elements',
44 fixed_int32 : 'fixed int32 elements', 44 external_int : 'external int elements',
45 fixed_uint32 : 'fixed uint32 elements', 45 external_unsigned_int : 'external unsigned int elements',
46 fixed_float32 : 'fixed float32 elements', 46 external_float : 'external float elements',
47 fixed_float64 : 'fixed float64 elements', 47 external_double : 'external double elements',
48 fixed_uint8_clamped : 'fixed uint8_clamped elements' 48 external_pixel : 'external pixel 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 56 // Every external kind is also an external array.
57 if (%HasFixedInt8Elements(obj)) { 57 assertTrue(%HasExternalArrayElements(obj));
58 return elements_kind.fixed_int8; 58 if (%HasExternalByteElements(obj)) {
59 return elements_kind.external_byte;
59 } 60 }
60 if (%HasFixedUint8Elements(obj)) { 61 if (%HasExternalUnsignedByteElements(obj)) {
61 return elements_kind.fixed_uint8; 62 return elements_kind.external_unsigned_byte;
62 } 63 }
63 if (%HasFixedInt16Elements(obj)) { 64 if (%HasExternalShortElements(obj)) {
64 return elements_kind.fixed_int16; 65 return elements_kind.external_short;
65 } 66 }
66 if (%HasFixedUint16Elements(obj)) { 67 if (%HasExternalUnsignedShortElements(obj)) {
67 return elements_kind.fixed_uint16; 68 return elements_kind.external_unsigned_short;
68 } 69 }
69 if (%HasFixedInt32Elements(obj)) { 70 if (%HasExternalIntElements(obj)) {
70 return elements_kind.fixed_int32; 71 return elements_kind.external_int;
71 } 72 }
72 if (%HasFixedUint32Elements(obj)) { 73 if (%HasExternalUnsignedIntElements(obj)) {
73 return elements_kind.fixed_uint32; 74 return elements_kind.external_unsigned_int;
74 } 75 }
75 if (%HasFixedFloat32Elements(obj)) { 76 if (%HasExternalFloatElements(obj)) {
76 return elements_kind.fixed_float32; 77 return elements_kind.external_float;
77 } 78 }
78 if (%HasFixedFloat64Elements(obj)) { 79 if (%HasExternalDoubleElements(obj)) {
79 return elements_kind.fixed_float64; 80 return elements_kind.external_double;
80 } 81 }
81 if (%HasFixedUint8ClampedElements(obj)) { 82 if (%HasExternalPixelElements(obj)) {
82 return elements_kind.fixed_uint8_clamped; 83 return elements_kind.external_pixel;
83 } 84 }
84 } 85 }
85 86
86 function assertKind(expected, obj, name_opt) { 87 function assertKind(expected, obj, name_opt) {
87 assertEquals(expected, getKind(obj), name_opt); 88 assertEquals(expected, getKind(obj), name_opt);
88 } 89 }
89 90
90 %NeverOptimizeFunction(construct_smis); 91 %NeverOptimizeFunction(construct_smis);
91 %NeverOptimizeFunction(construct_doubles); 92 %NeverOptimizeFunction(construct_doubles);
92 %NeverOptimizeFunction(convert_mixed); 93 %NeverOptimizeFunction(convert_mixed);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 convert_mixed(construct_doubles(), "three", elements_kind.fast); 134 convert_mixed(construct_doubles(), "three", elements_kind.fast);
134 135
135 smis = construct_smis(); 136 smis = construct_smis();
136 doubles = construct_doubles(); 137 doubles = construct_doubles();
137 convert_mixed(smis, 1, elements_kind.fast); 138 convert_mixed(smis, 1, elements_kind.fast);
138 convert_mixed(doubles, 1, elements_kind.fast); 139 convert_mixed(doubles, 1, elements_kind.fast);
139 assertTrue(%HaveSameMap(smis, doubles)); 140 assertTrue(%HaveSameMap(smis, doubles));
140 141
141 // Throw away type information in the ICs for next stress run. 142 // Throw away type information in the ICs for next stress run.
142 gc(); 143 gc();
OLDNEW
« no previous file with comments | « test/mjsunit/opt-elements-kind.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698