| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 namespace v8 { | 31 namespace v8 { |
| 32 namespace internal { | 32 namespace internal { |
| 33 | 33 |
| 34 template<class Config> | 34 template<class Config> |
| 35 int TypeImpl<Config>::NumClasses() { | 35 int TypeImpl<Config>::NumClasses() { |
| 36 if (this->IsClass()) { | 36 if (this->IsClass()) { |
| 37 return 1; | 37 return 1; |
| 38 } else if (this->IsUnion()) { | 38 } else if (this->IsUnion()) { |
| 39 UnionedHandle unioned = this->AsUnion(); | 39 UnionedHandle unioned = this->AsUnion(); |
| 40 int result = 0; | 40 int result = 0; |
| 41 for (int i = 0; i < unioned->length(); ++i) { | 41 for (int i = 0; i < Config::union_length(unioned); ++i) { |
| 42 if (Config::union_get(unioned, i)->IsClass()) ++result; | 42 if (Config::union_get(unioned, i)->IsClass()) ++result; |
| 43 } | 43 } |
| 44 return result; | 44 return result; |
| 45 } else { | 45 } else { |
| 46 return 0; | 46 return 0; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 | 50 |
| 51 template<class Config> | 51 template<class Config> |
| 52 int TypeImpl<Config>::NumConstants() { | 52 int TypeImpl<Config>::NumConstants() { |
| 53 if (this->IsConstant()) { | 53 if (this->IsConstant()) { |
| 54 return 1; | 54 return 1; |
| 55 } else if (this->IsUnion()) { | 55 } else if (this->IsUnion()) { |
| 56 UnionedHandle unioned = this->AsUnion(); | 56 UnionedHandle unioned = this->AsUnion(); |
| 57 int result = 0; | 57 int result = 0; |
| 58 for (int i = 0; i < unioned->length(); ++i) { | 58 for (int i = 0; i < Config::union_length(unioned); ++i) { |
| 59 if (Config::union_get(unioned, i)->IsConstant()) ++result; | 59 if (Config::union_get(unioned, i)->IsConstant()) ++result; |
| 60 } | 60 } |
| 61 return result; | 61 return result; |
| 62 } else { | 62 } else { |
| 63 return 0; | 63 return 0; |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 template<class Config> template<class T> | 68 template<class Config> template<class T> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 i::Handle<T> TypeImpl<Config>::Iterator<T>::Current() { | 111 i::Handle<T> TypeImpl<Config>::Iterator<T>::Current() { |
| 112 return TypeImplIteratorAux<Config, T>::current(get_type()); | 112 return TypeImplIteratorAux<Config, T>::current(get_type()); |
| 113 } | 113 } |
| 114 | 114 |
| 115 | 115 |
| 116 template<class Config> template<class T> | 116 template<class Config> template<class T> |
| 117 void TypeImpl<Config>::Iterator<T>::Advance() { | 117 void TypeImpl<Config>::Iterator<T>::Advance() { |
| 118 ++index_; | 118 ++index_; |
| 119 if (type_->IsUnion()) { | 119 if (type_->IsUnion()) { |
| 120 UnionedHandle unioned = type_->AsUnion(); | 120 UnionedHandle unioned = type_->AsUnion(); |
| 121 for (; index_ < unioned->length(); ++index_) { | 121 for (; index_ < Config::union_length(unioned); ++index_) { |
| 122 if (matches(Config::union_get(unioned, index_))) return; | 122 if (matches(Config::union_get(unioned, index_))) return; |
| 123 } | 123 } |
| 124 } else if (index_ == 0 && matches(type_)) { | 124 } else if (index_ == 0 && matches(type_)) { |
| 125 return; | 125 return; |
| 126 } | 126 } |
| 127 index_ = -1; | 127 index_ = -1; |
| 128 } | 128 } |
| 129 | 129 |
| 130 | 130 |
| 131 // Get the smallest bitset subsuming this type. | 131 // Get the smallest bitset subsuming this type. |
| 132 template<class Config> | 132 template<class Config> |
| 133 int TypeImpl<Config>::LubBitset() { | 133 int TypeImpl<Config>::LubBitset() { |
| 134 if (this->IsBitset()) { | 134 if (this->IsBitset()) { |
| 135 return this->AsBitset(); | 135 return this->AsBitset(); |
| 136 } else if (this->IsUnion()) { | 136 } else if (this->IsUnion()) { |
| 137 UnionedHandle unioned = this->AsUnion(); | 137 UnionedHandle unioned = this->AsUnion(); |
| 138 int bitset = kNone; | 138 int bitset = kNone; |
| 139 for (int i = 0; i < unioned->length(); ++i) { | 139 for (int i = 0; i < Config::union_length(unioned); ++i) { |
| 140 bitset |= Config::union_get(unioned, i)->LubBitset(); | 140 bitset |= Config::union_get(unioned, i)->LubBitset(); |
| 141 } | 141 } |
| 142 return bitset; | 142 return bitset; |
| 143 } else if (this->IsClass()) { | 143 } else if (this->IsClass()) { |
| 144 return LubBitset(*this->AsClass()); | 144 return LubBitset(*this->AsClass()); |
| 145 } else { | 145 } else { |
| 146 return LubBitset(*this->AsConstant()); | 146 return LubBitset(*this->AsConstant()); |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 if (that->IsClass()) { | 292 if (that->IsClass()) { |
| 293 return this->IsClass() && *this->AsClass() == *that->AsClass(); | 293 return this->IsClass() && *this->AsClass() == *that->AsClass(); |
| 294 } | 294 } |
| 295 if (that->IsConstant()) { | 295 if (that->IsConstant()) { |
| 296 return this->IsConstant() && *this->AsConstant() == *that->AsConstant(); | 296 return this->IsConstant() && *this->AsConstant() == *that->AsConstant(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 // (T1 \/ ... \/ Tn) <= T <=> (T1 <= T) /\ ... /\ (Tn <= T) | 299 // (T1 \/ ... \/ Tn) <= T <=> (T1 <= T) /\ ... /\ (Tn <= T) |
| 300 if (this->IsUnion()) { | 300 if (this->IsUnion()) { |
| 301 UnionedHandle unioned = this->AsUnion(); | 301 UnionedHandle unioned = this->AsUnion(); |
| 302 for (int i = 0; i < unioned->length(); ++i) { | 302 for (int i = 0; i < Config::union_length(unioned); ++i) { |
| 303 TypeHandle this_i = Config::union_get(unioned, i); | 303 TypeHandle this_i = Config::union_get(unioned, i); |
| 304 if (!this_i->Is(that)) return false; | 304 if (!this_i->Is(that)) return false; |
| 305 } | 305 } |
| 306 return true; | 306 return true; |
| 307 } | 307 } |
| 308 | 308 |
| 309 // T <= (T1 \/ ... \/ Tn) <=> (T <= T1) \/ ... \/ (T <= Tn) | 309 // T <= (T1 \/ ... \/ Tn) <=> (T <= T1) \/ ... \/ (T <= Tn) |
| 310 // (iff T is not a union) | 310 // (iff T is not a union) |
| 311 ASSERT(!this->IsUnion()); | 311 ASSERT(!this->IsUnion()); |
| 312 if (that->IsUnion()) { | 312 if (that->IsUnion()) { |
| 313 UnionedHandle unioned = that->AsUnion(); | 313 UnionedHandle unioned = that->AsUnion(); |
| 314 for (int i = 0; i < unioned->length(); ++i) { | 314 for (int i = 0; i < Config::union_length(unioned); ++i) { |
| 315 TypeHandle that_i = Config::union_get(unioned, i); | 315 TypeHandle that_i = Config::union_get(unioned, i); |
| 316 if (this->Is(that_i)) return true; | 316 if (this->Is(that_i)) return true; |
| 317 if (this->IsBitset()) break; // Fast fail, only first field is a bitset. | 317 if (this->IsBitset()) break; // Fast fail, only first field is a bitset. |
| 318 } | 318 } |
| 319 return false; | 319 return false; |
| 320 } | 320 } |
| 321 | 321 |
| 322 return false; | 322 return false; |
| 323 } | 323 } |
| 324 | 324 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 339 if (this->IsBitset()) { | 339 if (this->IsBitset()) { |
| 340 return (this->AsBitset() & that->LubBitset()) != 0; | 340 return (this->AsBitset() & that->LubBitset()) != 0; |
| 341 } | 341 } |
| 342 if (that->IsBitset()) { | 342 if (that->IsBitset()) { |
| 343 return (this->LubBitset() & that->AsBitset()) != 0; | 343 return (this->LubBitset() & that->AsBitset()) != 0; |
| 344 } | 344 } |
| 345 | 345 |
| 346 // (T1 \/ ... \/ Tn) overlaps T <=> (T1 overlaps T) \/ ... \/ (Tn overlaps T) | 346 // (T1 \/ ... \/ Tn) overlaps T <=> (T1 overlaps T) \/ ... \/ (Tn overlaps T) |
| 347 if (this->IsUnion()) { | 347 if (this->IsUnion()) { |
| 348 UnionedHandle unioned = this->AsUnion(); | 348 UnionedHandle unioned = this->AsUnion(); |
| 349 for (int i = 0; i < unioned->length(); ++i) { | 349 for (int i = 0; i < Config::union_length(unioned); ++i) { |
| 350 TypeHandle this_i = Config::union_get(unioned, i); | 350 TypeHandle this_i = Config::union_get(unioned, i); |
| 351 if (this_i->Maybe(that)) return true; | 351 if (this_i->Maybe(that)) return true; |
| 352 } | 352 } |
| 353 return false; | 353 return false; |
| 354 } | 354 } |
| 355 | 355 |
| 356 // T overlaps (T1 \/ ... \/ Tn) <=> (T overlaps T1) \/ ... \/ (T overlaps Tn) | 356 // T overlaps (T1 \/ ... \/ Tn) <=> (T overlaps T1) \/ ... \/ (T overlaps Tn) |
| 357 if (that->IsUnion()) { | 357 if (that->IsUnion()) { |
| 358 UnionedHandle unioned = that->AsUnion(); | 358 UnionedHandle unioned = that->AsUnion(); |
| 359 for (int i = 0; i < unioned->length(); ++i) { | 359 for (int i = 0; i < Config::union_length(unioned); ++i) { |
| 360 TypeHandle that_i = Config::union_get(unioned, i); | 360 TypeHandle that_i = Config::union_get(unioned, i); |
| 361 if (this->Maybe(that_i)) return true; | 361 if (this->Maybe(that_i)) return true; |
| 362 } | 362 } |
| 363 return false; | 363 return false; |
| 364 } | 364 } |
| 365 | 365 |
| 366 ASSERT(!this->IsUnion() && !that->IsUnion()); | 366 ASSERT(!this->IsUnion() && !that->IsUnion()); |
| 367 if (this->IsClass()) { | 367 if (this->IsClass()) { |
| 368 return that->IsClass() && *this->AsClass() == *that->AsClass(); | 368 return that->IsClass() && *this->AsClass() == *that->AsClass(); |
| 369 } | 369 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 382 TypeHandle type = Config::union_get(unioned, i); | 382 TypeHandle type = Config::union_get(unioned, i); |
| 383 if (this->Is(type)) return true; | 383 if (this->Is(type)) return true; |
| 384 } | 384 } |
| 385 return false; | 385 return false; |
| 386 } | 386 } |
| 387 | 387 |
| 388 | 388 |
| 389 // Get non-bitsets from this which are not subsumed by union, store at unioned, | 389 // Get non-bitsets from this which are not subsumed by union, store at unioned, |
| 390 // starting at index. Returns updated index. | 390 // starting at index. Returns updated index. |
| 391 template<class Config> | 391 template<class Config> |
| 392 int TypeImpl<Config>::ExtendUnion(UnionedHandle result, int current_size) { | 392 int TypeImpl<Config>::ExtendUnion( |
| 393 UnionedHandle result, TypeHandle type, int current_size) { |
| 393 int old_size = current_size; | 394 int old_size = current_size; |
| 394 if (this->IsClass() || this->IsConstant()) { | 395 if (type->IsClass() || type->IsConstant()) { |
| 395 if (!this->InUnion(result, old_size)) result->set(current_size++, this); | 396 if (!type->InUnion(result, old_size)) { |
| 396 } else if (this->IsUnion()) { | 397 Config::union_set(result, current_size++, type); |
| 397 UnionedHandle unioned = this->AsUnion(); | 398 } |
| 398 for (int i = 0; i < unioned->length(); ++i) { | 399 } else if (type->IsUnion()) { |
| 400 UnionedHandle unioned = type->AsUnion(); |
| 401 for (int i = 0; i < Config::union_length(unioned); ++i) { |
| 399 TypeHandle type = Config::union_get(unioned, i); | 402 TypeHandle type = Config::union_get(unioned, i); |
| 400 ASSERT(i == 0 || | 403 ASSERT(i == 0 || |
| 401 !(type->IsBitset() || type->Is(Config::union_get(unioned, 0)))); | 404 !(type->IsBitset() || type->Is(Config::union_get(unioned, 0)))); |
| 402 if (!type->IsBitset() && !type->InUnion(result, old_size)) { | 405 if (!type->IsBitset() && !type->InUnion(result, old_size)) { |
| 403 result->set(current_size++, *type); | 406 Config::union_set(result, current_size++, type); |
| 404 } | 407 } |
| 405 } | 408 } |
| 406 } | 409 } |
| 407 return current_size; | 410 return current_size; |
| 408 } | 411 } |
| 409 | 412 |
| 410 | 413 |
| 411 // Union is O(1) on simple bit unions, but O(n*m) on structured unions. | 414 // Union is O(1) on simple bit unions, but O(n*m) on structured unions. |
| 412 // TODO(rossberg): Should we use object sets somehow? Is it worth it? | 415 // TODO(rossberg): Should we use object sets somehow? Is it worth it? |
| 413 template<class Config> | 416 template<class Config> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 426 | 429 |
| 427 // Semi-fast case: Unioned objects are neither involved nor produced. | 430 // Semi-fast case: Unioned objects are neither involved nor produced. |
| 428 if (!(type1->IsUnion() || type2->IsUnion())) { | 431 if (!(type1->IsUnion() || type2->IsUnion())) { |
| 429 if (type1->Is(type2)) return type2; | 432 if (type1->Is(type2)) return type2; |
| 430 if (type2->Is(type1)) return type1; | 433 if (type2->Is(type1)) return type1; |
| 431 } | 434 } |
| 432 | 435 |
| 433 // Slow case: may need to produce a Unioned object. | 436 // Slow case: may need to produce a Unioned object. |
| 434 int size = type1->IsBitset() || type2->IsBitset() ? 1 : 0; | 437 int size = type1->IsBitset() || type2->IsBitset() ? 1 : 0; |
| 435 if (!type1->IsBitset()) { | 438 if (!type1->IsBitset()) { |
| 436 size += (type1->IsUnion() ? type1->AsUnion()->length() : 1); | 439 size += (type1->IsUnion() ? Config::union_length(type1->AsUnion()) : 1); |
| 437 } | 440 } |
| 438 if (!type2->IsBitset()) { | 441 if (!type2->IsBitset()) { |
| 439 size += (type2->IsUnion() ? type2->AsUnion()->length() : 1); | 442 size += (type2->IsUnion() ? Config::union_length(type2->AsUnion()) : 1); |
| 440 } | 443 } |
| 441 ASSERT(size >= 2); | 444 ASSERT(size >= 2); |
| 442 UnionedHandle unioned = Config::union_create(size, region); | 445 UnionedHandle unioned = Config::union_create(size, region); |
| 443 size = 0; | 446 size = 0; |
| 444 | 447 |
| 445 int bitset = type1->GlbBitset() | type2->GlbBitset(); | 448 int bitset = type1->GlbBitset() | type2->GlbBitset(); |
| 446 if (bitset != kNone) unioned->set(size++, Config::from_bitset(bitset)); | 449 if (bitset != kNone) { |
| 447 size = type1->ExtendUnion(unioned, size); | 450 Config::union_set(unioned, size++, Config::from_bitset(bitset, region)); |
| 448 size = type2->ExtendUnion(unioned, size); | 451 } |
| 452 size = ExtendUnion(unioned, type1, size); |
| 453 size = ExtendUnion(unioned, type2, size); |
| 449 | 454 |
| 450 if (size == 1) { | 455 if (size == 1) { |
| 451 return Config::union_get(unioned, 0); | 456 return Config::union_get(unioned, 0); |
| 452 } else if (size == unioned->length()) { | 457 } else { |
| 458 Config::union_shrink(unioned, size); |
| 453 return Config::from_union(unioned); | 459 return Config::from_union(unioned); |
| 454 } | 460 } |
| 455 | |
| 456 // There was an overlap. Copy to smaller union. | |
| 457 UnionedHandle result = Config::union_create(size, region); | |
| 458 for (int i = 0; i < size; ++i) result->set(i, unioned->get(i)); | |
| 459 return Config::from_union(result); | |
| 460 } | 461 } |
| 461 | 462 |
| 462 | 463 |
| 463 // Get non-bitsets from this which are also in that, store at unioned, | 464 // Get non-bitsets from type which are also in other, store at unioned, |
| 464 // starting at index. Returns updated index. | 465 // starting at index. Returns updated index. |
| 465 template<class Config> | 466 template<class Config> |
| 466 int TypeImpl<Config>::ExtendIntersection( | 467 int TypeImpl<Config>::ExtendIntersection( |
| 467 UnionedHandle result, TypeHandle that, int current_size) { | 468 UnionedHandle result, TypeHandle type, TypeHandle other, int current_size) { |
| 468 int old_size = current_size; | 469 int old_size = current_size; |
| 469 if (this->IsClass() || this->IsConstant()) { | 470 if (type->IsClass() || type->IsConstant()) { |
| 470 if (this->Is(that) && !this->InUnion(result, old_size)) | 471 if (type->Is(other) && !type->InUnion(result, old_size)) { |
| 471 result->set(current_size++, this); | 472 Config::union_set(result, current_size++, type); |
| 472 } else if (this->IsUnion()) { | 473 } |
| 473 UnionedHandle unioned = this->AsUnion(); | 474 } else if (type->IsUnion()) { |
| 474 for (int i = 0; i < unioned->length(); ++i) { | 475 UnionedHandle unioned = type->AsUnion(); |
| 476 for (int i = 0; i < Config::union_length(unioned); ++i) { |
| 475 TypeHandle type = Config::union_get(unioned, i); | 477 TypeHandle type = Config::union_get(unioned, i); |
| 476 ASSERT(i == 0 || | 478 ASSERT(i == 0 || |
| 477 !(type->IsBitset() || type->Is(Config::union_get(unioned, 0)))); | 479 !(type->IsBitset() || type->Is(Config::union_get(unioned, 0)))); |
| 478 if (!type->IsBitset() && type->Is(that) && | 480 if (!type->IsBitset() && type->Is(other) && |
| 479 !type->InUnion(result, old_size)) { | 481 !type->InUnion(result, old_size)) { |
| 480 result->set(current_size++, *type); | 482 Config::union_set(result, current_size++, type); |
| 481 } | 483 } |
| 482 } | 484 } |
| 483 } | 485 } |
| 484 return current_size; | 486 return current_size; |
| 485 } | 487 } |
| 486 | 488 |
| 487 | 489 |
| 488 // Intersection is O(1) on simple bit unions, but O(n*m) on structured unions. | 490 // Intersection is O(1) on simple bit unions, but O(n*m) on structured unions. |
| 489 // TODO(rossberg): Should we use object sets somehow? Is it worth it? | 491 // TODO(rossberg): Should we use object sets somehow? Is it worth it? |
| 490 template<class Config> | 492 template<class Config> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 503 | 505 |
| 504 // Semi-fast case: Unioned objects are neither involved nor produced. | 506 // Semi-fast case: Unioned objects are neither involved nor produced. |
| 505 if (!(type1->IsUnion() || type2->IsUnion())) { | 507 if (!(type1->IsUnion() || type2->IsUnion())) { |
| 506 if (type1->Is(type2)) return type1; | 508 if (type1->Is(type2)) return type1; |
| 507 if (type2->Is(type1)) return type2; | 509 if (type2->Is(type1)) return type2; |
| 508 } | 510 } |
| 509 | 511 |
| 510 // Slow case: may need to produce a Unioned object. | 512 // Slow case: may need to produce a Unioned object. |
| 511 int size = 0; | 513 int size = 0; |
| 512 if (!type1->IsBitset()) { | 514 if (!type1->IsBitset()) { |
| 513 size = (type1->IsUnion() ? type1->AsUnion()->length() : 2); | 515 size = (type1->IsUnion() ? Config::union_length(type1->AsUnion()) : 2); |
| 514 } | 516 } |
| 515 if (!type2->IsBitset()) { | 517 if (!type2->IsBitset()) { |
| 516 int size2 = (type2->IsUnion() ? type2->AsUnion()->length() : 2); | 518 int size2 = (type2->IsUnion() ? Config::union_length(type2->AsUnion()) : 2); |
| 517 size = (size == 0 ? size2 : Min(size, size2)); | 519 size = (size == 0 ? size2 : Min(size, size2)); |
| 518 } | 520 } |
| 519 ASSERT(size >= 2); | 521 ASSERT(size >= 2); |
| 520 UnionedHandle unioned = Config::union_create(size, region); | 522 UnionedHandle unioned = Config::union_create(size, region); |
| 521 size = 0; | 523 size = 0; |
| 522 | 524 |
| 523 int bitset = type1->GlbBitset() & type2->GlbBitset(); | 525 int bitset = type1->GlbBitset() & type2->GlbBitset(); |
| 524 if (bitset != kNone) unioned->set(size++, Config::from_bitset(bitset)); | 526 if (bitset != kNone) { |
| 525 size = type1->ExtendIntersection(unioned, type2, size); | 527 Config::union_set(unioned, size++, Config::from_bitset(bitset, region)); |
| 526 size = type2->ExtendIntersection(unioned, type1, size); | 528 } |
| 529 size = ExtendIntersection(unioned, type1, type2, size); |
| 530 size = ExtendIntersection(unioned, type2, type1, size); |
| 527 | 531 |
| 528 if (size == 0) { | 532 if (size == 0) { |
| 529 return None(region); | 533 return None(region); |
| 530 } else if (size == 1) { | 534 } else if (size == 1) { |
| 531 return Config::union_get(unioned, 0); | 535 return Config::union_get(unioned, 0); |
| 532 } else if (size == unioned->length()) { | 536 } else { |
| 537 Config::union_shrink(unioned, size); |
| 533 return Config::from_union(unioned); | 538 return Config::from_union(unioned); |
| 534 } | 539 } |
| 535 | |
| 536 // There were dropped cases. Copy to smaller union. | |
| 537 UnionedHandle result = Config::union_create(size, region); | |
| 538 for (int i = 0; i < size; ++i) result->set(i, unioned->get(i)); | |
| 539 return Config::from_union(result); | |
| 540 } | 540 } |
| 541 | 541 |
| 542 | 542 |
| 543 // TODO(rossberg): this does not belong here. | 543 // TODO(rossberg): this does not belong here. |
| 544 Representation Representation::FromType(Handle<Type> type) { | 544 Representation Representation::FromType(Handle<Type> type) { |
| 545 if (type->Is(Type::None())) return Representation::None(); | 545 if (type->Is(Type::None())) return Representation::None(); |
| 546 if (type->Is(Type::Smi())) return Representation::Smi(); | 546 if (type->Is(Type::Smi())) return Representation::Smi(); |
| 547 if (type->Is(Type::Signed32())) return Representation::Integer32(); | 547 if (type->Is(Type::Signed32())) return Representation::Integer32(); |
| 548 if (type->Is(Type::Number())) return Representation::Double(); | 548 if (type->Is(Type::Number())) return Representation::Double(); |
| 549 return Representation::Tagged(); | 549 return Representation::Tagged(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 PrintF(out, "Constant(%p : ", static_cast<void*>(*this->AsConstant())); | 594 PrintF(out, "Constant(%p : ", static_cast<void*>(*this->AsConstant())); |
| 595 Config::from_bitset(this->LubBitset())->TypePrint(out); | 595 Config::from_bitset(this->LubBitset())->TypePrint(out); |
| 596 PrintF(")"); | 596 PrintF(")"); |
| 597 } else if (this->IsClass()) { | 597 } else if (this->IsClass()) { |
| 598 PrintF(out, "Class(%p < ", static_cast<void*>(*this->AsClass())); | 598 PrintF(out, "Class(%p < ", static_cast<void*>(*this->AsClass())); |
| 599 Config::from_bitset(this->LubBitset())->TypePrint(out); | 599 Config::from_bitset(this->LubBitset())->TypePrint(out); |
| 600 PrintF(")"); | 600 PrintF(")"); |
| 601 } else if (this->IsUnion()) { | 601 } else if (this->IsUnion()) { |
| 602 PrintF(out, "("); | 602 PrintF(out, "("); |
| 603 UnionedHandle unioned = this->AsUnion(); | 603 UnionedHandle unioned = this->AsUnion(); |
| 604 for (int i = 0; i < unioned->length(); ++i) { | 604 for (int i = 0; i < Config::union_length(unioned); ++i) { |
| 605 TypeHandle type_i = Config::union_get(unioned, i); | 605 TypeHandle type_i = Config::union_get(unioned, i); |
| 606 if (i > 0) PrintF(out, " | "); | 606 if (i > 0) PrintF(out, " | "); |
| 607 type_i->TypePrint(out); | 607 type_i->TypePrint(out); |
| 608 } | 608 } |
| 609 PrintF(out, ")"); | 609 PrintF(out, ")"); |
| 610 } | 610 } |
| 611 } | 611 } |
| 612 #endif | 612 #endif |
| 613 | 613 |
| 614 | 614 |
| 615 template class TypeImpl<ZoneTypeConfig>; |
| 616 template class TypeImpl<ZoneTypeConfig>::Iterator<i::Map>; |
| 617 template class TypeImpl<ZoneTypeConfig>::Iterator<i::Object>; |
| 618 |
| 615 template class TypeImpl<HeapTypeConfig>; | 619 template class TypeImpl<HeapTypeConfig>; |
| 616 template class TypeImpl<HeapTypeConfig>::Iterator<i::Map>; | 620 template class TypeImpl<HeapTypeConfig>::Iterator<i::Map>; |
| 617 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; | 621 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; |
| 618 | 622 |
| 619 | 623 |
| 620 } } // namespace v8::internal | 624 } } // namespace v8::internal |
| OLD | NEW |