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 176843006: Introduce representation types (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use smi MSB Created 6 years, 9 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
« src/types.h ('K') | « src/typing.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 16 matching lines...) Expand all
27 27
28 #include "cctest.h" 28 #include "cctest.h"
29 #include "types.h" 29 #include "types.h"
30 30
31 using namespace v8::internal; 31 using namespace v8::internal;
32 32
33 template<class Type, class TypeHandle, class Region> 33 template<class Type, class TypeHandle, class Region>
34 class Types { 34 class Types {
35 public: 35 public:
36 Types(Region* region, Isolate* isolate) : 36 Types(Region* region, Isolate* isolate) :
37 Representation(Type::Representation(region)),
38 Semantic(Type::Semantic(region)),
37 None(Type::None(region)), 39 None(Type::None(region)),
38 Any(Type::Any(region)), 40 Any(Type::Any(region)),
39 Oddball(Type::Oddball(region)), 41 Oddball(Type::Oddball(region)),
40 Boolean(Type::Boolean(region)), 42 Boolean(Type::Boolean(region)),
41 Null(Type::Null(region)), 43 Null(Type::Null(region)),
42 Undefined(Type::Undefined(region)), 44 Undefined(Type::Undefined(region)),
43 Number(Type::Number(region)), 45 Number(Type::Number(region)),
44 Smi(Type::Smi(region)), 46 SignedSmall(Type::SignedSmall(region)),
45 Signed32(Type::Signed32(region)), 47 Signed32(Type::Signed32(region)),
46 Double(Type::Double(region)), 48 Float(Type::Float(region)),
47 Name(Type::Name(region)), 49 Name(Type::Name(region)),
48 UniqueName(Type::UniqueName(region)), 50 UniqueName(Type::UniqueName(region)),
49 String(Type::String(region)), 51 String(Type::String(region)),
50 InternalizedString(Type::InternalizedString(region)), 52 InternalizedString(Type::InternalizedString(region)),
51 Symbol(Type::Symbol(region)), 53 Symbol(Type::Symbol(region)),
52 Receiver(Type::Receiver(region)), 54 Receiver(Type::Receiver(region)),
53 Object(Type::Object(region)), 55 Object(Type::Object(region)),
54 Array(Type::Array(region)), 56 Array(Type::Array(region)),
55 Function(Type::Function(region)), 57 Function(Type::Function(region)),
56 Proxy(Type::Proxy(region)), 58 Proxy(Type::Proxy(region)),
57 object_map(isolate->factory()->NewMap(JS_OBJECT_TYPE, 3 * kPointerSize)), 59 object_map(isolate->factory()->NewMap(JS_OBJECT_TYPE, 3 * kPointerSize)),
58 array_map(isolate->factory()->NewMap(JS_ARRAY_TYPE, 4 * kPointerSize)), 60 array_map(isolate->factory()->NewMap(JS_ARRAY_TYPE, 4 * kPointerSize)),
59 region_(region) { 61 region_(region) {
60 smi = handle(Smi::FromInt(666), isolate); 62 smi = handle(Smi::FromInt(666), isolate);
61 signed32 = isolate->factory()->NewHeapNumber(0x40000000); 63 signed32 = isolate->factory()->NewHeapNumber(0x40000000);
62 object1 = isolate->factory()->NewJSObjectFromMap(object_map); 64 object1 = isolate->factory()->NewJSObjectFromMap(object_map);
63 object2 = isolate->factory()->NewJSObjectFromMap(object_map); 65 object2 = isolate->factory()->NewJSObjectFromMap(object_map);
64 array = isolate->factory()->NewJSArray(20); 66 array = isolate->factory()->NewJSArray(20);
65 ObjectClass = Type::Class(object_map, region); 67 ObjectClass = Type::Class(object_map, region);
66 ArrayClass = Type::Class(array_map, region); 68 ArrayClass = Type::Class(array_map, region);
67 SmiConstant = Type::Constant(smi, region); 69 SmiConstant = Type::Constant(smi, region);
68 Signed32Constant = Type::Constant(signed32, region); 70 Signed32Constant = Type::Constant(signed32, region);
69 ObjectConstant1 = Type::Constant(object1, region); 71 ObjectConstant1 = Type::Constant(object1, region);
70 ObjectConstant2 = Type::Constant(object2, region); 72 ObjectConstant2 = Type::Constant(object2, region);
71 ArrayConstant1 = Type::Constant(array, region); 73 ArrayConstant1 = Type::Constant(array, region);
72 ArrayConstant2 = Type::Constant(array, region); 74 ArrayConstant2 = Type::Constant(array, region);
73 } 75 }
74 76
77 TypeHandle Representation;
78 TypeHandle Semantic;
75 TypeHandle None; 79 TypeHandle None;
76 TypeHandle Any; 80 TypeHandle Any;
77 TypeHandle Oddball; 81 TypeHandle Oddball;
78 TypeHandle Boolean; 82 TypeHandle Boolean;
79 TypeHandle Null; 83 TypeHandle Null;
80 TypeHandle Undefined; 84 TypeHandle Undefined;
81 TypeHandle Number; 85 TypeHandle Number;
82 TypeHandle Smi; 86 TypeHandle SignedSmall;
83 TypeHandle Signed32; 87 TypeHandle Signed32;
84 TypeHandle Double; 88 TypeHandle Float;
85 TypeHandle Name; 89 TypeHandle Name;
86 TypeHandle UniqueName; 90 TypeHandle UniqueName;
87 TypeHandle String; 91 TypeHandle String;
88 TypeHandle InternalizedString; 92 TypeHandle InternalizedString;
89 TypeHandle Symbol; 93 TypeHandle Symbol;
90 TypeHandle Receiver; 94 TypeHandle Receiver;
91 TypeHandle Object; 95 TypeHandle Object;
92 TypeHandle Array; 96 TypeHandle Array;
93 TypeHandle Function; 97 TypeHandle Function;
94 TypeHandle Proxy; 98 TypeHandle Proxy;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 Zone zone; 233 Zone zone;
230 Types<Type, TypeHandle, Region> T; 234 Types<Type, TypeHandle, Region> T;
231 235
232 Tests() : 236 Tests() :
233 isolate(CcTest::i_isolate()), 237 isolate(CcTest::i_isolate()),
234 scope(isolate), 238 scope(isolate),
235 zone(isolate), 239 zone(isolate),
236 T(Rep::ToRegion(&zone, isolate), isolate) { 240 T(Rep::ToRegion(&zone, isolate), isolate) {
237 } 241 }
238 242
239 static void CheckEqual(TypeHandle type1, TypeHandle type2) { 243 void CheckEqual(TypeHandle type1, TypeHandle type2) {
240 CHECK_EQ(Rep::IsBitset(type1), Rep::IsBitset(type2)); 244 CHECK_EQ(Rep::IsBitset(type1), Rep::IsBitset(type2));
241 CHECK_EQ(Rep::IsClass(type1), Rep::IsClass(type2)); 245 CHECK_EQ(Rep::IsClass(type1), Rep::IsClass(type2));
242 CHECK_EQ(Rep::IsConstant(type1), Rep::IsConstant(type2)); 246 CHECK_EQ(Rep::IsConstant(type1), Rep::IsConstant(type2));
243 CHECK_EQ(Rep::IsUnion(type1), Rep::IsUnion(type2)); 247 CHECK_EQ(Rep::IsUnion(type1), Rep::IsUnion(type2));
244 CHECK_EQ(type1->NumClasses(), type2->NumClasses()); 248 CHECK_EQ(type1->NumClasses(), type2->NumClasses());
245 CHECK_EQ(type1->NumConstants(), type2->NumConstants()); 249 CHECK_EQ(type1->NumConstants(), type2->NumConstants());
246 if (Rep::IsBitset(type1)) { 250 if (Rep::IsBitset(type1)) {
247 CHECK_EQ(Rep::AsBitset(type1), Rep::AsBitset(type2)); 251 CHECK_EQ(Rep::AsBitset(type1), Rep::AsBitset(type2));
248 } else if (Rep::IsClass(type1)) { 252 } else if (Rep::IsClass(type1)) {
249 CHECK_EQ(Rep::AsClass(type1), Rep::AsClass(type2)); 253 CHECK_EQ(Rep::AsClass(type1), Rep::AsClass(type2));
250 } else if (Rep::IsConstant(type1)) { 254 } else if (Rep::IsConstant(type1)) {
251 CHECK_EQ(Rep::AsConstant(type1), Rep::AsConstant(type2)); 255 CHECK_EQ(Rep::AsConstant(type1), Rep::AsConstant(type2));
252 } else if (Rep::IsUnion(type1)) { 256 } else if (Rep::IsUnion(type1)) {
253 CHECK_EQ(Rep::AsUnion(type1)->length(), Rep::AsUnion(type2)->length()); 257 CHECK_EQ(Rep::AsUnion(type1)->length(), Rep::AsUnion(type2)->length());
254 } 258 }
255 CHECK(type1->Is(type2)); 259 CHECK(type1->Is(type2));
256 CHECK(type2->Is(type1)); 260 CHECK(type2->Is(type1));
257 } 261 }
258 262
259 static void CheckSub(TypeHandle type1, TypeHandle type2) { 263 void CheckSub(TypeHandle type1, TypeHandle type2) {
260 CHECK(type1->Is(type2)); 264 CHECK(type1->Is(type2));
261 CHECK(!type2->Is(type1)); 265 CHECK(!type2->Is(type1));
262 if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) { 266 if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) {
263 CHECK_NE(Rep::AsBitset(type1), Rep::AsBitset(type2)); 267 CHECK_NE(Rep::AsBitset(type1), Rep::AsBitset(type2));
264 } 268 }
265 } 269 }
266 270
267 static void CheckUnordered(TypeHandle type1, TypeHandle type2) { 271 void CheckUnordered(TypeHandle type1, TypeHandle type2) {
268 CHECK(!type1->Is(type2)); 272 CHECK(!type1->Is(type2));
269 CHECK(!type2->Is(type1)); 273 CHECK(!type2->Is(type1));
270 if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) { 274 if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) {
271 CHECK_NE(Rep::AsBitset(type1), Rep::AsBitset(type2)); 275 CHECK_NE(Rep::AsBitset(type1), Rep::AsBitset(type2));
272 } 276 }
273 } 277 }
274 278
275 static void CheckOverlap(TypeHandle type1, TypeHandle type2) { 279 void CheckOverlap(TypeHandle type1, TypeHandle type2, TypeHandle mask) {
276 CHECK(type1->Maybe(type2)); 280 CHECK(type1->Maybe(type2));
277 CHECK(type2->Maybe(type1)); 281 CHECK(type2->Maybe(type1));
278 if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) { 282 if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) {
279 CHECK_NE(0, Rep::AsBitset(type1) & Rep::AsBitset(type2)); 283 CHECK_NE(0,
284 Rep::AsBitset(type1) & Rep::AsBitset(type2) & Rep::AsBitset(mask));
280 } 285 }
281 } 286 }
282 287
283 static void CheckDisjoint(TypeHandle type1, TypeHandle type2) { 288 void CheckDisjoint(TypeHandle type1, TypeHandle type2, TypeHandle mask) {
284 CHECK(!type1->Is(type2)); 289 CHECK(!type1->Is(type2));
285 CHECK(!type2->Is(type1)); 290 CHECK(!type2->Is(type1));
286 CHECK(!type1->Maybe(type2)); 291 CHECK(!type1->Maybe(type2));
287 CHECK(!type2->Maybe(type1)); 292 CHECK(!type2->Maybe(type1));
288 if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) { 293 if (Rep::IsBitset(type1) && Rep::IsBitset(type2)) {
289 CHECK_EQ(0, Rep::AsBitset(type1) & Rep::AsBitset(type2)); 294 CHECK_EQ(0,
295 Rep::AsBitset(type1) & Rep::AsBitset(type2) & Rep::AsBitset(mask));
290 } 296 }
291 } 297 }
292 298
293 void Bitset() { 299 void Bitset() {
294 CHECK(this->IsBitset(T.None)); 300 CHECK(this->IsBitset(T.None));
295 CHECK(this->IsBitset(T.Any)); 301 CHECK(this->IsBitset(T.Any));
296 CHECK(this->IsBitset(T.String)); 302 CHECK(this->IsBitset(T.String));
297 CHECK(this->IsBitset(T.Object)); 303 CHECK(this->IsBitset(T.Object));
298 304
299 CHECK(this->IsBitset(T.Union(T.String, T.Number))); 305 CHECK(this->IsBitset(T.Union(T.String, T.Number)));
300 CHECK(this->IsBitset(T.Union(T.String, T.Receiver))); 306 CHECK(this->IsBitset(T.Union(T.String, T.Receiver)));
301 307
302 CHECK_EQ(0, this->AsBitset(T.None)); 308 CHECK_EQ(0, this->AsBitset(T.None));
303 CHECK_EQ(this->AsBitset(T.Number) | this->AsBitset(T.String), 309 CHECK_EQ(
304 this->AsBitset(T.Union(T.String, T.Number))); 310 this->AsBitset(T.Number) | this->AsBitset(T.String),
305 CHECK_EQ(this->AsBitset(T.Receiver), 311 this->AsBitset(T.Union(T.String, T.Number)));
306 this->AsBitset(T.Union(T.Receiver, T.Object))); 312 CHECK_EQ(
313 this->AsBitset(T.Receiver),
314 this->AsBitset(T.Union(T.Receiver, T.Object)));
307 } 315 }
308 316
309 void Class() { 317 void Class() {
310 CHECK(this->IsClass(T.ObjectClass)); 318 CHECK(this->IsClass(T.ObjectClass));
311 CHECK(this->IsClass(T.ArrayClass)); 319 CHECK(this->IsClass(T.ArrayClass));
312 320
313 CHECK(*T.object_map == this->AsClass(T.ObjectClass)); 321 CHECK(*T.object_map == this->AsClass(T.ObjectClass));
314 CHECK(*T.array_map == this->AsClass(T.ArrayClass)); 322 CHECK(*T.array_map == this->AsClass(T.ArrayClass));
315 } 323 }
316 324
(...skipping 28 matching lines...) Expand all
345 353
346 CheckSub(T.Oddball, T.Any); 354 CheckSub(T.Oddball, T.Any);
347 CheckSub(T.Boolean, T.Oddball); 355 CheckSub(T.Boolean, T.Oddball);
348 CheckSub(T.Null, T.Oddball); 356 CheckSub(T.Null, T.Oddball);
349 CheckSub(T.Undefined, T.Oddball); 357 CheckSub(T.Undefined, T.Oddball);
350 CheckUnordered(T.Boolean, T.Null); 358 CheckUnordered(T.Boolean, T.Null);
351 CheckUnordered(T.Undefined, T.Null); 359 CheckUnordered(T.Undefined, T.Null);
352 CheckUnordered(T.Boolean, T.Undefined); 360 CheckUnordered(T.Boolean, T.Undefined);
353 361
354 CheckSub(T.Number, T.Any); 362 CheckSub(T.Number, T.Any);
355 CheckSub(T.Smi, T.Number); 363 CheckSub(T.SignedSmall, T.Number);
356 CheckSub(T.Signed32, T.Number); 364 CheckSub(T.Signed32, T.Number);
357 CheckSub(T.Double, T.Number); 365 CheckSub(T.Float, T.Number);
358 CheckSub(T.Smi, T.Signed32); 366 CheckSub(T.SignedSmall, T.Signed32);
359 CheckUnordered(T.Smi, T.Double); 367 CheckUnordered(T.SignedSmall, T.Float);
360 CheckUnordered(T.Signed32, T.Double); 368 CheckUnordered(T.Signed32, T.Float);
361 369
362 CheckSub(T.Name, T.Any); 370 CheckSub(T.Name, T.Any);
363 CheckSub(T.UniqueName, T.Any); 371 CheckSub(T.UniqueName, T.Any);
364 CheckSub(T.UniqueName, T.Name); 372 CheckSub(T.UniqueName, T.Name);
365 CheckSub(T.String, T.Name); 373 CheckSub(T.String, T.Name);
366 CheckSub(T.InternalizedString, T.String); 374 CheckSub(T.InternalizedString, T.String);
367 CheckSub(T.InternalizedString, T.UniqueName); 375 CheckSub(T.InternalizedString, T.UniqueName);
368 CheckSub(T.InternalizedString, T.Name); 376 CheckSub(T.InternalizedString, T.Name);
369 CheckSub(T.Symbol, T.UniqueName); 377 CheckSub(T.Symbol, T.UniqueName);
370 CheckSub(T.Symbol, T.Name); 378 CheckSub(T.Symbol, T.Name);
(...skipping 13 matching lines...) Expand all
384 // Structured subtyping 392 // Structured subtyping
385 CheckSub(T.None, T.ObjectClass); 393 CheckSub(T.None, T.ObjectClass);
386 CheckSub(T.None, T.ObjectConstant1); 394 CheckSub(T.None, T.ObjectConstant1);
387 CheckSub(T.ObjectClass, T.Any); 395 CheckSub(T.ObjectClass, T.Any);
388 CheckSub(T.ObjectConstant1, T.Any); 396 CheckSub(T.ObjectConstant1, T.Any);
389 397
390 CheckSub(T.ObjectClass, T.Object); 398 CheckSub(T.ObjectClass, T.Object);
391 CheckSub(T.ArrayClass, T.Object); 399 CheckSub(T.ArrayClass, T.Object);
392 CheckUnordered(T.ObjectClass, T.ArrayClass); 400 CheckUnordered(T.ObjectClass, T.ArrayClass);
393 401
394 CheckSub(T.SmiConstant, T.Smi); 402 CheckSub(T.SmiConstant, T.SignedSmall);
395 CheckSub(T.SmiConstant, T.Signed32); 403 CheckSub(T.SmiConstant, T.Signed32);
396 CheckSub(T.SmiConstant, T.Number); 404 CheckSub(T.SmiConstant, T.Number);
397 CheckSub(T.ObjectConstant1, T.Object); 405 CheckSub(T.ObjectConstant1, T.Object);
398 CheckSub(T.ObjectConstant2, T.Object); 406 CheckSub(T.ObjectConstant2, T.Object);
399 CheckSub(T.ArrayConstant1, T.Object); 407 CheckSub(T.ArrayConstant1, T.Object);
400 CheckSub(T.ArrayConstant1, T.Array); 408 CheckSub(T.ArrayConstant1, T.Array);
401 CheckUnordered(T.ObjectConstant1, T.ObjectConstant2); 409 CheckUnordered(T.ObjectConstant1, T.ObjectConstant2);
402 CheckUnordered(T.ObjectConstant1, T.ArrayConstant1); 410 CheckUnordered(T.ObjectConstant1, T.ArrayConstant1);
403 411
404 CheckUnordered(T.ObjectConstant1, T.ObjectClass); 412 CheckUnordered(T.ObjectConstant1, T.ObjectClass);
405 CheckUnordered(T.ObjectConstant2, T.ObjectClass); 413 CheckUnordered(T.ObjectConstant2, T.ObjectClass);
406 CheckUnordered(T.ObjectConstant1, T.ArrayClass); 414 CheckUnordered(T.ObjectConstant1, T.ArrayClass);
407 CheckUnordered(T.ObjectConstant2, T.ArrayClass); 415 CheckUnordered(T.ObjectConstant2, T.ArrayClass);
408 CheckUnordered(T.ArrayConstant1, T.ObjectClass); 416 CheckUnordered(T.ArrayConstant1, T.ObjectClass);
409 } 417 }
410 418
411 void Maybe() { 419 void Maybe() {
412 CheckOverlap(T.Any, T.Any); 420 CheckOverlap(T.Any, T.Any, T.Semantic);
413 CheckOverlap(T.Object, T.Object); 421 CheckOverlap(T.Object, T.Object, T.Semantic);
414 422
415 CheckOverlap(T.Oddball, T.Any); 423 CheckOverlap(T.Oddball, T.Any, T.Semantic);
416 CheckOverlap(T.Boolean, T.Oddball); 424 CheckOverlap(T.Boolean, T.Oddball, T.Semantic);
417 CheckOverlap(T.Null, T.Oddball); 425 CheckOverlap(T.Null, T.Oddball, T.Semantic);
418 CheckOverlap(T.Undefined, T.Oddball); 426 CheckOverlap(T.Undefined, T.Oddball, T.Semantic);
419 CheckDisjoint(T.Boolean, T.Null); 427 CheckDisjoint(T.Boolean, T.Null, T.Semantic);
420 CheckDisjoint(T.Undefined, T.Null); 428 CheckDisjoint(T.Undefined, T.Null, T.Semantic);
421 CheckDisjoint(T.Boolean, T.Undefined); 429 CheckDisjoint(T.Boolean, T.Undefined, T.Semantic);
422 430
423 CheckOverlap(T.Number, T.Any); 431 CheckOverlap(T.Number, T.Any, T.Semantic);
424 CheckOverlap(T.Smi, T.Number); 432 CheckOverlap(T.SignedSmall, T.Number, T.Semantic);
425 CheckOverlap(T.Double, T.Number); 433 CheckOverlap(T.Float, T.Number, T.Semantic);
426 CheckDisjoint(T.Signed32, T.Double); 434 CheckDisjoint(T.Signed32, T.Float, T.Semantic);
427 435
428 CheckOverlap(T.Name, T.Any); 436 CheckOverlap(T.Name, T.Any, T.Semantic);
429 CheckOverlap(T.UniqueName, T.Any); 437 CheckOverlap(T.UniqueName, T.Any, T.Semantic);
430 CheckOverlap(T.UniqueName, T.Name); 438 CheckOverlap(T.UniqueName, T.Name, T.Semantic);
431 CheckOverlap(T.String, T.Name); 439 CheckOverlap(T.String, T.Name, T.Semantic);
432 CheckOverlap(T.InternalizedString, T.String); 440 CheckOverlap(T.InternalizedString, T.String, T.Semantic);
433 CheckOverlap(T.InternalizedString, T.UniqueName); 441 CheckOverlap(T.InternalizedString, T.UniqueName, T.Semantic);
434 CheckOverlap(T.InternalizedString, T.Name); 442 CheckOverlap(T.InternalizedString, T.Name, T.Semantic);
435 CheckOverlap(T.Symbol, T.UniqueName); 443 CheckOverlap(T.Symbol, T.UniqueName, T.Semantic);
436 CheckOverlap(T.Symbol, T.Name); 444 CheckOverlap(T.Symbol, T.Name, T.Semantic);
437 CheckOverlap(T.String, T.UniqueName); 445 CheckOverlap(T.String, T.UniqueName, T.Semantic);
438 CheckDisjoint(T.String, T.Symbol); 446 CheckDisjoint(T.String, T.Symbol, T.Semantic);
439 CheckDisjoint(T.InternalizedString, T.Symbol); 447 CheckDisjoint(T.InternalizedString, T.Symbol, T.Semantic);
440 448
441 CheckOverlap(T.Receiver, T.Any); 449 CheckOverlap(T.Receiver, T.Any, T.Semantic);
442 CheckOverlap(T.Object, T.Any); 450 CheckOverlap(T.Object, T.Any, T.Semantic);
443 CheckOverlap(T.Object, T.Receiver); 451 CheckOverlap(T.Object, T.Receiver, T.Semantic);
444 CheckOverlap(T.Array, T.Object); 452 CheckOverlap(T.Array, T.Object, T.Semantic);
445 CheckOverlap(T.Function, T.Object); 453 CheckOverlap(T.Function, T.Object, T.Semantic);
446 CheckOverlap(T.Proxy, T.Receiver); 454 CheckOverlap(T.Proxy, T.Receiver, T.Semantic);
447 CheckDisjoint(T.Object, T.Proxy); 455 CheckDisjoint(T.Object, T.Proxy, T.Semantic);
448 CheckDisjoint(T.Array, T.Function); 456 CheckDisjoint(T.Array, T.Function, T.Semantic);
449 457
450 CheckOverlap(T.ObjectClass, T.Any); 458 CheckOverlap(T.ObjectClass, T.Any, T.Semantic);
451 CheckOverlap(T.ObjectConstant1, T.Any); 459 CheckOverlap(T.ObjectConstant1, T.Any, T.Semantic);
452 460
453 CheckOverlap(T.ObjectClass, T.Object); 461 CheckOverlap(T.ObjectClass, T.Object, T.Semantic);
454 CheckOverlap(T.ArrayClass, T.Object); 462 CheckOverlap(T.ArrayClass, T.Object, T.Semantic);
455 CheckOverlap(T.ObjectClass, T.ObjectClass); 463 CheckOverlap(T.ObjectClass, T.ObjectClass, T.Semantic);
456 CheckOverlap(T.ArrayClass, T.ArrayClass); 464 CheckOverlap(T.ArrayClass, T.ArrayClass, T.Semantic);
457 CheckDisjoint(T.ObjectClass, T.ArrayClass); 465 CheckDisjoint(T.ObjectClass, T.ArrayClass, T.Semantic);
458 466
459 CheckOverlap(T.SmiConstant, T.Smi); 467 CheckOverlap(T.SmiConstant, T.SignedSmall, T.Semantic);
460 CheckOverlap(T.SmiConstant, T.Signed32); 468 CheckOverlap(T.SmiConstant, T.Signed32, T.Semantic);
461 CheckOverlap(T.SmiConstant, T.Number); 469 CheckOverlap(T.SmiConstant, T.Number, T.Semantic);
462 CheckDisjoint(T.SmiConstant, T.Double); 470 CheckDisjoint(T.SmiConstant, T.Float, T.Semantic);
463 CheckOverlap(T.ObjectConstant1, T.Object); 471 CheckOverlap(T.ObjectConstant1, T.Object, T.Semantic);
464 CheckOverlap(T.ObjectConstant2, T.Object); 472 CheckOverlap(T.ObjectConstant2, T.Object, T.Semantic);
465 CheckOverlap(T.ArrayConstant1, T.Object); 473 CheckOverlap(T.ArrayConstant1, T.Object, T.Semantic);
466 CheckOverlap(T.ArrayConstant1, T.Array); 474 CheckOverlap(T.ArrayConstant1, T.Array, T.Semantic);
467 CheckOverlap(T.ArrayConstant1, T.ArrayConstant2); 475 CheckOverlap(T.ArrayConstant1, T.ArrayConstant2, T.Semantic);
468 CheckOverlap(T.ObjectConstant1, T.ObjectConstant1); 476 CheckOverlap(T.ObjectConstant1, T.ObjectConstant1, T.Semantic);
469 CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2); 477 CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2, T.Semantic);
470 CheckDisjoint(T.ObjectConstant1, T.ArrayConstant1); 478 CheckDisjoint(T.ObjectConstant1, T.ArrayConstant1, T.Semantic);
471 479
472 CheckDisjoint(T.ObjectConstant1, T.ObjectClass); 480 CheckDisjoint(T.ObjectConstant1, T.ObjectClass, T.Semantic);
473 CheckDisjoint(T.ObjectConstant2, T.ObjectClass); 481 CheckDisjoint(T.ObjectConstant2, T.ObjectClass, T.Semantic);
474 CheckDisjoint(T.ObjectConstant1, T.ArrayClass); 482 CheckDisjoint(T.ObjectConstant1, T.ArrayClass, T.Semantic);
475 CheckDisjoint(T.ObjectConstant2, T.ArrayClass); 483 CheckDisjoint(T.ObjectConstant2, T.ArrayClass, T.Semantic);
476 CheckDisjoint(T.ArrayConstant1, T.ObjectClass); 484 CheckDisjoint(T.ArrayConstant1, T.ObjectClass, T.Semantic);
477 } 485 }
478 486
479 void Union() { 487 void Union() {
480 // Bitset-bitset 488 // Bitset-bitset
481 CHECK(this->IsBitset(T.Union(T.Object, T.Number))); 489 CHECK(this->IsBitset(T.Union(T.Object, T.Number)));
482 CHECK(this->IsBitset(T.Union(T.Object, T.Object))); 490 CHECK(this->IsBitset(T.Union(T.Object, T.Object)));
483 CHECK(this->IsBitset(T.Union(T.Any, T.None))); 491 CHECK(this->IsBitset(T.Union(T.Any, T.None)));
484 492
485 CheckEqual(T.Union(T.None, T.Number), T.Number); 493 CheckEqual(T.Union(T.None, T.Number), T.Number);
486 CheckEqual(T.Union(T.Object, T.Proxy), T.Receiver); 494 CheckEqual(T.Union(T.Object, T.Proxy), T.Receiver);
487 CheckEqual(T.Union(T.Number, T.String), T.Union(T.String, T.Number)); 495 CheckEqual(T.Union(T.Number, T.String), T.Union(T.String, T.Number));
488 CheckSub(T.Union(T.Number, T.String), T.Any); 496 CheckSub(T.Union(T.Number, T.String), T.Any);
489 497
490 // Class-class 498 // Class-class
491 CHECK(this->IsClass(T.Union(T.ObjectClass, T.ObjectClass))); 499 CHECK(this->IsClass(T.Union(T.ObjectClass, T.ObjectClass)));
492 CHECK(this->IsUnion(T.Union(T.ObjectClass, T.ArrayClass))); 500 CHECK(this->IsUnion(T.Union(T.ObjectClass, T.ArrayClass)));
493 501
494 CheckEqual(T.Union(T.ObjectClass, T.ObjectClass), T.ObjectClass); 502 CheckEqual(T.Union(T.ObjectClass, T.ObjectClass), T.ObjectClass);
495 CheckSub(T.None, T.Union(T.ObjectClass, T.ArrayClass)); 503 CheckSub(T.None, T.Union(T.ObjectClass, T.ArrayClass));
496 CheckSub(T.Union(T.ObjectClass, T.ArrayClass), T.Any); 504 CheckSub(T.Union(T.ObjectClass, T.ArrayClass), T.Any);
497 CheckSub(T.ObjectClass, T.Union(T.ObjectClass, T.ArrayClass)); 505 CheckSub(T.ObjectClass, T.Union(T.ObjectClass, T.ArrayClass));
498 CheckSub(T.ArrayClass, T.Union(T.ObjectClass, T.ArrayClass)); 506 CheckSub(T.ArrayClass, T.Union(T.ObjectClass, T.ArrayClass));
499 CheckSub(T.Union(T.ObjectClass, T.ArrayClass), T.Object); 507 CheckSub(T.Union(T.ObjectClass, T.ArrayClass), T.Object);
500 CheckUnordered(T.Union(T.ObjectClass, T.ArrayClass), T.Array); 508 CheckUnordered(T.Union(T.ObjectClass, T.ArrayClass), T.Array);
501 CheckOverlap(T.Union(T.ObjectClass, T.ArrayClass), T.Array); 509 CheckOverlap(T.Union(T.ObjectClass, T.ArrayClass), T.Array, T.Semantic);
502 CheckDisjoint(T.Union(T.ObjectClass, T.ArrayClass), T.Number); 510 CheckDisjoint(T.Union(T.ObjectClass, T.ArrayClass), T.Number, T.Semantic);
503 511
504 // Constant-constant 512 // Constant-constant
505 CHECK(this->IsConstant(T.Union(T.ObjectConstant1, T.ObjectConstant1))); 513 CHECK(this->IsConstant(T.Union(T.ObjectConstant1, T.ObjectConstant1)));
506 CHECK(this->IsConstant(T.Union(T.ArrayConstant1, T.ArrayConstant1))); 514 CHECK(this->IsConstant(T.Union(T.ArrayConstant1, T.ArrayConstant1)));
507 CHECK(this->IsUnion(T.Union(T.ObjectConstant1, T.ObjectConstant2))); 515 CHECK(this->IsUnion(T.Union(T.ObjectConstant1, T.ObjectConstant2)));
508 516
509 CheckEqual( 517 CheckEqual(
510 T.Union(T.ObjectConstant1, T.ObjectConstant1), 518 T.Union(T.ObjectConstant1, T.ObjectConstant1),
511 T.ObjectConstant1); 519 T.ObjectConstant1);
512 CheckEqual(T.Union(T.ArrayConstant1, T.ArrayConstant1), T.ArrayConstant1); 520 CheckEqual(T.Union(T.ArrayConstant1, T.ArrayConstant1), T.ArrayConstant1);
513 CheckEqual(T.Union(T.ArrayConstant1, T.ArrayConstant1), T.ArrayConstant2); 521 CheckEqual(T.Union(T.ArrayConstant1, T.ArrayConstant1), T.ArrayConstant2);
514 CheckSub(T.None, T.Union(T.ObjectConstant1, T.ObjectConstant2)); 522 CheckSub(T.None, T.Union(T.ObjectConstant1, T.ObjectConstant2));
515 CheckSub(T.Union(T.ObjectConstant1, T.ObjectConstant2), T.Any); 523 CheckSub(T.Union(T.ObjectConstant1, T.ObjectConstant2), T.Any);
516 CheckSub(T.ObjectConstant1, T.Union(T.ObjectConstant1, T.ObjectConstant2)); 524 CheckSub(T.ObjectConstant1, T.Union(T.ObjectConstant1, T.ObjectConstant2));
517 CheckSub(T.ObjectConstant2, T.Union(T.ObjectConstant1, T.ObjectConstant2)); 525 CheckSub(T.ObjectConstant2, T.Union(T.ObjectConstant1, T.ObjectConstant2));
518 CheckSub(T.ArrayConstant2, T.Union(T.ArrayConstant1, T.ObjectConstant2)); 526 CheckSub(T.ArrayConstant2, T.Union(T.ArrayConstant1, T.ObjectConstant2));
519 CheckSub(T.Union(T.ObjectConstant1, T.ObjectConstant2), T.Object); 527 CheckSub(T.Union(T.ObjectConstant1, T.ObjectConstant2), T.Object);
520 CheckUnordered( 528 CheckUnordered(
521 T.Union(T.ObjectConstant1, T.ObjectConstant2), T.ObjectClass); 529 T.Union(T.ObjectConstant1, T.ObjectConstant2), T.ObjectClass);
522 CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayConstant1), T.Array); 530 CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayConstant1), T.Array);
523 CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayConstant1), T.Array);
524 CheckOverlap( 531 CheckOverlap(
525 T.Union(T.ObjectConstant1, T.ArrayConstant1), T.ArrayConstant2); 532 T.Union(T.ObjectConstant1, T.ArrayConstant1), T.Array, T.Semantic);
526 CheckDisjoint(T.Union(T.ObjectConstant1, T.ArrayConstant1), T.Number); 533 CheckOverlap(
527 CheckDisjoint(T.Union(T.ObjectConstant1, T.ArrayConstant1), T.ObjectClass); 534 T.Union(T.ObjectConstant1, T.ArrayConstant1), T.ArrayConstant2,
535 T.Semantic);
536 CheckDisjoint(
537 T.Union(T.ObjectConstant1, T.ArrayConstant1), T.Number, T.Semantic);
538 CheckDisjoint(
539 T.Union(T.ObjectConstant1, T.ArrayConstant1), T.ObjectClass,
540 T.Semantic);
528 541
529 // Bitset-class 542 // Bitset-class
530 CHECK(this->IsBitset(T.Union(T.ObjectClass, T.Object))); 543 CHECK(this->IsBitset(T.Union(T.ObjectClass, T.Object)));
531 CHECK(this->IsUnion(T.Union(T.ObjectClass, T.Number))); 544 CHECK(this->IsUnion(T.Union(T.ObjectClass, T.Number)));
532 545
533 CheckEqual(T.Union(T.ObjectClass, T.Object), T.Object); 546 CheckEqual(T.Union(T.ObjectClass, T.Object), T.Object);
534 CheckSub(T.None, T.Union(T.ObjectClass, T.Number)); 547 CheckSub(T.None, T.Union(T.ObjectClass, T.Number));
535 CheckSub(T.Union(T.ObjectClass, T.Number), T.Any); 548 CheckSub(T.Union(T.ObjectClass, T.Number), T.Any);
536 CheckSub(T.Union(T.ObjectClass, T.Smi), T.Union(T.Object, T.Number)); 549 CheckSub(
550 T.Union(T.ObjectClass, T.SignedSmall), T.Union(T.Object, T.Number));
537 CheckSub(T.Union(T.ObjectClass, T.Array), T.Object); 551 CheckSub(T.Union(T.ObjectClass, T.Array), T.Object);
538 CheckUnordered(T.Union(T.ObjectClass, T.String), T.Array); 552 CheckUnordered(T.Union(T.ObjectClass, T.String), T.Array);
539 CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object); 553 CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object, T.Semantic);
540 CheckDisjoint(T.Union(T.ObjectClass, T.String), T.Number); 554 CheckDisjoint(T.Union(T.ObjectClass, T.String), T.Number, T.Semantic);
541 555
542 // Bitset-constant 556 // Bitset-constant
543 CHECK(this->IsBitset(T.Union(T.SmiConstant, T.Number))); 557 CHECK(this->IsBitset(T.Union(T.SmiConstant, T.Number)));
544 CHECK(this->IsBitset(T.Union(T.ObjectConstant1, T.Object))); 558 CHECK(this->IsBitset(T.Union(T.ObjectConstant1, T.Object)));
545 CHECK(this->IsUnion(T.Union(T.ObjectConstant2, T.Number))); 559 CHECK(this->IsUnion(T.Union(T.ObjectConstant2, T.Number)));
546 560
547 CheckEqual(T.Union(T.SmiConstant, T.Number), T.Number); 561 CheckEqual(T.Union(T.SmiConstant, T.Number), T.Number);
548 CheckEqual(T.Union(T.ObjectConstant1, T.Object), T.Object); 562 CheckEqual(T.Union(T.ObjectConstant1, T.Object), T.Object);
549 CheckSub(T.None, T.Union(T.ObjectConstant1, T.Number)); 563 CheckSub(T.None, T.Union(T.ObjectConstant1, T.Number));
550 CheckSub(T.Union(T.ObjectConstant1, T.Number), T.Any); 564 CheckSub(T.Union(T.ObjectConstant1, T.Number), T.Any);
551 CheckSub( 565 CheckSub(
552 T.Union(T.ObjectConstant1, T.Signed32), T.Union(T.Object, T.Number)); 566 T.Union(T.ObjectConstant1, T.Signed32), T.Union(T.Object, T.Number));
553 CheckSub(T.Union(T.ObjectConstant1, T.Array), T.Object); 567 CheckSub(T.Union(T.ObjectConstant1, T.Array), T.Object);
554 CheckUnordered(T.Union(T.ObjectConstant1, T.String), T.Array); 568 CheckUnordered(T.Union(T.ObjectConstant1, T.String), T.Array);
555 CheckOverlap(T.Union(T.ObjectConstant1, T.String), T.Object); 569 CheckOverlap(T.Union(T.ObjectConstant1, T.String), T.Object, T.Semantic);
556 CheckDisjoint(T.Union(T.ObjectConstant1, T.String), T.Number); 570 CheckDisjoint(T.Union(T.ObjectConstant1, T.String), T.Number, T.Semantic);
557 CheckEqual(T.Union(T.Signed32, T.Signed32Constant), T.Signed32); 571 CheckEqual(T.Union(T.Signed32, T.Signed32Constant), T.Signed32);
558 572
559 // Class-constant 573 // Class-constant
560 CHECK(this->IsUnion(T.Union(T.ObjectConstant1, T.ObjectClass))); 574 CHECK(this->IsUnion(T.Union(T.ObjectConstant1, T.ObjectClass)));
561 CHECK(this->IsUnion(T.Union(T.ArrayClass, T.ObjectConstant2))); 575 CHECK(this->IsUnion(T.Union(T.ArrayClass, T.ObjectConstant2)));
562 576
563 CheckSub(T.None, T.Union(T.ObjectConstant1, T.ArrayClass)); 577 CheckSub(T.None, T.Union(T.ObjectConstant1, T.ArrayClass));
564 CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), T.Any); 578 CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), T.Any);
565 CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), T.Object); 579 CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), T.Object);
566 CheckSub(T.ObjectConstant1, T.Union(T.ObjectConstant1, T.ArrayClass)); 580 CheckSub(T.ObjectConstant1, T.Union(T.ObjectConstant1, T.ArrayClass));
567 CheckSub(T.ArrayClass, T.Union(T.ObjectConstant1, T.ArrayClass)); 581 CheckSub(T.ArrayClass, T.Union(T.ObjectConstant1, T.ArrayClass));
568 CheckUnordered(T.ObjectClass, T.Union(T.ObjectConstant1, T.ArrayClass)); 582 CheckUnordered(T.ObjectClass, T.Union(T.ObjectConstant1, T.ArrayClass));
569 CheckSub( 583 CheckSub(
570 T.Union(T.ObjectConstant1, T.ArrayClass), T.Union(T.Array, T.Object)); 584 T.Union(T.ObjectConstant1, T.ArrayClass), T.Union(T.Array, T.Object));
571 CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayClass), T.ArrayConstant1); 585 CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayClass), T.ArrayConstant1);
572 CheckDisjoint(T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectConstant2); 586 CheckDisjoint(
573 CheckDisjoint(T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectClass); 587 T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectConstant2,
588 T.Semantic);
589 CheckDisjoint(
590 T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectClass, T.Semantic);
574 591
575 // Bitset-union 592 // Bitset-union
576 CHECK(this->IsBitset( 593 CHECK(this->IsBitset(
577 T.Union(T.Object, T.Union(T.ObjectConstant1, T.ObjectClass)))); 594 T.Union(T.Object, T.Union(T.ObjectConstant1, T.ObjectClass))));
578 CHECK(this->IsUnion( 595 CHECK(this->IsUnion(
579 T.Union(T.Union(T.ArrayClass, T.ObjectConstant2), T.Number))); 596 T.Union(T.Union(T.ArrayClass, T.ObjectConstant2), T.Number)));
580 597
581 CheckEqual( 598 CheckEqual(
582 T.Union(T.Object, T.Union(T.ObjectConstant1, T.ObjectClass)), 599 T.Union(T.Object, T.Union(T.ObjectConstant1, T.ObjectClass)),
583 T.Object); 600 T.Object);
584 CheckEqual( 601 CheckEqual(
585 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Number), 602 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Number),
586 T.Union(T.ObjectConstant1, T.Union(T.Number, T.ArrayClass))); 603 T.Union(T.ObjectConstant1, T.Union(T.Number, T.ArrayClass)));
587 CheckSub( 604 CheckSub(
588 T.Double, 605 T.Float,
589 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Number)); 606 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Number));
590 CheckSub( 607 CheckSub(
591 T.ObjectConstant1, 608 T.ObjectConstant1,
592 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Double)); 609 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Float));
593 CheckSub( 610 CheckSub(
594 T.None, 611 T.None,
595 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Double)); 612 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Float));
596 CheckSub( 613 CheckSub(
597 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Double), 614 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Float),
598 T.Any); 615 T.Any);
599 CheckSub( 616 CheckSub(
600 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Double), 617 T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Float),
601 T.Union(T.ObjectConstant1, T.Union(T.Number, T.ArrayClass))); 618 T.Union(T.ObjectConstant1, T.Union(T.Number, T.ArrayClass)));
602 619
603 // Class-union 620 // Class-union
604 CHECK(this->IsUnion( 621 CHECK(this->IsUnion(
605 T.Union(T.Union(T.ArrayClass, T.ObjectConstant2), T.ArrayClass))); 622 T.Union(T.Union(T.ArrayClass, T.ObjectConstant2), T.ArrayClass)));
606 CHECK(this->IsUnion( 623 CHECK(this->IsUnion(
607 T.Union(T.Union(T.ArrayClass, T.ObjectConstant2), T.ObjectClass))); 624 T.Union(T.Union(T.ArrayClass, T.ObjectConstant2), T.ObjectClass)));
608 625
609 CheckEqual( 626 CheckEqual(
610 T.Union(T.ObjectClass, T.Union(T.ObjectConstant1, T.ObjectClass)), 627 T.Union(T.ObjectClass, T.Union(T.ObjectConstant1, T.ObjectClass)),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 T.Union(T.ObjectConstant1, T.ObjectConstant2)), 671 T.Union(T.ObjectConstant1, T.ObjectConstant2)),
655 T.Union(T.ObjectConstant2, T.ObjectConstant1)); 672 T.Union(T.ObjectConstant2, T.ObjectConstant1));
656 CheckEqual( 673 CheckEqual(
657 T.Union( 674 T.Union(
658 T.Union(T.ObjectConstant2, T.ArrayConstant1), 675 T.Union(T.ObjectConstant2, T.ArrayConstant1),
659 T.Union(T.ObjectConstant1, T.ArrayConstant2)), 676 T.Union(T.ObjectConstant1, T.ArrayConstant2)),
660 T.Union( 677 T.Union(
661 T.Union(T.ObjectConstant1, T.ObjectConstant2), 678 T.Union(T.ObjectConstant1, T.ObjectConstant2),
662 T.ArrayConstant1)); 679 T.ArrayConstant1));
663 CheckEqual( 680 CheckEqual(
664 T.Union(T.Union(T.Number, T.ArrayClass), T.Union(T.Smi, T.Array)), 681 T.Union(
682 T.Union(T.Number, T.ArrayClass),
683 T.Union(T.SignedSmall, T.Array)),
665 T.Union(T.Number, T.Array)); 684 T.Union(T.Number, T.Array));
666 } 685 }
667 686
668 void Intersect() { 687 void Intersect() {
669 // Bitset-bitset 688 // Bitset-bitset
670 CHECK(this->IsBitset(T.Intersect(T.Object, T.Number))); 689 CHECK(this->IsBitset(T.Intersect(T.Object, T.Number)));
671 CHECK(this->IsBitset(T.Intersect(T.Object, T.Object))); 690 CHECK(this->IsBitset(T.Intersect(T.Object, T.Object)));
672 CHECK(this->IsBitset(T.Intersect(T.Any, T.None))); 691 CHECK(this->IsBitset(T.Intersect(T.Any, T.None)));
673 692
674 CheckEqual(T.Intersect(T.None, T.Number), T.None); 693 CheckEqual(T.Intersect(T.None, T.Number), T.None);
675 CheckEqual(T.Intersect(T.Object, T.Proxy), T.None); 694 CheckSub(T.Intersect(T.Object, T.Proxy), T.Representation);
676 CheckEqual(T.Intersect(T.Name, T.String), T.Intersect(T.String, T.Name)); 695 CheckEqual(T.Intersect(T.Name, T.String), T.Intersect(T.String, T.Name));
677 CheckEqual(T.Intersect(T.UniqueName, T.String), T.InternalizedString); 696 CheckEqual(T.Intersect(T.UniqueName, T.String), T.InternalizedString);
678 697
679 // Class-class 698 // Class-class
680 CHECK(this->IsClass(T.Intersect(T.ObjectClass, T.ObjectClass))); 699 CHECK(this->IsClass(T.Intersect(T.ObjectClass, T.ObjectClass)));
681 CHECK(this->IsBitset(T.Intersect(T.ObjectClass, T.ArrayClass))); 700 CHECK(this->IsBitset(T.Intersect(T.ObjectClass, T.ArrayClass)));
682 701
683 CheckEqual(T.Intersect(T.ObjectClass, T.ObjectClass), T.ObjectClass); 702 CheckEqual(T.Intersect(T.ObjectClass, T.ObjectClass), T.ObjectClass);
684 CheckEqual(T.Intersect(T.ObjectClass, T.ArrayClass), T.None); 703 CheckEqual(T.Intersect(T.ObjectClass, T.ArrayClass), T.None);
685 704
686 // Constant-constant 705 // Constant-constant
687 CHECK(this->IsConstant(T.Intersect(T.ObjectConstant1, T.ObjectConstant1))); 706 CHECK(this->IsConstant(T.Intersect(T.ObjectConstant1, T.ObjectConstant1)));
688 CHECK(this->IsConstant(T.Intersect(T.ArrayConstant1, T.ArrayConstant2))); 707 CHECK(this->IsConstant(T.Intersect(T.ArrayConstant1, T.ArrayConstant2)));
689 CHECK(this->IsBitset(T.Intersect(T.ObjectConstant1, T.ObjectConstant2))); 708 CHECK(this->IsBitset(T.Intersect(T.ObjectConstant1, T.ObjectConstant2)));
690 709
691 CheckEqual( 710 CheckEqual(
692 T.Intersect(T.ObjectConstant1, T.ObjectConstant1), T.ObjectConstant1); 711 T.Intersect(T.ObjectConstant1, T.ObjectConstant1), T.ObjectConstant1);
693 CheckEqual( 712 CheckEqual(
694 T.Intersect(T.ArrayConstant1, T.ArrayConstant2), T.ArrayConstant1); 713 T.Intersect(T.ArrayConstant1, T.ArrayConstant2), T.ArrayConstant1);
695 CheckEqual(T.Intersect(T.ObjectConstant1, T.ObjectConstant2), T.None); 714 CheckEqual(T.Intersect(T.ObjectConstant1, T.ObjectConstant2), T.None);
696 715
697 // Bitset-class 716 // Bitset-class
698 CHECK(this->IsClass(T.Intersect(T.ObjectClass, T.Object))); 717 CHECK(this->IsClass(T.Intersect(T.ObjectClass, T.Object)));
699 CHECK(this->IsBitset(T.Intersect(T.ObjectClass, T.Number))); 718 CHECK(this->IsBitset(T.Intersect(T.ObjectClass, T.Number)));
700 719
701 CheckEqual(T.Intersect(T.ObjectClass, T.Object), T.ObjectClass); 720 CheckEqual(T.Intersect(T.ObjectClass, T.Object), T.ObjectClass);
702 CheckEqual(T.Intersect(T.ObjectClass, T.Array), T.None); 721 CheckSub(T.Intersect(T.ObjectClass, T.Array), T.Representation);
703 CheckEqual(T.Intersect(T.ObjectClass, T.Number), T.None); 722 CheckSub(T.Intersect(T.ObjectClass, T.Number), T.Representation);
704 723
705 // Bitset-constant 724 // Bitset-constant
706 CHECK(this->IsBitset(T.Intersect(T.Smi, T.Number))); 725 CHECK(this->IsBitset(T.Intersect(T.SignedSmall, T.Number)));
707 CHECK(this->IsConstant(T.Intersect(T.SmiConstant, T.Number))); 726 CHECK(this->IsConstant(T.Intersect(T.SmiConstant, T.Number)));
708 CHECK(this->IsConstant(T.Intersect(T.ObjectConstant1, T.Object))); 727 CHECK(this->IsConstant(T.Intersect(T.ObjectConstant1, T.Object)));
709 728
710 CheckEqual(T.Intersect(T.Smi, T.Number), T.Smi); 729 CheckEqual(T.Intersect(T.SignedSmall, T.Number), T.SignedSmall);
711 CheckEqual(T.Intersect(T.SmiConstant, T.Number), T.SmiConstant); 730 CheckEqual(T.Intersect(T.SmiConstant, T.Number), T.SmiConstant);
712 CheckEqual(T.Intersect(T.ObjectConstant1, T.Object), T.ObjectConstant1); 731 CheckEqual(T.Intersect(T.ObjectConstant1, T.Object), T.ObjectConstant1);
713 732
714 // Class-constant 733 // Class-constant
715 CHECK(this->IsBitset(T.Intersect(T.ObjectConstant1, T.ObjectClass))); 734 CHECK(this->IsBitset(T.Intersect(T.ObjectConstant1, T.ObjectClass)));
716 CHECK(this->IsBitset(T.Intersect(T.ArrayClass, T.ObjectConstant2))); 735 CHECK(this->IsBitset(T.Intersect(T.ArrayClass, T.ObjectConstant2)));
717 736
718 CheckEqual(T.Intersect(T.ObjectConstant1, T.ObjectClass), T.None); 737 CheckEqual(T.Intersect(T.ObjectConstant1, T.ObjectClass), T.None);
719 CheckEqual(T.Intersect(T.ArrayClass, T.ObjectConstant2), T.None); 738 CheckEqual(T.Intersect(T.ArrayClass, T.ObjectConstant2), T.None);
720 739
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 790
772 // Union-union 791 // Union-union
773 CHECK(this->IsUnion(T.Intersect( 792 CHECK(this->IsUnion(T.Intersect(
774 T.Union(T.Number, T.ArrayClass), T.Union(T.Signed32, T.Array)))); 793 T.Union(T.Number, T.ArrayClass), T.Union(T.Signed32, T.Array))));
775 CHECK(this->IsBitset(T.Intersect( 794 CHECK(this->IsBitset(T.Intersect(
776 T.Union(T.Number, T.ObjectClass), T.Union(T.Signed32, T.Array)))); 795 T.Union(T.Number, T.ObjectClass), T.Union(T.Signed32, T.Array))));
777 796
778 CheckEqual( 797 CheckEqual(
779 T.Intersect( 798 T.Intersect(
780 T.Union(T.Number, T.ArrayClass), 799 T.Union(T.Number, T.ArrayClass),
781 T.Union(T.Smi, T.Array)), 800 T.Union(T.SignedSmall, T.Array)),
782 T.Union(T.Smi, T.ArrayClass)); 801 T.Union(T.SignedSmall, T.ArrayClass));
783 CheckEqual( 802 CheckEqual(
784 T.Intersect( 803 T.Intersect(
785 T.Union(T.Number, T.ObjectClass), 804 T.Union(T.Number, T.ObjectClass),
786 T.Union(T.Signed32, T.Array)), 805 T.Union(T.Signed32, T.Array)),
787 T.Signed32); 806 T.Signed32);
788 CheckEqual( 807 CheckEqual(
789 T.Intersect( 808 T.Intersect(
790 T.Union(T.ObjectConstant2, T.ObjectConstant1), 809 T.Union(T.ObjectConstant2, T.ObjectConstant1),
791 T.Union(T.ObjectConstant1, T.ObjectConstant2)), 810 T.Union(T.ObjectConstant1, T.ObjectConstant2)),
792 T.Union(T.ObjectConstant2, T.ObjectConstant1)); 811 T.Union(T.ObjectConstant2, T.ObjectConstant1));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 ZoneTests().Intersect(); 887 ZoneTests().Intersect();
869 HeapTests().Intersect(); 888 HeapTests().Intersect();
870 } 889 }
871 890
872 891
873 TEST(Convert) { 892 TEST(Convert) {
874 CcTest::InitializeVM(); 893 CcTest::InitializeVM();
875 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>(); 894 ZoneTests().Convert<HeapType, Handle<HeapType>, Isolate, HeapRep>();
876 HeapTests().Convert<Type, Type*, Zone, ZoneRep>(); 895 HeapTests().Convert<Type, Type*, Zone, ZoneRep>();
877 } 896 }
OLDNEW
« src/types.h ('K') | « src/typing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698