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

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

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/div-mod.js ('k') | test/mjsunit/error-tostring-omit.js » ('j') | 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
11 // with the distribution. 11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its 12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived 13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission. 14 // from this software without specific prior written permission.
15 // 15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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 --smi-only-arrays --expose-gc 28 // Flags: --allow-natives-syntax --smi-only-arrays --expose-gc --nostress-opt
29 // Flags: --nostress-opt --nostress-compaction --gc-interval=-1
30 29
31 // Test element kind of objects. 30 // Test element kind of objects.
32 // Since --smi-only-arrays affects builtins, its default setting at compile 31 // Since --smi-only-arrays affects builtins, its default setting at compile
33 // 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
34 // 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
35 // 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
36 // 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.
37 36
38 support_smi_only_arrays = %HasFastSmiElements(new Array(1,2,3,4,5,6,7,8)); 37 support_smi_only_arrays = %HasFastSmiElements(new Array(1,2,3,4,5,6,7,8));
39 38
(...skipping 19 matching lines...) Expand all
59 external_pixel : 'external pixel elements' 58 external_pixel : 'external pixel elements'
60 } 59 }
61 60
62 function getKind(obj) { 61 function getKind(obj) {
63 if (%HasFastSmiElements(obj)) return elements_kind.fast_smi_only; 62 if (%HasFastSmiElements(obj)) return elements_kind.fast_smi_only;
64 if (%HasFastObjectElements(obj)) return elements_kind.fast; 63 if (%HasFastObjectElements(obj)) return elements_kind.fast;
65 if (%HasFastDoubleElements(obj)) return elements_kind.fast_double; 64 if (%HasFastDoubleElements(obj)) return elements_kind.fast_double;
66 if (%HasDictionaryElements(obj)) return elements_kind.dictionary; 65 if (%HasDictionaryElements(obj)) return elements_kind.dictionary;
67 // Every external kind is also an external array. 66 // Every external kind is also an external array.
68 assertTrue(%HasExternalArrayElements(obj)); 67 assertTrue(%HasExternalArrayElements(obj));
69 if (%HasExternalByteElements(obj)) { 68 if (%HasExternalInt8Elements(obj)) {
70 return elements_kind.external_byte; 69 return elements_kind.external_byte;
71 } 70 }
72 if (%HasExternalUnsignedByteElements(obj)) { 71 if (%HasExternalUint8Elements(obj)) {
73 return elements_kind.external_unsigned_byte; 72 return elements_kind.external_unsigned_byte;
74 } 73 }
75 if (%HasExternalShortElements(obj)) { 74 if (%HasExternalInt16Elements(obj)) {
76 return elements_kind.external_short; 75 return elements_kind.external_short;
77 } 76 }
78 if (%HasExternalUnsignedShortElements(obj)) { 77 if (%HasExternalUint16Elements(obj)) {
79 return elements_kind.external_unsigned_short; 78 return elements_kind.external_unsigned_short;
80 } 79 }
81 if (%HasExternalIntElements(obj)) { 80 if (%HasExternalInt32Elements(obj)) {
82 return elements_kind.external_int; 81 return elements_kind.external_int;
83 } 82 }
84 if (%HasExternalUnsignedIntElements(obj)) { 83 if (%HasExternalUint32Elements(obj)) {
85 return elements_kind.external_unsigned_int; 84 return elements_kind.external_unsigned_int;
86 } 85 }
87 if (%HasExternalFloatElements(obj)) { 86 if (%HasExternalFloat32Elements(obj)) {
88 return elements_kind.external_float; 87 return elements_kind.external_float;
89 } 88 }
90 if (%HasExternalDoubleElements(obj)) { 89 if (%HasExternalFloat64Elements(obj)) {
91 return elements_kind.external_double; 90 return elements_kind.external_double;
92 } 91 }
93 if (%HasExternalPixelElements(obj)) { 92 if (%HasExternalUint8ClampedElements(obj)) {
94 return elements_kind.external_pixel; 93 return elements_kind.external_pixel;
95 } 94 }
96 } 95 }
97 96
98 function assertKind(expected, obj, name_opt) { 97 function assertKind(expected, obj, name_opt) {
99 if (!support_smi_only_arrays && 98 if (!support_smi_only_arrays &&
100 expected == elements_kind.fast_smi_only) { 99 expected == elements_kind.fast_smi_only) {
101 expected = elements_kind.fast; 100 expected = elements_kind.fast;
102 } 101 }
103 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
364 var a = ["foo", "bar"]; 363 var a = ["foo", "bar"];
365 assertKind(elements_kind.fast, a); 364 assertKind(elements_kind.fast, a);
366 var b = a.splice(0, 1); 365 var b = a.splice(0, 1);
367 assertKind(elements_kind.fast, b); 366 assertKind(elements_kind.fast, b);
368 var c = a.slice(0, 1); 367 var c = a.slice(0, 1);
369 assertKind(elements_kind.fast, c); 368 assertKind(elements_kind.fast, c);
370 } 369 }
371 370
372 // Throw away type information in the ICs for next stress run. 371 // Throw away type information in the ICs for next stress run.
373 gc(); 372 gc();
OLDNEW
« no previous file with comments | « test/mjsunit/div-mod.js ('k') | test/mjsunit/error-tostring-omit.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698