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

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

Issue 8230008: Make elements_kind map transition test conditional on smi element support (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | « 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 crankshaft_test(); 202 crankshaft_test();
203 } 203 }
204 %OptimizeFunctionOnNextCall(crankshaft_test); 204 %OptimizeFunctionOnNextCall(crankshaft_test);
205 crankshaft_test(); 205 crankshaft_test();
206 206
207 // Elements_kind transitions for arrays. 207 // Elements_kind transitions for arrays.
208 208
209 // A map can have three different elements_kind transitions: SMI->DOUBLE, 209 // A map can have three different elements_kind transitions: SMI->DOUBLE,
210 // DOUBLE->OBJECT, and SMI->OBJECT. No matter in which order these three are 210 // DOUBLE->OBJECT, and SMI->OBJECT. No matter in which order these three are
211 // created, they must always end up with the same FAST map. 211 // created, they must always end up with the same FAST map.
212 // Preparation: create one pair of identical objects for each case. 212
213 var a = [1, 2, 3]; 213 // This test is meaningless without FAST_SMI_ONLY_ELEMENTS.
214 var b = [1, 2, 3]; 214 if (support_smi_only_arrays) {
215 assertTrue(%HaveSameMap(a, b)); 215 // Preparation: create one pair of identical objects for each case.
216 assertKind(element_kind.fast_smi_only_elements, a); 216 var a = [1, 2, 3];
217 var c = [1, 2, 3]; 217 var b = [1, 2, 3];
218 c["case2"] = true; 218 assertTrue(%HaveSameMap(a, b));
219 var d = [1, 2, 3]; 219 assertKind(element_kind.fast_smi_only_elements, a);
220 d["case2"] = true; 220 var c = [1, 2, 3];
221 assertTrue(%HaveSameMap(c, d)); 221 c["case2"] = true;
222 assertFalse(%HaveSameMap(a, c)); 222 var d = [1, 2, 3];
223 assertKind(element_kind.fast_smi_only_elements, c); 223 d["case2"] = true;
224 var e = [1, 2, 3]; 224 assertTrue(%HaveSameMap(c, d));
225 e["case3"] = true; 225 assertFalse(%HaveSameMap(a, c));
226 var f = [1, 2, 3]; 226 assertKind(element_kind.fast_smi_only_elements, c);
227 f["case3"] = true; 227 var e = [1, 2, 3];
228 assertTrue(%HaveSameMap(e, f)); 228 e["case3"] = true;
229 assertFalse(%HaveSameMap(a, e)); 229 var f = [1, 2, 3];
230 assertFalse(%HaveSameMap(c, e)); 230 f["case3"] = true;
231 assertKind(element_kind.fast_smi_only_elements, e); 231 assertTrue(%HaveSameMap(e, f));
232 // Case 1: SMI->DOUBLE, DOUBLE->OBJECT, SMI->OBJECT. 232 assertFalse(%HaveSameMap(a, e));
233 a[0] = 1.5; 233 assertFalse(%HaveSameMap(c, e));
234 assertKind(element_kind.fast_double_elements, a); 234 assertKind(element_kind.fast_smi_only_elements, e);
235 a[0] = "foo"; 235 // Case 1: SMI->DOUBLE, DOUBLE->OBJECT, SMI->OBJECT.
236 assertKind(element_kind.fast_elements, a); 236 a[0] = 1.5;
237 b[0] = "bar"; 237 assertKind(element_kind.fast_double_elements, a);
238 assertTrue(%HaveSameMap(a, b)); 238 a[0] = "foo";
239 // Case 2: SMI->DOUBLE, SMI->OBJECT, DOUBLE->OBJECT. 239 assertKind(element_kind.fast_elements, a);
240 c[0] = 1.5; 240 b[0] = "bar";
241 assertKind(element_kind.fast_double_elements, c); 241 assertTrue(%HaveSameMap(a, b));
242 assertFalse(%HaveSameMap(c, d)); 242 // Case 2: SMI->DOUBLE, SMI->OBJECT, DOUBLE->OBJECT.
243 d[0] = "foo"; 243 c[0] = 1.5;
244 assertKind(element_kind.fast_elements, d); 244 assertKind(element_kind.fast_double_elements, c);
245 assertFalse(%HaveSameMap(c, d)); 245 assertFalse(%HaveSameMap(c, d));
246 c[0] = "bar"; 246 d[0] = "foo";
247 assertTrue(%HaveSameMap(c, d)); 247 assertKind(element_kind.fast_elements, d);
248 // Case 3: SMI->OBJECT, SMI->DOUBLE, DOUBLE->OBJECT. 248 assertFalse(%HaveSameMap(c, d));
249 e[0] = "foo"; 249 c[0] = "bar";
250 assertKind(element_kind.fast_elements, e); 250 assertTrue(%HaveSameMap(c, d));
251 assertFalse(%HaveSameMap(e, f)); 251 // Case 3: SMI->OBJECT, SMI->DOUBLE, DOUBLE->OBJECT.
252 f[0] = 1.5; 252 e[0] = "foo";
253 assertKind(element_kind.fast_double_elements, f); 253 assertKind(element_kind.fast_elements, e);
254 assertFalse(%HaveSameMap(e, f)); 254 assertFalse(%HaveSameMap(e, f));
255 f[0] = "bar"; 255 f[0] = 1.5;
256 assertKind(element_kind.fast_elements, f); 256 assertKind(element_kind.fast_double_elements, f);
257 assertTrue(%HaveSameMap(e, f)); 257 assertFalse(%HaveSameMap(e, f));
258 f[0] = "bar";
259 assertKind(element_kind.fast_elements, f);
260 assertTrue(%HaveSameMap(e, f));
261 }
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