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

Side by Side Diff: test/mjsunit/array-natives-elements.js

Issue 1725383002: [test] Rewrite mjsunit/array-natives-elements to make it pass with Crankshaft. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | 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 12 matching lines...) Expand all
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 28 // Flags: --allow-natives-syntax
29 29
30 // IC and Crankshaft support for smi-only elements in dynamic array literals. 30 // IC and Crankshaft support for smi-only elements in dynamic array literals.
31 function get(foo) { return foo; } // Used to generate dynamic values. 31 function get(foo) { return foo; } // Used to generate dynamic values.
32 32
33 // This code exists to eliminate the learning influence of AllocationSites
34 // on the following tests.
35 function make_array_string(literal) {
36 this.__sequence = this.__sequence + 1;
37 return "/* " + this.__sequence + " */ " + literal;
38 }
39 function make_array(literal) {
40 return eval(make_array_string(literal));
41 }
42
33 var __sequence = 0; 43 var __sequence = 0;
34 function array_natives_test() { 44 function array_natives_test() {
35 45
36 // Ensure small array literals start in specific element kind mode. 46 // Ensure small array literals start in specific element kind mode.
37 assertTrue(%HasFastSmiElements([])); 47 assertTrue(%HasFastSmiElements([]));
38 assertTrue(%HasFastSmiElements([1])); 48 assertTrue(%HasFastSmiElements([1]));
39 assertTrue(%HasFastSmiElements([1,2])); 49 assertTrue(%HasFastSmiElements([1,2]));
40 assertTrue(%HasFastDoubleElements([1.1])); 50 assertTrue(%HasFastDoubleElements([1.1]));
41 assertTrue(%HasFastDoubleElements([1.1,2])); 51 assertTrue(%HasFastDoubleElements([1.1,2]));
42 52
43 // This code exists to eliminate the learning influence of AllocationSites
44 // on the following tests.
45 function make_array_string(literal) {
46 this.__sequence = this.__sequence + 1;
47 return "/* " + this.__sequence + " */ " + literal;
48 }
49 function make_array(literal) {
50 return eval(make_array_string(literal));
51 }
52
53 // Push 53 // Push
54 var a0 = make_array("[1, 2, 3]"); 54 var a0 = make_array("[1, 2, 3]");
55 assertTrue(%HasFastSmiElements(a0)); 55 assertTrue(%HasFastSmiElements(a0));
56 assertEquals(4, a0.push(4)); 56 assertEquals(4, a0.push(4));
57 assertTrue(%HasFastSmiElements(a0)); 57 assertTrue(%HasFastSmiElements(a0));
58 assertEquals(5, a0.push(1.3)); 58 assertEquals(5, a0.push(1.3));
59 assertTrue(%HasFastDoubleElements(a0)); 59 assertTrue(%HasFastDoubleElements(a0));
60 assertEquals(6, a0.push(1.5)); 60 assertEquals(6, a0.push(1.5));
61 assertTrue(%HasFastDoubleElements(a0)); 61 assertTrue(%HasFastDoubleElements(a0));
62 assertEquals(7, a0.push({})); 62 assertEquals(7, a0.push({}));
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 assertEquals(4, a4.unshift(1.1)); 299 assertEquals(4, a4.unshift(1.1));
300 assertTrue(%HasFastObjectElements(a4)); 300 assertTrue(%HasFastObjectElements(a4));
301 assertEquals([1.1,{},2,3], a4); 301 assertEquals([1.1,{},2,3], a4);
302 } 302 }
303 303
304 for (var i = 0; i < 3; i++) { 304 for (var i = 0; i < 3; i++) {
305 array_natives_test(); 305 array_natives_test();
306 } 306 }
307 %OptimizeFunctionOnNextCall(array_natives_test); 307 %OptimizeFunctionOnNextCall(array_natives_test);
308 array_natives_test(); 308 array_natives_test();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698