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 9235007: Handle single element array growth + transition in generic KeyedStoreIC (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase to tot Created 8 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 | Annotate | Revision Log
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 assertEquals(expected, getKind(obj), name_opt); 102 assertEquals(expected, getKind(obj), name_opt);
103 } 103 }
104 104
105 var me = {}; 105 var me = {};
106 assertKind(elements_kind.fast, me); 106 assertKind(elements_kind.fast, me);
107 me.dance = 0xD15C0; 107 me.dance = 0xD15C0;
108 me.drink = 0xC0C0A; 108 me.drink = 0xC0C0A;
109 assertKind(elements_kind.fast, me); 109 assertKind(elements_kind.fast, me);
110 110
111 if (support_smi_only_arrays) { 111 var too = [1,2,3];
112 var too = [1,2,3]; 112 assertKind(elements_kind.fast_smi_only, too);
113 assertKind(elements_kind.fast_smi_only, too); 113 too.dance = 0xD15C0;
114 too.dance = 0xD15C0; 114 too.drink = 0xC0C0A;
115 too.drink = 0xC0C0A; 115 assertKind(elements_kind.fast_smi_only, too);
116 assertKind(elements_kind.fast_smi_only, too);
117 }
118 116
119 // Make sure the element kind transitions from smionly when a non-smi is stored. 117 // Make sure the element kind transitions from smionly when a non-smi is stored.
120 var you = new Array(); 118 var you = new Array();
121 assertKind(elements_kind.fast_smi_only, you); 119 assertKind(elements_kind.fast_smi_only, you);
122 for (var i = 0; i < 1337; i++) { 120 for (var i = 0; i < 1337; i++) {
123 var val = i; 121 var val = i;
124 if (i == 1336) { 122 if (i == 1336) {
125 assertKind(elements_kind.fast_smi_only, you); 123 assertKind(elements_kind.fast_smi_only, you);
126 val = new Object(); 124 val = new Object();
127 } 125 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 %OptimizeFunctionOnNextCall(convert_mixed); 225 %OptimizeFunctionOnNextCall(convert_mixed);
228 convert_mixed(smis, 1, elements_kind.fast); 226 convert_mixed(smis, 1, elements_kind.fast);
229 convert_mixed(doubles, 1, elements_kind.fast); 227 convert_mixed(doubles, 1, elements_kind.fast);
230 assertTrue(%HaveSameMap(smis, doubles)); 228 assertTrue(%HaveSameMap(smis, doubles));
231 } 229 }
232 230
233 // Crankshaft support for smi-only elements in dynamic array literals. 231 // Crankshaft support for smi-only elements in dynamic array literals.
234 function get(foo) { return foo; } // Used to generate dynamic values. 232 function get(foo) { return foo; } // Used to generate dynamic values.
235 233
236 function crankshaft_test() { 234 function crankshaft_test() {
237 if (support_smi_only_arrays) { 235 var a1 = [get(1), get(2), get(3)];
238 var a1 = [get(1), get(2), get(3)]; 236 assertKind(elements_kind.fast_smi_only, a1);
239 assertKind(elements_kind.fast_smi_only, a1);
240 }
241 var a2 = new Array(get(1), get(2), get(3)); 237 var a2 = new Array(get(1), get(2), get(3));
242 assertKind(elements_kind.fast_smi_only, a2); 238 assertKind(elements_kind.fast_smi_only, a2);
243 var b = [get(1), get(2), get("three")]; 239 var b = [get(1), get(2), get("three")];
244 assertKind(elements_kind.fast, b); 240 assertKind(elements_kind.fast, b);
245 var c = [get(1), get(2), get(3.5)]; 241 var c = [get(1), get(2), get(3.5)];
246 if (support_smi_only_arrays) { 242 if (support_smi_only_arrays) {
247 assertKind(elements_kind.fast_double, c); 243 assertKind(elements_kind.fast_double, c);
244 } else {
245 assertKind(elements_kind.fast, c);
248 } 246 }
249 } 247 }
250 for (var i = 0; i < 3; i++) { 248 for (var i = 0; i < 3; i++) {
251 crankshaft_test(); 249 crankshaft_test();
252 } 250 }
253 %OptimizeFunctionOnNextCall(crankshaft_test); 251 %OptimizeFunctionOnNextCall(crankshaft_test);
254 crankshaft_test(); 252 crankshaft_test();
255 253
256 // Elements_kind transitions for arrays. 254 // Elements_kind transitions for arrays.
257 255
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 var a = ["foo", "bar"]; 333 var a = ["foo", "bar"];
336 assertKind(elements_kind.fast, a); 334 assertKind(elements_kind.fast, a);
337 var b = a.splice(0, 1); 335 var b = a.splice(0, 1);
338 assertKind(elements_kind.fast, b); 336 assertKind(elements_kind.fast, b);
339 var c = a.slice(0, 1); 337 var c = a.slice(0, 1);
340 assertKind(elements_kind.fast, c); 338 assertKind(elements_kind.fast, c);
341 } 339 }
342 340
343 // Throw away type information in the ICs for next stress run. 341 // Throw away type information in the ICs for next stress run.
344 gc(); 342 gc();
OLDNEW
« src/ia32/macro-assembler-ia32.h ('K') | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698