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

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

Issue 19776006: Fix %NeverOptimizeFunction runtime call. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add assert for safety. Created 7 years, 5 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/compiler/inline-arguments.js ('k') | test/mjsunit/elide-double-hole-check-9.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
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 assertEquals(i + 10, a); 163 assertEquals(i + 10, a);
164 } 164 }
165 } 165 }
166 var smi_only = new Array(1, 2, 3); 166 var smi_only = new Array(1, 2, 3);
167 assertKind(elements_kind.fast_smi_only, smi_only); 167 assertKind(elements_kind.fast_smi_only, smi_only);
168 for (var i = 0; i < 3; i++) monomorphic(smi_only); 168 for (var i = 0; i < 3; i++) monomorphic(smi_only);
169 %OptimizeFunctionOnNextCall(monomorphic); 169 %OptimizeFunctionOnNextCall(monomorphic);
170 monomorphic(smi_only); 170 monomorphic(smi_only);
171 171
172 if (support_smi_only_arrays) { 172 if (support_smi_only_arrays) {
173 %NeverOptimizeFunction(construct_smis);
173 function construct_smis() { 174 function construct_smis() {
174 %NeverOptimize();
175 var a = [0, 0, 0]; 175 var a = [0, 0, 0];
176 a[0] = 0; // Send the COW array map to the steak house. 176 a[0] = 0; // Send the COW array map to the steak house.
177 assertKind(elements_kind.fast_smi_only, a); 177 assertKind(elements_kind.fast_smi_only, a);
178 return a; 178 return a;
179 } 179 }
180 %NeverOptimizeFunction(construct_doubles);
180 function construct_doubles() { 181 function construct_doubles() {
181 %NeverOptimize();
182 var a = construct_smis(); 182 var a = construct_smis();
183 a[0] = 1.5; 183 a[0] = 1.5;
184 assertKind(elements_kind.fast_double, a); 184 assertKind(elements_kind.fast_double, a);
185 return a; 185 return a;
186 } 186 }
187 %NeverOptimizeFunction(construct_objects);
187 function construct_objects() { 188 function construct_objects() {
188 %NeverOptimize();
189 var a = construct_smis(); 189 var a = construct_smis();
190 a[0] = "one"; 190 a[0] = "one";
191 assertKind(elements_kind.fast, a); 191 assertKind(elements_kind.fast, a);
192 return a; 192 return a;
193 } 193 }
194 194
195 // Test crankshafted transition SMI->DOUBLE. 195 // Test crankshafted transition SMI->DOUBLE.
196 %NeverOptimizeFunction(convert_to_double);
196 function convert_to_double(array) { 197 function convert_to_double(array) {
197 %NeverOptimize();
198 array[1] = 2.5; 198 array[1] = 2.5;
199 assertKind(elements_kind.fast_double, array); 199 assertKind(elements_kind.fast_double, array);
200 assertEquals(2.5, array[1]); 200 assertEquals(2.5, array[1]);
201 } 201 }
202 var smis = construct_smis(); 202 var smis = construct_smis();
203 for (var i = 0; i < 3; i++) convert_to_double(smis); 203 for (var i = 0; i < 3; i++) convert_to_double(smis);
204 %OptimizeFunctionOnNextCall(convert_to_double); 204 %OptimizeFunctionOnNextCall(convert_to_double);
205 smis = construct_smis(); 205 smis = construct_smis();
206 convert_to_double(smis); 206 convert_to_double(smis);
207 // Test crankshafted transitions SMI->FAST and DOUBLE->FAST. 207 // Test crankshafted transitions SMI->FAST and DOUBLE->FAST.
208 %NeverOptimizeFunction(convert_to_fast);
208 function convert_to_fast(array) { 209 function convert_to_fast(array) {
209 %NeverOptimize();
210 array[1] = "two"; 210 array[1] = "two";
211 assertKind(elements_kind.fast, array); 211 assertKind(elements_kind.fast, array);
212 assertEquals("two", array[1]); 212 assertEquals("two", array[1]);
213 } 213 }
214 smis = construct_smis(); 214 smis = construct_smis();
215 for (var i = 0; i < 3; i++) convert_to_fast(smis); 215 for (var i = 0; i < 3; i++) convert_to_fast(smis);
216 var doubles = construct_doubles(); 216 var doubles = construct_doubles();
217 for (var i = 0; i < 3; i++) convert_to_fast(doubles); 217 for (var i = 0; i < 3; i++) convert_to_fast(doubles);
218 smis = construct_smis(); 218 smis = construct_smis();
219 doubles = construct_doubles(); 219 doubles = construct_doubles();
220 %OptimizeFunctionOnNextCall(convert_to_fast); 220 %OptimizeFunctionOnNextCall(convert_to_fast);
221 convert_to_fast(smis); 221 convert_to_fast(smis);
222 convert_to_fast(doubles); 222 convert_to_fast(doubles);
223 // Test transition chain SMI->DOUBLE->FAST (crankshafted function will 223 // Test transition chain SMI->DOUBLE->FAST (crankshafted function will
224 // transition to FAST directly). 224 // transition to FAST directly).
225 %NeverOptimizeFunction(convert_mixed);
225 function convert_mixed(array, value, kind) { 226 function convert_mixed(array, value, kind) {
226 %NeverOptimize();
227 array[1] = value; 227 array[1] = value;
228 assertKind(kind, array); 228 assertKind(kind, array);
229 assertEquals(value, array[1]); 229 assertEquals(value, array[1]);
230 } 230 }
231 smis = construct_smis(); 231 smis = construct_smis();
232 for (var i = 0; i < 3; i++) { 232 for (var i = 0; i < 3; i++) {
233 convert_mixed(smis, 1.5, elements_kind.fast_double); 233 convert_mixed(smis, 1.5, elements_kind.fast_double);
234 } 234 }
235 doubles = construct_doubles(); 235 doubles = construct_doubles();
236 for (var i = 0; i < 3; i++) { 236 for (var i = 0; i < 3; i++) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 var a = ["foo", "bar"]; 350 var a = ["foo", "bar"];
351 assertKind(elements_kind.fast, a); 351 assertKind(elements_kind.fast, a);
352 var b = a.splice(0, 1); 352 var b = a.splice(0, 1);
353 assertKind(elements_kind.fast, b); 353 assertKind(elements_kind.fast, b);
354 var c = a.slice(0, 1); 354 var c = a.slice(0, 1);
355 assertKind(elements_kind.fast, c); 355 assertKind(elements_kind.fast, c);
356 } 356 }
357 357
358 // Throw away type information in the ICs for next stress run. 358 // Throw away type information in the ICs for next stress run.
359 gc(); 359 gc();
OLDNEW
« no previous file with comments | « test/mjsunit/compiler/inline-arguments.js ('k') | test/mjsunit/elide-double-hole-check-9.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698