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

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

Issue 104923010: Remove flag track-allocation-sites. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Included ports this time! Created 6 years, 11 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/elements-kind.js ('k') | test/mjsunit/elements-transition-and-store.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 --notrack-allocation-sites 28 // Flags: --allow-natives-syntax --smi-only-arrays
29 // Flags: --nostress-opt
29 30
30 support_smi_only_arrays = %HasFastSmiElements(new Array(1,2,3,4,5,6,7,8)); 31 support_smi_only_arrays = %HasFastSmiElements(new Array(1,2,3,4,5,6,7,8));
31 32
32 if (support_smi_only_arrays) { 33 if (support_smi_only_arrays) {
33 print("Tests include smi-only arrays."); 34 print("Tests include smi-only arrays.");
34 } else { 35 } else {
35 print("Tests do NOT include smi-only arrays."); 36 print("Tests do NOT include smi-only arrays.");
36 } 37 }
37 38
38 if (support_smi_only_arrays) { 39 if (support_smi_only_arrays) {
40 // This code exists to eliminate the learning influence of AllocationSites
41 // on the following tests.
42 var __sequence = 0;
43 function make_array_string(length) {
44 this.__sequence = this.__sequence + 1;
45 return "/* " + this.__sequence + " */ new Array(" + length + ");";
46 }
47 function make_array(length) {
48 return eval(make_array_string(length));
49 }
50
39 function test(test_double, test_object, set, length) { 51 function test(test_double, test_object, set, length) {
40 // We apply the same operations to two identical arrays. The first array 52 // We apply the same operations to two identical arrays. The first array
41 // triggers an IC miss, upon which the conversion stub is generated, but the 53 // triggers an IC miss, upon which the conversion stub is generated, but the
42 // actual conversion is done in runtime. The second array, arriving at 54 // actual conversion is done in runtime. The second array, arriving at
43 // the previously patched IC, is then converted using the conversion stub. 55 // the previously patched IC, is then converted using the conversion stub.
44 var array_1 = new Array(length); 56 var array_1 = make_array(length);
45 var array_2 = new Array(length); 57 var array_2 = make_array(length);
46 58
59 // false, true, nice setter function, 20
47 assertTrue(%HasFastSmiElements(array_1)); 60 assertTrue(%HasFastSmiElements(array_1));
48 assertTrue(%HasFastSmiElements(array_2)); 61 assertTrue(%HasFastSmiElements(array_2));
49 for (var i = 0; i < length; i++) { 62 for (var i = 0; i < length; i++) {
50 if (i == length - 5 && test_double) { 63 if (i == length - 5 && test_double) {
51 // Trigger conversion to fast double elements at length-5. 64 // Trigger conversion to fast double elements at length-5.
52 set(array_1, i, 0.5); 65 set(array_1, i, 0.5);
53 set(array_2, i, 0.5); 66 set(array_2, i, 0.5);
54 assertTrue(%HasFastDoubleElements(array_1)); 67 assertTrue(%HasFastDoubleElements(array_1));
55 assertTrue(%HasFastDoubleElements(array_2)); 68 assertTrue(%HasFastDoubleElements(array_2));
56 } else if (i == length - 3 && test_object) { 69 } else if (i == length - 3 && test_object) {
(...skipping 22 matching lines...) Expand all
79 } else { 92 } else {
80 assertEquals(undefined, array_1[i]); 93 assertEquals(undefined, array_1[i]);
81 assertEquals(undefined, array_2[i]); 94 assertEquals(undefined, array_2[i]);
82 } 95 }
83 } 96 }
84 97
85 assertEquals(length, array_1.length); 98 assertEquals(length, array_1.length);
86 assertEquals(length, array_2.length); 99 assertEquals(length, array_2.length);
87 } 100 }
88 101
89 test(false, false, function(a,i,v){ a[i] = v; }, 20); 102 function run_test(test_double, test_object, set, length) {
90 test(true, false, function(a,i,v){ a[i] = v; }, 20); 103 test(test_double, test_object, set, length);
91 test(false, true, function(a,i,v){ a[i] = v; }, 20); 104 %ClearFunctionTypeFeedback(test);
92 test(true, true, function(a,i,v){ a[i] = v; }, 20); 105 }
93 106
94 test(false, false, function(a,i,v){ a[i] = v; }, 10000); 107 run_test(false, false, function(a,i,v){ a[i] = v; }, 20);
95 test(true, false, function(a,i,v){ a[i] = v; }, 10000); 108 run_test(true, false, function(a,i,v){ a[i] = v; }, 20);
96 test(false, true, function(a,i,v){ a[i] = v; }, 10000); 109 run_test(false, true, function(a,i,v){ a[i] = v; }, 20);
97 test(true, true, function(a,i,v){ a[i] = v; }, 10000); 110 run_test(true, true, function(a,i,v){ a[i] = v; }, 20);
111
112 run_test(false, false, function(a,i,v){ a[i] = v; }, 10000);
113 run_test(true, false, function(a,i,v){ a[i] = v; }, 10000);
114 run_test(false, true, function(a,i,v){ a[i] = v; }, 10000);
115 run_test(true, true, function(a,i,v){ a[i] = v; }, 10000);
98 116
99 // Check COW arrays 117 // Check COW arrays
100 function get_cow() { return [1, 2, 3]; } 118 function get_cow() { return [1, 2, 3]; }
101 119
102 function transition(x) { x[0] = 1.5; } 120 function transition(x) { x[0] = 1.5; }
103 121
104 var ignore = get_cow(); 122 var ignore = get_cow();
105 transition(ignore); // Handled by runtime. 123 transition(ignore); // Handled by runtime.
106 var a = get_cow(); 124 var a = get_cow();
107 var b = get_cow(); 125 var b = get_cow();
108 transition(a); // Handled by IC. 126 transition(a); // Handled by IC.
109 assertEquals(1.5, a[0]); 127 assertEquals(1.5, a[0]);
110 assertEquals(1, b[0]); 128 assertEquals(1, b[0]);
111 } else { 129 } else {
112 print("Test skipped because smi only arrays are not supported."); 130 print("Test skipped because smi only arrays are not supported.");
113 } 131 }
OLDNEW
« no previous file with comments | « test/mjsunit/elements-kind.js ('k') | test/mjsunit/elements-transition-and-store.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698