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/cctest/test-types.cc

Issue 16361015: Migrate Compare ICs to new type rep (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 years, 6 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/cctest/test-compare-nil-ic-stub.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 class HandlifiedTypes { 44 class HandlifiedTypes {
45 public: 45 public:
46 explicit HandlifiedTypes(Isolate* isolate) : 46 explicit HandlifiedTypes(Isolate* isolate) :
47 None(Type::None(), isolate), 47 None(Type::None(), isolate),
48 Any(Type::Any(), isolate), 48 Any(Type::Any(), isolate),
49 Oddball(Type::Oddball(), isolate), 49 Oddball(Type::Oddball(), isolate),
50 Boolean(Type::Boolean(), isolate), 50 Boolean(Type::Boolean(), isolate),
51 Null(Type::Null(), isolate), 51 Null(Type::Null(), isolate),
52 Undefined(Type::Undefined(), isolate), 52 Undefined(Type::Undefined(), isolate),
53 Number(Type::Number(), isolate), 53 Number(Type::Number(), isolate),
54 Smi(Type::Smi(), isolate), 54 Integer31(Type::Integer31(), isolate),
55 Integer32(Type::Integer32(), isolate),
55 Double(Type::Double(), isolate), 56 Double(Type::Double(), isolate),
56 Name(Type::Name(), isolate), 57 Name(Type::Name(), isolate),
57 UniqueName(Type::UniqueName(), isolate), 58 UniqueName(Type::UniqueName(), isolate),
58 String(Type::String(), isolate), 59 String(Type::String(), isolate),
59 InternalizedString(Type::InternalizedString(), isolate), 60 InternalizedString(Type::InternalizedString(), isolate),
60 Symbol(Type::Symbol(), isolate), 61 Symbol(Type::Symbol(), isolate),
61 Receiver(Type::Receiver(), isolate), 62 Receiver(Type::Receiver(), isolate),
62 Object(Type::Object(), isolate), 63 Object(Type::Object(), isolate),
63 Array(Type::Array(), isolate), 64 Array(Type::Array(), isolate),
64 Function(Type::Function(), isolate), 65 Function(Type::Function(), isolate),
65 Proxy(Type::Proxy(), isolate), 66 Proxy(Type::Proxy(), isolate),
66 object_map(isolate->factory()->NewMap(JS_OBJECT_TYPE, 3 * kPointerSize)), 67 object_map(isolate->factory()->NewMap(JS_OBJECT_TYPE, 3 * kPointerSize)),
67 array_map(isolate->factory()->NewMap(JS_ARRAY_TYPE, 4 * kPointerSize)), 68 array_map(isolate->factory()->NewMap(JS_ARRAY_TYPE, 4 * kPointerSize)),
68 isolate_(isolate) { 69 isolate_(isolate) {
69 smi = handle(Smi::FromInt(666), isolate); 70 smi = handle(Smi::FromInt(666), isolate);
70 object1 = isolate->factory()->NewJSObjectFromMap(object_map); 71 object1 = isolate->factory()->NewJSObjectFromMap(object_map);
71 object2 = isolate->factory()->NewJSObjectFromMap(object_map); 72 object2 = isolate->factory()->NewJSObjectFromMap(object_map);
72 array = isolate->factory()->NewJSArray(20); 73 array = isolate->factory()->NewJSArray(20);
73 ObjectClass = handle(Type::Class(object_map), isolate); 74 ObjectClass = handle(Type::Class(object_map), isolate);
74 ArrayClass = handle(Type::Class(array_map), isolate); 75 ArrayClass = handle(Type::Class(array_map), isolate);
75 SmiConstant = handle(Type::Constant(smi, isolate), isolate); 76 Integer31Constant = handle(Type::Constant(smi, isolate), isolate);
76 ObjectConstant1 = handle(Type::Constant(object1), isolate); 77 ObjectConstant1 = handle(Type::Constant(object1), isolate);
77 ObjectConstant2 = handle(Type::Constant(object2), isolate); 78 ObjectConstant2 = handle(Type::Constant(object2), isolate);
78 ArrayConstant = handle(Type::Constant(array), isolate); 79 ArrayConstant = handle(Type::Constant(array), isolate);
79 } 80 }
80 81
81 Handle<Type> None; 82 Handle<Type> None;
82 Handle<Type> Any; 83 Handle<Type> Any;
83 Handle<Type> Oddball; 84 Handle<Type> Oddball;
84 Handle<Type> Boolean; 85 Handle<Type> Boolean;
85 Handle<Type> Null; 86 Handle<Type> Null;
86 Handle<Type> Undefined; 87 Handle<Type> Undefined;
87 Handle<Type> Number; 88 Handle<Type> Number;
88 Handle<Type> Smi; 89 Handle<Type> Integer31;
90 Handle<Type> Integer32;
89 Handle<Type> Double; 91 Handle<Type> Double;
90 Handle<Type> Name; 92 Handle<Type> Name;
91 Handle<Type> UniqueName; 93 Handle<Type> UniqueName;
92 Handle<Type> String; 94 Handle<Type> String;
93 Handle<Type> InternalizedString; 95 Handle<Type> InternalizedString;
94 Handle<Type> Symbol; 96 Handle<Type> Symbol;
95 Handle<Type> Receiver; 97 Handle<Type> Receiver;
96 Handle<Type> Object; 98 Handle<Type> Object;
97 Handle<Type> Array; 99 Handle<Type> Array;
98 Handle<Type> Function; 100 Handle<Type> Function;
99 Handle<Type> Proxy; 101 Handle<Type> Proxy;
100 102
101 Handle<Type> ObjectClass; 103 Handle<Type> ObjectClass;
102 Handle<Type> ArrayClass; 104 Handle<Type> ArrayClass;
103 105
104 Handle<Type> SmiConstant; 106 Handle<Type> Integer31Constant;
105 Handle<Type> ObjectConstant1; 107 Handle<Type> ObjectConstant1;
106 Handle<Type> ObjectConstant2; 108 Handle<Type> ObjectConstant2;
107 Handle<Type> ArrayConstant; 109 Handle<Type> ArrayConstant;
108 110
109 Handle<Map> object_map; 111 Handle<Map> object_map;
110 Handle<Map> array_map; 112 Handle<Map> array_map;
111 113
112 Handle<v8::internal::Smi> smi; 114 Handle<v8::internal::Smi> smi;
113 Handle<JSObject> object1; 115 Handle<JSObject> object1;
114 Handle<JSObject> object2; 116 Handle<JSObject> object2;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 CHECK(*T.array_map == AsClass(*T.ArrayClass)); 163 CHECK(*T.array_map == AsClass(*T.ArrayClass));
162 } 164 }
163 165
164 166
165 TEST(Constant) { 167 TEST(Constant) {
166 CcTest::InitializeVM(); 168 CcTest::InitializeVM();
167 Isolate* isolate = Isolate::Current(); 169 Isolate* isolate = Isolate::Current();
168 HandleScope scope(isolate); 170 HandleScope scope(isolate);
169 HandlifiedTypes T(isolate); 171 HandlifiedTypes T(isolate);
170 172
171 CHECK(IsConstant(*T.SmiConstant)); 173 CHECK(IsConstant(*T.Integer31Constant));
172 CHECK(IsConstant(*T.ObjectConstant1)); 174 CHECK(IsConstant(*T.ObjectConstant1));
173 CHECK(IsConstant(*T.ObjectConstant2)); 175 CHECK(IsConstant(*T.ObjectConstant2));
174 CHECK(IsConstant(*T.ArrayConstant)); 176 CHECK(IsConstant(*T.ArrayConstant));
175 177
176 CHECK(*T.smi == AsConstant(*T.SmiConstant)); 178 CHECK(*T.smi == AsConstant(*T.Integer31Constant));
177 CHECK(*T.object1 == AsConstant(*T.ObjectConstant1)); 179 CHECK(*T.object1 == AsConstant(*T.ObjectConstant1));
178 CHECK(*T.object2 == AsConstant(*T.ObjectConstant2)); 180 CHECK(*T.object2 == AsConstant(*T.ObjectConstant2));
179 CHECK(*T.object1 != AsConstant(*T.ObjectConstant2)); 181 CHECK(*T.object1 != AsConstant(*T.ObjectConstant2));
180 CHECK(*T.array == AsConstant(*T.ArrayConstant)); 182 CHECK(*T.array == AsConstant(*T.ArrayConstant));
181 } 183 }
182 184
183 185
184 static void CheckSub(Handle<Type> type1, Handle<Type> type2) { 186 static void CheckSub(Handle<Type> type1, Handle<Type> type2) {
185 CHECK(type1->Is(type2)); 187 CHECK(type1->Is(type2));
186 CHECK(!type2->Is(type1)); 188 CHECK(!type2->Is(type1));
(...skipping 30 matching lines...) Expand all
217 219
218 CheckSub(T.Oddball, T.Any); 220 CheckSub(T.Oddball, T.Any);
219 CheckSub(T.Boolean, T.Oddball); 221 CheckSub(T.Boolean, T.Oddball);
220 CheckSub(T.Null, T.Oddball); 222 CheckSub(T.Null, T.Oddball);
221 CheckSub(T.Undefined, T.Oddball); 223 CheckSub(T.Undefined, T.Oddball);
222 CheckUnordered(T.Boolean, T.Null); 224 CheckUnordered(T.Boolean, T.Null);
223 CheckUnordered(T.Undefined, T.Null); 225 CheckUnordered(T.Undefined, T.Null);
224 CheckUnordered(T.Boolean, T.Undefined); 226 CheckUnordered(T.Boolean, T.Undefined);
225 227
226 CheckSub(T.Number, T.Any); 228 CheckSub(T.Number, T.Any);
227 CheckSub(T.Smi, T.Number); 229 CheckSub(T.Integer31, T.Number);
230 CheckSub(T.Integer32, T.Number);
228 CheckSub(T.Double, T.Number); 231 CheckSub(T.Double, T.Number);
229 CheckUnordered(T.Smi, T.Double); 232 CheckSub(T.Integer31, T.Integer32);
233 CheckUnordered(T.Integer31, T.Double);
234 CheckUnordered(T.Integer32, T.Double);
230 235
231 CheckSub(T.Name, T.Any); 236 CheckSub(T.Name, T.Any);
232 CheckSub(T.UniqueName, T.Any); 237 CheckSub(T.UniqueName, T.Any);
233 CheckSub(T.UniqueName, T.Name); 238 CheckSub(T.UniqueName, T.Name);
234 CheckSub(T.String, T.Name); 239 CheckSub(T.String, T.Name);
235 CheckSub(T.InternalizedString, T.String); 240 CheckSub(T.InternalizedString, T.String);
236 CheckSub(T.InternalizedString, T.UniqueName); 241 CheckSub(T.InternalizedString, T.UniqueName);
237 CheckSub(T.InternalizedString, T.Name); 242 CheckSub(T.InternalizedString, T.Name);
238 CheckSub(T.Symbol, T.UniqueName); 243 CheckSub(T.Symbol, T.UniqueName);
239 CheckSub(T.Symbol, T.Name); 244 CheckSub(T.Symbol, T.Name);
240 CheckUnordered(T.String, T.UniqueName); 245 CheckUnordered(T.String, T.UniqueName);
241 CheckUnordered(T.String, T.Symbol); 246 CheckUnordered(T.String, T.Symbol);
242 CheckUnordered(T.InternalizedString, T.Symbol); 247 CheckUnordered(T.InternalizedString, T.Symbol);
243 248
244 CheckSub(T.Receiver, T.Any); 249 CheckSub(T.Receiver, T.Any);
245 CheckSub(T.Object, T.Any); 250 CheckSub(T.Object, T.Any);
246 CheckSub(T.Object, T.Receiver); 251 CheckSub(T.Object, T.Receiver);
247 CheckSub(T.Array, T.Object); 252 CheckSub(T.Array, T.Object);
248 CheckSub(T.Function, T.Object); 253 CheckSub(T.Function, T.Object);
249 CheckSub(T.Proxy, T.Receiver); 254 CheckSub(T.Proxy, T.Receiver);
250 CheckUnordered(T.Object, T.Proxy); 255 CheckUnordered(T.Object, T.Proxy);
251 CheckUnordered(T.Array, T.Function); 256 CheckUnordered(T.Array, T.Function);
252 257
253 // Structured subtyping 258 // Structured subtyping
254 CheckSub(T.ObjectClass, T.Object); 259 CheckSub(T.ObjectClass, T.Object);
255 CheckSub(T.ArrayClass, T.Object); 260 CheckSub(T.ArrayClass, T.Object);
256 CheckUnordered(T.ObjectClass, T.ArrayClass); 261 CheckUnordered(T.ObjectClass, T.ArrayClass);
257 262
258 CheckSub(T.SmiConstant, T.Smi); 263 CheckSub(T.Integer31Constant, T.Integer31);
259 CheckSub(T.SmiConstant, T.Number); 264 CheckSub(T.Integer31Constant, T.Integer32);
265 CheckSub(T.Integer31Constant, T.Number);
260 CheckSub(T.ObjectConstant1, T.Object); 266 CheckSub(T.ObjectConstant1, T.Object);
261 CheckSub(T.ObjectConstant2, T.Object); 267 CheckSub(T.ObjectConstant2, T.Object);
262 CheckSub(T.ArrayConstant, T.Object); 268 CheckSub(T.ArrayConstant, T.Object);
263 CheckSub(T.ArrayConstant, T.Array); 269 CheckSub(T.ArrayConstant, T.Array);
264 CheckUnordered(T.ObjectConstant1, T.ObjectConstant2); 270 CheckUnordered(T.ObjectConstant1, T.ObjectConstant2);
265 CheckUnordered(T.ObjectConstant1, T.ArrayConstant); 271 CheckUnordered(T.ObjectConstant1, T.ArrayConstant);
266 272
267 CheckUnordered(T.ObjectConstant1, T.ObjectClass); 273 CheckUnordered(T.ObjectConstant1, T.ObjectClass);
268 CheckUnordered(T.ObjectConstant2, T.ObjectClass); 274 CheckUnordered(T.ObjectConstant2, T.ObjectClass);
269 CheckUnordered(T.ObjectConstant1, T.ArrayClass); 275 CheckUnordered(T.ObjectConstant1, T.ArrayClass);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 307
302 CheckOverlap(T.Oddball, T.Any); 308 CheckOverlap(T.Oddball, T.Any);
303 CheckOverlap(T.Boolean, T.Oddball); 309 CheckOverlap(T.Boolean, T.Oddball);
304 CheckOverlap(T.Null, T.Oddball); 310 CheckOverlap(T.Null, T.Oddball);
305 CheckOverlap(T.Undefined, T.Oddball); 311 CheckOverlap(T.Undefined, T.Oddball);
306 CheckDisjoint(T.Boolean, T.Null); 312 CheckDisjoint(T.Boolean, T.Null);
307 CheckDisjoint(T.Undefined, T.Null); 313 CheckDisjoint(T.Undefined, T.Null);
308 CheckDisjoint(T.Boolean, T.Undefined); 314 CheckDisjoint(T.Boolean, T.Undefined);
309 315
310 CheckOverlap(T.Number, T.Any); 316 CheckOverlap(T.Number, T.Any);
311 CheckOverlap(T.Smi, T.Number); 317 CheckOverlap(T.Integer31, T.Number);
312 CheckOverlap(T.Double, T.Number); 318 CheckOverlap(T.Double, T.Number);
313 CheckDisjoint(T.Smi, T.Double); 319 CheckDisjoint(T.Integer32, T.Double);
314 320
315 CheckOverlap(T.Name, T.Any); 321 CheckOverlap(T.Name, T.Any);
316 CheckOverlap(T.UniqueName, T.Any); 322 CheckOverlap(T.UniqueName, T.Any);
317 CheckOverlap(T.UniqueName, T.Name); 323 CheckOverlap(T.UniqueName, T.Name);
318 CheckOverlap(T.String, T.Name); 324 CheckOverlap(T.String, T.Name);
319 CheckOverlap(T.InternalizedString, T.String); 325 CheckOverlap(T.InternalizedString, T.String);
320 CheckOverlap(T.InternalizedString, T.UniqueName); 326 CheckOverlap(T.InternalizedString, T.UniqueName);
321 CheckOverlap(T.InternalizedString, T.Name); 327 CheckOverlap(T.InternalizedString, T.Name);
322 CheckOverlap(T.Symbol, T.UniqueName); 328 CheckOverlap(T.Symbol, T.UniqueName);
323 CheckOverlap(T.Symbol, T.Name); 329 CheckOverlap(T.Symbol, T.Name);
324 CheckOverlap(T.String, T.UniqueName); 330 CheckOverlap(T.String, T.UniqueName);
325 CheckDisjoint(T.String, T.Symbol); 331 CheckDisjoint(T.String, T.Symbol);
326 CheckDisjoint(T.InternalizedString, T.Symbol); 332 CheckDisjoint(T.InternalizedString, T.Symbol);
327 333
328 CheckOverlap(T.Receiver, T.Any); 334 CheckOverlap(T.Receiver, T.Any);
329 CheckOverlap(T.Object, T.Any); 335 CheckOverlap(T.Object, T.Any);
330 CheckOverlap(T.Object, T.Receiver); 336 CheckOverlap(T.Object, T.Receiver);
331 CheckOverlap(T.Array, T.Object); 337 CheckOverlap(T.Array, T.Object);
332 CheckOverlap(T.Function, T.Object); 338 CheckOverlap(T.Function, T.Object);
333 CheckOverlap(T.Proxy, T.Receiver); 339 CheckOverlap(T.Proxy, T.Receiver);
334 CheckDisjoint(T.Object, T.Proxy); 340 CheckDisjoint(T.Object, T.Proxy);
335 CheckDisjoint(T.Array, T.Function); 341 CheckDisjoint(T.Array, T.Function);
336 342
337 CheckOverlap(T.ObjectClass, T.Object); 343 CheckOverlap(T.ObjectClass, T.Object);
338 CheckOverlap(T.ArrayClass, T.Object); 344 CheckOverlap(T.ArrayClass, T.Object);
339 CheckOverlap(T.ObjectClass, T.ObjectClass); 345 CheckOverlap(T.ObjectClass, T.ObjectClass);
340 CheckOverlap(T.ArrayClass, T.ArrayClass); 346 CheckOverlap(T.ArrayClass, T.ArrayClass);
341 CheckDisjoint(T.ObjectClass, T.ArrayClass); 347 CheckDisjoint(T.ObjectClass, T.ArrayClass);
342 348
343 CheckOverlap(T.SmiConstant, T.Smi); 349 CheckOverlap(T.Integer31Constant, T.Integer31);
344 CheckOverlap(T.SmiConstant, T.Number); 350 CheckOverlap(T.Integer31Constant, T.Integer32);
345 CheckDisjoint(T.SmiConstant, T.Double); 351 CheckOverlap(T.Integer31Constant, T.Number);
352 CheckDisjoint(T.Integer31Constant, T.Double);
346 CheckOverlap(T.ObjectConstant1, T.Object); 353 CheckOverlap(T.ObjectConstant1, T.Object);
347 CheckOverlap(T.ObjectConstant2, T.Object); 354 CheckOverlap(T.ObjectConstant2, T.Object);
348 CheckOverlap(T.ArrayConstant, T.Object); 355 CheckOverlap(T.ArrayConstant, T.Object);
349 CheckOverlap(T.ArrayConstant, T.Array); 356 CheckOverlap(T.ArrayConstant, T.Array);
350 CheckOverlap(T.ObjectConstant1, T.ObjectConstant1); 357 CheckOverlap(T.ObjectConstant1, T.ObjectConstant1);
351 CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2); 358 CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2);
352 CheckDisjoint(T.ObjectConstant1, T.ArrayConstant); 359 CheckDisjoint(T.ObjectConstant1, T.ArrayConstant);
353 360
354 CheckDisjoint(T.ObjectConstant1, T.ObjectClass); 361 CheckDisjoint(T.ObjectConstant1, T.ObjectClass);
355 CheckDisjoint(T.ObjectConstant2, T.ObjectClass); 362 CheckDisjoint(T.ObjectConstant2, T.ObjectClass);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayConstant), T.Array); 425 CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayConstant), T.Array);
419 CheckDisjoint(T.Union(T.ObjectConstant1, T.ArrayConstant), T.Number); 426 CheckDisjoint(T.Union(T.ObjectConstant1, T.ArrayConstant), T.Number);
420 CheckDisjoint(T.Union(T.ObjectConstant1, T.ArrayConstant), T.ObjectClass); 427 CheckDisjoint(T.Union(T.ObjectConstant1, T.ArrayConstant), T.ObjectClass);
421 428
422 // Bitset-class 429 // Bitset-class
423 CHECK(IsBitset(Type::Union(T.ObjectClass, T.Object))); 430 CHECK(IsBitset(Type::Union(T.ObjectClass, T.Object)));
424 CHECK(IsUnion(Type::Union(T.ObjectClass, T.Number))); 431 CHECK(IsUnion(Type::Union(T.ObjectClass, T.Number)));
425 432
426 CheckEqual(T.Union(T.ObjectClass, T.Object), T.Object); 433 CheckEqual(T.Union(T.ObjectClass, T.Object), T.Object);
427 CheckSub(T.Union(T.ObjectClass, T.Number), T.Any); 434 CheckSub(T.Union(T.ObjectClass, T.Number), T.Any);
428 CheckSub(T.Union(T.ObjectClass, T.Smi), T.Union(T.Object, T.Number)); 435 CheckSub(T.Union(T.ObjectClass, T.Integer31), T.Union(T.Object, T.Number));
429 CheckSub(T.Union(T.ObjectClass, T.Array), T.Object); 436 CheckSub(T.Union(T.ObjectClass, T.Array), T.Object);
430 CheckUnordered(T.Union(T.ObjectClass, T.String), T.Array); 437 CheckUnordered(T.Union(T.ObjectClass, T.String), T.Array);
431 CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object); 438 CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object);
432 CheckDisjoint(T.Union(T.ObjectClass, T.String), T.Number); 439 CheckDisjoint(T.Union(T.ObjectClass, T.String), T.Number);
433 440
434 // Bitset-constant 441 // Bitset-constant
435 CHECK(IsBitset(Type::Union(T.SmiConstant, T.Number))); 442 CHECK(IsBitset(Type::Union(T.Integer31Constant, T.Number)));
436 CHECK(IsBitset(Type::Union(T.ObjectConstant1, T.Object))); 443 CHECK(IsBitset(Type::Union(T.ObjectConstant1, T.Object)));
437 CHECK(IsUnion(Type::Union(T.ObjectConstant2, T.Number))); 444 CHECK(IsUnion(Type::Union(T.ObjectConstant2, T.Number)));
438 445
439 CheckEqual(T.Union(T.SmiConstant, T.Number), T.Number); 446 CheckEqual(T.Union(T.Integer31Constant, T.Number), T.Number);
440 CheckEqual(T.Union(T.ObjectConstant1, T.Object), T.Object); 447 CheckEqual(T.Union(T.ObjectConstant1, T.Object), T.Object);
441 CheckSub(T.Union(T.ObjectConstant1, T.Number), T.Any); 448 CheckSub(T.Union(T.ObjectConstant1, T.Number), T.Any);
442 CheckSub(T.Union(T.ObjectConstant1, T.Smi), T.Union(T.Object, T.Number)); 449 CheckSub(
450 T.Union(T.ObjectConstant1, T.Integer32), T.Union(T.Object, T.Number));
443 CheckSub(T.Union(T.ObjectConstant1, T.Array), T.Object); 451 CheckSub(T.Union(T.ObjectConstant1, T.Array), T.Object);
444 CheckUnordered(T.Union(T.ObjectConstant1, T.String), T.Array); 452 CheckUnordered(T.Union(T.ObjectConstant1, T.String), T.Array);
445 CheckOverlap(T.Union(T.ObjectConstant1, T.String), T.Object); 453 CheckOverlap(T.Union(T.ObjectConstant1, T.String), T.Object);
446 CheckDisjoint(T.Union(T.ObjectConstant1, T.String), T.Number); 454 CheckDisjoint(T.Union(T.ObjectConstant1, T.String), T.Number);
447 455
448 // Class-constant 456 // Class-constant
449 CHECK(IsUnion(Type::Union(T.ObjectConstant1, T.ObjectClass))); 457 CHECK(IsUnion(Type::Union(T.ObjectConstant1, T.ObjectClass)));
450 CHECK(IsUnion(Type::Union(T.ArrayClass, T.ObjectConstant2))); 458 CHECK(IsUnion(Type::Union(T.ArrayClass, T.ObjectConstant2)));
451 459
452 CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), T.Object); 460 CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), T.Object);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 T.Union(T.ArrayConstant, T.ObjectConstant2), T.ObjectConstant1))); 517 T.Union(T.ArrayConstant, T.ObjectConstant2), T.ObjectConstant1)));
510 518
511 CheckEqual( 519 CheckEqual(
512 T.Union(T.ObjectConstant1, T.Union(T.ObjectConstant1, T.ObjectConstant2)), 520 T.Union(T.ObjectConstant1, T.Union(T.ObjectConstant1, T.ObjectConstant2)),
513 T.Union(T.ObjectConstant2, T.ObjectConstant1)); 521 T.Union(T.ObjectConstant2, T.ObjectConstant1));
514 CheckEqual( 522 CheckEqual(
515 T.Union(T.Union(T.ArrayConstant, T.ObjectConstant2), T.ObjectConstant1), 523 T.Union(T.Union(T.ArrayConstant, T.ObjectConstant2), T.ObjectConstant1),
516 T.Union(T.ObjectConstant2, T.Union(T.ArrayConstant, T.ObjectConstant1))); 524 T.Union(T.ObjectConstant2, T.Union(T.ArrayConstant, T.ObjectConstant1)));
517 525
518 // Union-union 526 // Union-union
519 CHECK(IsBitset( 527 CHECK(IsBitset(Type::Union(
520 Type::Union(T.Union(T.Number, T.ArrayClass), T.Union(T.Smi, T.Array)))); 528 T.Union(T.Number, T.ArrayClass), T.Union(T.Integer32, T.Array))));
521 529
522 CheckEqual( 530 CheckEqual(
523 T.Union(T.Union(T.ObjectConstant2, T.ObjectConstant1), 531 T.Union(T.Union(T.ObjectConstant2, T.ObjectConstant1),
524 T.Union(T.ObjectConstant1, T.ObjectConstant2)), 532 T.Union(T.ObjectConstant1, T.ObjectConstant2)),
525 T.Union(T.ObjectConstant2, T.ObjectConstant1)); 533 T.Union(T.ObjectConstant2, T.ObjectConstant1));
526 CheckEqual( 534 CheckEqual(
527 T.Union(T.Union(T.ObjectConstant2, T.ArrayConstant), 535 T.Union(T.Union(T.ObjectConstant2, T.ArrayConstant),
528 T.Union(T.ObjectConstant1, T.ArrayConstant)), 536 T.Union(T.ObjectConstant1, T.ArrayConstant)),
529 T.Union(T.Union(T.ObjectConstant1, T.ObjectConstant2), T.ArrayConstant)); 537 T.Union(T.Union(T.ObjectConstant1, T.ObjectConstant2), T.ArrayConstant));
530 CheckEqual( 538 CheckEqual(
531 T.Union(T.Union(T.Number, T.ArrayClass), T.Union(T.Smi, T.Array)), 539 T.Union(T.Union(T.Number, T.ArrayClass), T.Union(T.Integer31, T.Array)),
532 T.Union(T.Number, T.Array)); 540 T.Union(T.Number, T.Array));
533 } 541 }
OLDNEW
« no previous file with comments | « test/cctest/test-compare-nil-ic-stub.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698