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

Side by Side Diff: test/mjsunit/array-feedback.js

Issue 141073006: Remove special ArrayCode CallIC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Disable Array() related tests. 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 | « src/x64/stub-cache-x64.cc ('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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 expected = elements_kind.fast; 83 expected = elements_kind.fast;
84 } 84 }
85 assertEquals(expected, getKind(obj), name_opt); 85 assertEquals(expected, getKind(obj), name_opt);
86 } 86 }
87 87
88 if (support_smi_only_arrays) { 88 if (support_smi_only_arrays) {
89 89
90 // Verify that basic elements kind feedback works for non-constructor 90 // Verify that basic elements kind feedback works for non-constructor
91 // array calls (as long as the call is made through an IC, and not 91 // array calls (as long as the call is made through an IC, and not
92 // a CallStub). 92 // a CallStub).
93 (function (){ 93 // (function (){
94 function create0() { 94 // function create0() {
95 return Array(); 95 // return Array();
96 } 96 // }
97 97
98 // Calls through ICs need warm up through uninitialized, then 98 // // Calls through ICs need warm up through uninitialized, then
99 // premonomorphic first. 99 // // premonomorphic first.
100 create0(); 100 // create0();
101 create0(); 101 // create0();
102 a = create0(); 102 // a = create0();
103 assertKind(elements_kind.fast_smi_only, a); 103 // assertKind(elements_kind.fast_smi_only, a);
104 a[0] = 3.5; 104 // a[0] = 3.5;
105 b = create0(); 105 // b = create0();
106 assertKind(elements_kind.fast_double, b); 106 // assertKind(elements_kind.fast_double, b);
107 107
108 function create1(arg) { 108 // function create1(arg) {
109 return Array(arg); 109 // return Array(arg);
110 } 110 // }
111 111
112 create1(0); 112 // create1(0);
113 create1(0); 113 // create1(0);
114 a = create1(0); 114 // a = create1(0);
115 assertFalse(isHoley(a)); 115 // assertFalse(isHoley(a));
116 assertKind(elements_kind.fast_smi_only, a); 116 // assertKind(elements_kind.fast_smi_only, a);
117 a[0] = "hello"; 117 // a[0] = "hello";
118 b = create1(10); 118 // b = create1(10);
119 assertTrue(isHoley(b)); 119 // assertTrue(isHoley(b));
120 assertKind(elements_kind.fast, b); 120 // assertKind(elements_kind.fast, b);
121 121
122 a = create1(100000); 122 // a = create1(100000);
123 assertKind(elements_kind.dictionary, a); 123 // assertKind(elements_kind.dictionary, a);
124 124
125 function create3(arg1, arg2, arg3) { 125 // function create3(arg1, arg2, arg3) {
126 return Array(arg1, arg2, arg3); 126 // return Array(arg1, arg2, arg3);
127 } 127 // }
128 128
129 create3(); 129 // create3();
130 create3(); 130 // create3();
131 a = create3(1,2,3); 131 // a = create3(1,2,3);
132 a[0] = 3.5; 132 // a[0] = 3.5;
133 b = create3(1,2,3); 133 // b = create3(1,2,3);
134 assertKind(elements_kind.fast_double, b); 134 // assertKind(elements_kind.fast_double, b);
135 assertFalse(isHoley(b)); 135 // assertFalse(isHoley(b));
136 })(); 136 // })();
137 137
138 138
139 // Verify that keyed calls work 139 // Verify that keyed calls work
140 (function (){ 140 // (function (){
141 function create0(name) { 141 // function create0(name) {
142 return this[name](); 142 // return this[name]();
143 } 143 // }
144 144
145 name = "Array"; 145 // name = "Array";
146 create0(name); 146 // create0(name);
147 create0(name); 147 // create0(name);
148 a = create0(name); 148 // a = create0(name);
149 a[0] = 3.5; 149 // a[0] = 3.5;
150 b = create0(name); 150 // b = create0(name);
151 assertKind(elements_kind.fast_double, b); 151 // assertKind(elements_kind.fast_double, b);
152 })(); 152 // })();
153 153
154 154
155 // Verify that the IC can't be spoofed by patching 155 // Verify that the IC can't be spoofed by patching
156 (function (){ 156 (function (){
157 function create0() { 157 function create0() {
158 return Array(); 158 return Array();
159 } 159 }
160 160
161 create0(); 161 create0();
162 create0(); 162 create0();
163 a = create0(); 163 a = create0();
164 assertKind(elements_kind.fast_smi_only, a); 164 assertKind(elements_kind.fast_smi_only, a);
165 var oldArray = this.Array; 165 var oldArray = this.Array;
166 this.Array = function() { return ["hi"]; }; 166 this.Array = function() { return ["hi"]; };
167 b = create0(); 167 b = create0();
168 assertEquals(["hi"], b); 168 assertEquals(["hi"], b);
169 this.Array = oldArray; 169 this.Array = oldArray;
170 })(); 170 })();
171 171
172 // Verify that calls are still made through an IC after crankshaft, 172 // Verify that calls are still made through an IC after crankshaft,
173 // though the type information is reset. 173 // though the type information is reset.
174 // TODO(mvstanton): instead, consume the type feedback gathered up 174 // TODO(mvstanton): instead, consume the type feedback gathered up
175 // until crankshaft time. 175 // until crankshaft time.
176 (function (){ 176 // (function (){
177 function create0() { 177 // function create0() {
178 return Array(); 178 // return Array();
179 } 179 // }
180 180
181 create0(); 181 // create0();
182 create0(); 182 // create0();
183 a = create0(); 183 // a = create0();
184 a[0] = 3.5; 184 // a[0] = 3.5;
185 %OptimizeFunctionOnNextCall(create0); 185 // %OptimizeFunctionOnNextCall(create0);
186 create0(); 186 // create0();
187 // This test only makes sense if crankshaft is allowed 187 // // This test only makes sense if crankshaft is allowed
188 if (4 != %GetOptimizationStatus(create0)) { 188 // if (4 != %GetOptimizationStatus(create0)) {
189 create0(); 189 // create0();
190 b = create0(); 190 // b = create0();
191 assertKind(elements_kind.fast_smi_only, b); 191 // assertKind(elements_kind.fast_smi_only, b);
192 b[0] = 3.5; 192 // b[0] = 3.5;
193 c = create0(); 193 // c = create0();
194 assertKind(elements_kind.fast_double, c); 194 // assertKind(elements_kind.fast_double, c);
195 assertOptimized(create0); 195 // assertOptimized(create0);
196 } 196 // }
197 })(); 197 // })();
198 198
199 199
200 // Verify that cross context calls work 200 // Verify that cross context calls work
201 (function (){ 201 (function (){
202 var realmA = Realm.current(); 202 var realmA = Realm.current();
203 var realmB = Realm.create(); 203 var realmB = Realm.create();
204 assertEquals(0, realmA); 204 assertEquals(0, realmA);
205 assertEquals(1, realmB); 205 assertEquals(1, realmB);
206 206
207 function instanceof_check(type) { 207 function instanceof_check(type) {
208 assertTrue(type() instanceof type); 208 assertTrue(type() instanceof type);
209 assertTrue(type(5) instanceof type); 209 assertTrue(type(5) instanceof type);
210 assertTrue(type(1,2,3) instanceof type); 210 assertTrue(type(1,2,3) instanceof type);
211 } 211 }
212 212
213 var realmBArray = Realm.eval(realmB, "Array"); 213 var realmBArray = Realm.eval(realmB, "Array");
214 instanceof_check(Array); 214 instanceof_check(Array);
215 instanceof_check(Array); 215 instanceof_check(Array);
216 instanceof_check(Array); 216 instanceof_check(Array);
217 instanceof_check(realmBArray); 217 instanceof_check(realmBArray);
218 instanceof_check(realmBArray); 218 instanceof_check(realmBArray);
219 instanceof_check(realmBArray); 219 instanceof_check(realmBArray);
220 })(); 220 })();
221 } 221 }
OLDNEW
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698