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

Side by Side Diff: src/types.cc

Issue 795713003: Steps towards unification of number bitset and range types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix BitsetType::Max for OtherNumber with missing representation Created 6 years 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <iomanip> 5 #include <iomanip>
6 6
7 #include "src/types.h" 7 #include "src/types.h"
8 8
9 #include "src/ostreams.h" 9 #include "src/ostreams.h"
10 #include "src/types-inl.h" 10 #include "src/types-inl.h"
(...skipping 10 matching lines...) Expand all
21 // Range-related helper functions. 21 // Range-related helper functions.
22 22
23 // The result may be invalid (max < min). 23 // The result may be invalid (max < min).
24 template<class Config> 24 template<class Config>
25 typename TypeImpl<Config>::Limits TypeImpl<Config>::Intersect( 25 typename TypeImpl<Config>::Limits TypeImpl<Config>::Intersect(
26 Limits lhs, Limits rhs) { 26 Limits lhs, Limits rhs) {
27 DisallowHeapAllocation no_allocation; 27 DisallowHeapAllocation no_allocation;
28 Limits result(lhs); 28 Limits result(lhs);
29 if (lhs.min->Number() < rhs.min->Number()) result.min = rhs.min; 29 if (lhs.min->Number() < rhs.min->Number()) result.min = rhs.min;
30 if (lhs.max->Number() > rhs.max->Number()) result.max = rhs.max; 30 if (lhs.max->Number() > rhs.max->Number()) result.max = rhs.max;
31 result.representation = lhs.representation & rhs.representation;
31 return result; 32 return result;
32 } 33 }
33 34
34 35
35 template<class Config> 36 template <class Config>
36 typename TypeImpl<Config>::Limits TypeImpl<Config>::Union( 37 bool TypeImpl<Config>::IsEmpty(Limits lim) {
37 Limits lhs, Limits rhs) { 38 return lim.representation == BitsetType::kNone ||
39 lim.min->Number() > lim.max->Number();
40 }
41
42
43 template <class Config>
44 typename TypeImpl<Config>::Limits TypeImpl<Config>::Union(Limits lhs,
45 Limits rhs) {
38 DisallowHeapAllocation no_allocation; 46 DisallowHeapAllocation no_allocation;
47 // Handle the case of empty operand, so that we do not stretch
rossberg 2014/12/12 13:57:50 So this seems to be a case of violating the point-
Jarin 2015/01/08 14:30:27 Yes, there is more of these - fixing this does not
48 // the limits/representations for them.
49 if (IsEmpty(lhs)) return rhs;
50 if (IsEmpty(rhs)) return lhs;
51
39 Limits result(lhs); 52 Limits result(lhs);
40 if (lhs.min->Number() > rhs.min->Number()) result.min = rhs.min; 53 if (lhs.min->Number() > rhs.min->Number()) result.min = rhs.min;
41 if (lhs.max->Number() < rhs.max->Number()) result.max = rhs.max; 54 if (lhs.max->Number() < rhs.max->Number()) result.max = rhs.max;
55 result.representation = lhs.representation | rhs.representation;
42 return result; 56 return result;
43 } 57 }
44 58
45 59
46 template<class Config> 60 template<class Config>
47 bool TypeImpl<Config>::Overlap( 61 bool TypeImpl<Config>::Overlap(
48 typename TypeImpl<Config>::RangeType* lhs, 62 typename TypeImpl<Config>::RangeType* lhs,
49 typename TypeImpl<Config>::RangeType* rhs) { 63 typename TypeImpl<Config>::RangeType* rhs) {
50 DisallowHeapAllocation no_allocation; 64 DisallowHeapAllocation no_allocation;
51 typename TypeImpl<Config>::Limits lim = Intersect(Limits(lhs), Limits(rhs)); 65 typename TypeImpl<Config>::Limits lim = Intersect(Limits(lhs), Limits(rhs));
52 return lim.min->Number() <= lim.max->Number(); 66 return lim.min->Number() <= lim.max->Number() &&
67 lim.representation != BitsetType::kNone;
53 } 68 }
54 69
55 70
56 template<class Config> 71 template<class Config>
57 bool TypeImpl<Config>::Contains( 72 bool TypeImpl<Config>::Contains(
58 typename TypeImpl<Config>::RangeType* lhs, 73 typename TypeImpl<Config>::RangeType* lhs,
59 typename TypeImpl<Config>::RangeType* rhs) { 74 typename TypeImpl<Config>::RangeType* rhs) {
60 DisallowHeapAllocation no_allocation; 75 DisallowHeapAllocation no_allocation;
61 return lhs->Min()->Number() <= rhs->Min()->Number() 76 return lhs->Min()->Number() <= rhs->Min()->Number() &&
62 && rhs->Max()->Number() <= lhs->Max()->Number(); 77 rhs->Max()->Number() <= lhs->Max()->Number() &&
78 BitsetType::Is(rhs->Representation(), lhs->Representation());
63 } 79 }
64 80
65 81
82 template <class Config>
83 bool TypeImpl<Config>::Contains(typename TypeImpl<Config>::RangeType* lhs,
rossberg 2014/12/12 13:57:50 Actually, Contains is a misnomer here and above. T
Jarin 2015/01/08 14:30:27 Maybe. Are you suggesting that Contains(RangeType*
rossberg 2015/01/15 15:15:11 Yes, that's perhaps best.
84 typename TypeImpl<Config>::ConstantType* rhs) {
85 DisallowHeapAllocation no_allocation;
86 return IsInteger(*rhs->Value()) &&
87 lhs->Min()->Number() <= rhs->Value()->Number() &&
88 rhs->Value()->Number() <= lhs->Max()->Number() &&
89 BitsetType::Is(rhs->Representation(), lhs->Representation());
90 }
91
92
66 template<class Config> 93 template<class Config>
67 bool TypeImpl<Config>::Contains( 94 bool TypeImpl<Config>::Contains(
68 typename TypeImpl<Config>::RangeType* range, i::Object* val) { 95 typename TypeImpl<Config>::RangeType* range, i::Object* val) {
69 DisallowHeapAllocation no_allocation; 96 DisallowHeapAllocation no_allocation;
70 return IsInteger(val) 97 bitset value_representation = REPRESENTATION(BitsetType::Lub(val));
71 && range->Min()->Number() <= val->Number() 98 return IsInteger(val) &&
72 && val->Number() <= range->Max()->Number(); 99 BitsetType::Is(value_representation, range->Representation()) &&
100 range->Min()->Number() <= val->Number() &&
101 val->Number() <= range->Max()->Number();
73 } 102 }
74 103
75 104
76 // ----------------------------------------------------------------------------- 105 // -----------------------------------------------------------------------------
77 // Min and Max computation. 106 // Min and Max computation.
78 107
79 template<class Config> 108 template<class Config>
80 double TypeImpl<Config>::Min() { 109 double TypeImpl<Config>::Min() {
81 DCHECK(this->Is(Number())); 110 DCHECK(this->Is(Number()));
82 if (this->IsBitset()) return BitsetType::Min(this->AsBitset()); 111 if (this->IsBitset()) return BitsetType::Min(this->AsBitset());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 147
119 // The largest bitset subsumed by this type. 148 // The largest bitset subsumed by this type.
120 template<class Config> 149 template<class Config>
121 typename TypeImpl<Config>::bitset 150 typename TypeImpl<Config>::bitset
122 TypeImpl<Config>::BitsetType::Glb(TypeImpl* type) { 151 TypeImpl<Config>::BitsetType::Glb(TypeImpl* type) {
123 DisallowHeapAllocation no_allocation; 152 DisallowHeapAllocation no_allocation;
124 if (type->IsBitset()) { 153 if (type->IsBitset()) {
125 return type->AsBitset(); 154 return type->AsBitset();
126 } else if (type->IsUnion()) { 155 } else if (type->IsUnion()) {
127 SLOW_DCHECK(type->AsUnion()->Wellformed()); 156 SLOW_DCHECK(type->AsUnion()->Wellformed());
128 return type->AsUnion()->Get(0)->BitsetGlb(); // Shortcut. 157 return type->AsUnion()->Get(0)->BitsetGlb() |
158 type->AsUnion()->Get(1)->BitsetGlb(); // Shortcut.
159 } else if (type->IsRange()) {
160 bitset glb = SEMANTIC(BitsetType::Glb(type->AsRange()->Min()->Number(),
161 type->AsRange()->Max()->Number()));
162 if (glb == 0) {
rossberg 2014/12/12 13:57:50 (This seems to be another violation of point-wise.
Jarin 2015/01/08 14:30:27 Unfortunately, I had tests failing because there w
163 return kNone;
164 } else {
165 return glb | type->AsRange()->Representation();
166 }
129 // (The remaining BitsetGlb's are None anyway). 167 // (The remaining BitsetGlb's are None anyway).
rossberg 2014/12/12 13:57:50 Nit: While we're here, can you move this comment d
Jarin 2015/01/08 14:30:27 Done.
130 } else { 168 } else {
131 return kNone; 169 return kNone;
132 } 170 }
133 } 171 }
134 172
135 173
136 // The smallest bitset subsuming this type. 174 // The smallest bitset subsuming this type.
137 template<class Config> 175 template<class Config>
138 typename TypeImpl<Config>::bitset 176 typename TypeImpl<Config>::bitset
139 TypeImpl<Config>::BitsetType::Lub(TypeImpl* type) { 177 TypeImpl<Config>::BitsetType::Lub(TypeImpl* type) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 typename TypeImpl<Config>::bitset 314 typename TypeImpl<Config>::bitset
277 TypeImpl<Config>::BitsetType::Lub(double value) { 315 TypeImpl<Config>::BitsetType::Lub(double value) {
278 DisallowHeapAllocation no_allocation; 316 DisallowHeapAllocation no_allocation;
279 if (i::IsMinusZero(value)) return kMinusZero; 317 if (i::IsMinusZero(value)) return kMinusZero;
280 if (std::isnan(value)) return kNaN; 318 if (std::isnan(value)) return kNaN;
281 if (IsUint32Double(value) || IsInt32Double(value)) return Lub(value, value); 319 if (IsUint32Double(value) || IsInt32Double(value)) return Lub(value, value);
282 return kPlainNumber; 320 return kPlainNumber;
283 } 321 }
284 322
285 323
286 // Minimum values of regular numeric bitsets when SmiValuesAre31Bits. 324 // Minimum values of regular numeric bitsets.
287 template <class Config> 325 template <class Config>
288 const typename TypeImpl<Config>::BitsetType::BitsetMin 326 const typename TypeImpl<Config>::BitsetType::BitsetMin
289 TypeImpl<Config>::BitsetType::BitsetMins31[] = { 327 TypeImpl<Config>::BitsetType::BitsetMinsArray[] = {
290 {kOtherNumber, -V8_INFINITY}, 328 {kOtherNumber, -V8_INFINITY},
291 {kOtherSigned32, kMinInt}, 329 {kOtherSigned32, kMinInt},
292 {kNegativeSignedSmall, -0x40000000}, 330 {kNegative31, -0x40000000},
293 {kUnsignedSmall, 0}, 331 {kUnsigned30, 0},
294 {kOtherUnsigned31, 0x40000000}, 332 {kOtherUnsigned31, 0x40000000},
295 {kOtherUnsigned32, 0x80000000}, 333 {kOtherUnsigned32, 0x80000000},
296 {kOtherNumber, static_cast<double>(kMaxUInt32) + 1}}; 334 {kOtherNumber, static_cast<double>(kMaxUInt32) + 1}};
297 335
298 336
299 // Minimum values of regular numeric bitsets when SmiValuesAre32Bits.
300 // OtherSigned32 and OtherUnsigned31 are empty (see the diagrams in types.h).
301 template <class Config>
302 const typename TypeImpl<Config>::BitsetType::BitsetMin
303 TypeImpl<Config>::BitsetType::BitsetMins32[] = {
304 {kOtherNumber, -V8_INFINITY},
305 {kNegativeSignedSmall, kMinInt},
306 {kUnsignedSmall, 0},
307 {kOtherUnsigned32, 0x80000000},
308 {kOtherNumber, static_cast<double>(kMaxUInt32) + 1}};
309
310
311 template<class Config> 337 template<class Config>
312 typename TypeImpl<Config>::bitset 338 typename TypeImpl<Config>::bitset
313 TypeImpl<Config>::BitsetType::Lub(double min, double max) { 339 TypeImpl<Config>::BitsetType::Lub(double min, double max) {
314 DisallowHeapAllocation no_allocation; 340 DisallowHeapAllocation no_allocation;
315 int lub = kNone; 341 int lub = kNone;
316 const BitsetMin* mins = BitsetMins(); 342 const BitsetMin* mins = BitsetMins();
317 343
318 // Make sure the min-max range touches 0, so we are guaranteed no holes 344 // Make sure the min-max range touches 0, so we are guaranteed no holes
319 // in unions of valid bitsets. 345 // in unions of valid bitsets.
320 if (max < -1) max = -1; 346 if (max < -1) max = -1;
321 if (min > 0) min = 0; 347 if (min > 0) min = 0;
322 348
323 for (size_t i = 1; i < BitsetMinsSize(); ++i) { 349 for (size_t i = 1; i < BitsetMinsSize(); ++i) {
324 if (min < mins[i].min) { 350 if (min < mins[i].min) {
325 lub |= mins[i-1].bits; 351 lub |= mins[i-1].bits;
326 if (max < mins[i].min) return lub; 352 if (max < mins[i].min) return lub;
327 } 353 }
328 } 354 }
329 return lub |= mins[BitsetMinsSize()-1].bits; 355 return lub |= mins[BitsetMinsSize()-1].bits;
330 } 356 }
331 357
332 358
333 template<class Config> 359 template <class Config>
360 typename TypeImpl<Config>::bitset TypeImpl<Config>::BitsetType::Glb(
361 double min, double max) {
362 DisallowHeapAllocation no_allocation;
363 int glb = kNone;
364 const BitsetMin* mins = BitsetMins();
365
366 // If the range does not touch 0, the bound is empty.
367 if (max < -1) return glb;
368 if (min > 0) return glb;
rossberg 2014/12/12 13:57:51 Nit: merge with previous line.
Jarin 2015/01/08 14:30:27 Done.
369
370 for (size_t i = 1; i < BitsetMinsSize(); ++i) {
371 if (min <= mins[i].min) {
372 if (i + 1 < BitsetMinsSize() && max + 1 < mins[i + 1].min) break;
373 glb |= mins[i].bits;
374 }
375 }
376 // OtherNumber also contains float numbers, so it can never be
377 // in the greatest lower bound. (There is also the small trouble
378 // of kOtherNumber having a range hole, which we can conveniently
379 // ignore here.)
380 return glb & ~(SEMANTIC(kOtherNumber));
381 }
382
383
384 template <class Config>
334 double TypeImpl<Config>::BitsetType::Min(bitset bits) { 385 double TypeImpl<Config>::BitsetType::Min(bitset bits) {
335 DisallowHeapAllocation no_allocation; 386 DisallowHeapAllocation no_allocation;
336 DCHECK(Is(bits, kNumber)); 387 DCHECK(Is(bits, kNumber));
337 const BitsetMin* mins = BitsetMins(); 388 const BitsetMin* mins = BitsetMins();
338 bool mz = SEMANTIC(bits & kMinusZero); 389 bool mz = SEMANTIC(bits & kMinusZero);
339 for (size_t i = 0; i < BitsetMinsSize(); ++i) { 390 for (size_t i = 0; i < BitsetMinsSize(); ++i) {
340 if (Is(SEMANTIC(mins[i].bits), bits)) { 391 if (Is(SEMANTIC(mins[i].bits), bits)) {
341 return mz ? std::min(0.0, mins[i].min) : mins[i].min; 392 return mz ? std::min(0.0, mins[i].min) : mins[i].min;
342 } 393 }
343 } 394 }
344 if (mz) return 0; 395 if (mz) return 0;
345 return base::OS::nan_value(); 396 return base::OS::nan_value();
346 } 397 }
347 398
348 399
349 template<class Config> 400 template<class Config>
350 double TypeImpl<Config>::BitsetType::Max(bitset bits) { 401 double TypeImpl<Config>::BitsetType::Max(bitset bits) {
351 DisallowHeapAllocation no_allocation; 402 DisallowHeapAllocation no_allocation;
352 DCHECK(Is(bits, kNumber)); 403 DCHECK(Is(bits, kNumber));
353 const BitsetMin* mins = BitsetMins(); 404 const BitsetMin* mins = BitsetMins();
354 bool mz = SEMANTIC(bits & kMinusZero); 405 bool mz = SEMANTIC(bits & kMinusZero);
355 if (BitsetType::Is(mins[BitsetMinsSize()-1].bits, bits)) { 406 if (BitsetType::Is(SEMANTIC(mins[BitsetMinsSize() - 1].bits), bits)) {
356 return +V8_INFINITY; 407 return +V8_INFINITY;
357 } 408 }
358 for (size_t i = BitsetMinsSize()-1; i-- > 0; ) { 409 for (size_t i = BitsetMinsSize()-1; i-- > 0; ) {
359 if (Is(SEMANTIC(mins[i].bits), bits)) { 410 if (Is(SEMANTIC(mins[i].bits), bits)) {
360 return mz ? 411 return mz ?
361 std::max(0.0, mins[i+1].min - 1) : mins[i+1].min - 1; 412 std::max(0.0, mins[i+1].min - 1) : mins[i+1].min - 1;
362 } 413 }
363 } 414 }
364 if (mz) return 0; 415 if (mz) return 0;
365 return base::OS::nan_value(); 416 return base::OS::nan_value();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 for (int i = 0, n = this_fun->Arity(); i < n; ++i) { 452 for (int i = 0, n = this_fun->Arity(); i < n; ++i) {
402 if (!this_fun->Parameter(i)->Equals(that_fun->Parameter(i))) return false; 453 if (!this_fun->Parameter(i)->Equals(that_fun->Parameter(i))) return false;
403 } 454 }
404 return true; 455 return true;
405 } 456 }
406 UNREACHABLE(); 457 UNREACHABLE();
407 return false; 458 return false;
408 } 459 }
409 460
410 461
462 template <class Config>
463 typename TypeImpl<Config>::bitset TypeImpl<Config>::SignedSmallBits() {
464 return i::SmiValuesAre31Bits() ? BitsetType::kSigned31
465 : BitsetType::kSigned32;
466 }
467
468
469 template <class Config>
470 typename TypeImpl<Config>::bitset TypeImpl<Config>::UnsignedSmallBits() {
471 return i::SmiValuesAre31Bits() ? BitsetType::kUnsigned30
472 : BitsetType::kUnsigned31;
473 }
474
475
411 // Check if [this] <= [that]. 476 // Check if [this] <= [that].
412 template<class Config> 477 template<class Config>
413 bool TypeImpl<Config>::SlowIs(TypeImpl* that) { 478 bool TypeImpl<Config>::SlowIs(TypeImpl* that) {
414 DisallowHeapAllocation no_allocation; 479 DisallowHeapAllocation no_allocation;
415 480
416 if (that->IsBitset()) { 481 if (that->IsBitset()) {
417 return BitsetType::Is(this->BitsetLub(), that->AsBitset()); 482 return BitsetType::Is(this->BitsetLub(), that->AsBitset());
418 } 483 }
419 if (this->IsBitset()) { 484 if (this->IsBitset()) {
420 return BitsetType::Is(this->AsBitset(), that->BitsetGlb()); 485 return BitsetType::Is(this->AsBitset(), that->BitsetGlb());
(...skipping 10 matching lines...) Expand all
431 // T <= (T1 \/ ... \/ Tn) if (T <= T1) \/ ... \/ (T <= Tn) 496 // T <= (T1 \/ ... \/ Tn) if (T <= T1) \/ ... \/ (T <= Tn)
432 if (that->IsUnion()) { 497 if (that->IsUnion()) {
433 for (int i = 0, n = that->AsUnion()->Length(); i < n; ++i) { 498 for (int i = 0, n = that->AsUnion()->Length(); i < n; ++i) {
434 if (this->Is(that->AsUnion()->Get(i))) return true; 499 if (this->Is(that->AsUnion()->Get(i))) return true;
435 if (i > 1 && this->IsRange()) return false; // Shortcut. 500 if (i > 1 && this->IsRange()) return false; // Shortcut.
436 } 501 }
437 return false; 502 return false;
438 } 503 }
439 504
440 if (that->IsRange()) { 505 if (that->IsRange()) {
441 return (this->IsRange() && Contains(that->AsRange(), this->AsRange())) 506 return (this->IsRange() && Contains(that->AsRange(), this->AsRange())) ||
442 || (this->IsConstant() && 507 (this->IsConstant() &&
443 Contains(that->AsRange(), *this->AsConstant()->Value())); 508 Contains(that->AsRange(), this->AsConstant()));
444 } 509 }
445 if (this->IsRange()) return false; 510 if (this->IsRange()) return false;
446 511
447 return this->SimplyEquals(that); 512 return this->SimplyEquals(that);
448 } 513 }
449 514
450 515
451 template<class Config> 516 template<class Config>
452 bool TypeImpl<Config>::NowIs(TypeImpl* that) { 517 bool TypeImpl<Config>::NowIs(TypeImpl* that) {
453 DisallowHeapAllocation no_allocation; 518 DisallowHeapAllocation no_allocation;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 // T overlaps (T1 \/ ... \/ Tn) if (T overlaps T1) \/ ... \/ (T overlaps Tn) 560 // T overlaps (T1 \/ ... \/ Tn) if (T overlaps T1) \/ ... \/ (T overlaps Tn)
496 if (that->IsUnion()) { 561 if (that->IsUnion()) {
497 for (int i = 0, n = that->AsUnion()->Length(); i < n; ++i) { 562 for (int i = 0, n = that->AsUnion()->Length(); i < n; ++i) {
498 if (this->Maybe(that->AsUnion()->Get(i))) return true; 563 if (this->Maybe(that->AsUnion()->Get(i))) return true;
499 } 564 }
500 return false; 565 return false;
501 } 566 }
502 567
503 if (!BitsetType::IsInhabited(this->BitsetLub() & that->BitsetLub())) 568 if (!BitsetType::IsInhabited(this->BitsetLub() & that->BitsetLub()))
504 return false; 569 return false;
505 if (this->IsBitset() || that->IsBitset()) return true;
rossberg 2014/12/12 13:57:50 I think you want to keep this short-cut to make th
Jarin 2015/01/08 14:30:27 Done.
506
507 if (this->IsClass() != that->IsClass()) return true; 570 if (this->IsClass() != that->IsClass()) return true;
508 571
509 if (this->IsRange()) { 572 if (this->IsRange()) {
510 if (that->IsConstant()) { 573 if (that->IsConstant()) {
511 return Contains(this->AsRange(), *that->AsConstant()->Value()); 574 return Contains(this->AsRange(), that->AsConstant());
512 } 575 }
513 return that->IsRange() && Overlap(this->AsRange(), that->AsRange()); 576 if (that->IsRange()) {
577 return Overlap(this->AsRange(), that->AsRange());
578 }
579 if (that->IsBitset()) {
580 bitset number_bits = BitsetType::NumberBits(that->AsBitset());
581 if (number_bits == BitsetType::kNone) {
582 return false;
583 }
584 if ((REPRESENTATION(that->AsBitset()) &
585 this->AsRange()->Representation()) == BitsetType::kNone) {
586 return false;
587 }
588 double min = std::max(BitsetType::Min(number_bits), this->Min());
589 double max = std::min(BitsetType::Max(number_bits), this->Max());
590 return min <= max;
591 }
514 } 592 }
515 if (that->IsRange()) { 593 if (that->IsRange()) {
516 if (this->IsConstant()) { 594 return that->Maybe(this); // This case is handled above.
517 return Contains(that->AsRange(), *this->AsConstant()->Value());
518 }
519 return this->IsRange() && Overlap(this->AsRange(), that->AsRange());
520 } 595 }
521 596
597 if (this->IsBitset() || that->IsBitset()) return true;
598
522 return this->SimplyEquals(that); 599 return this->SimplyEquals(that);
523 } 600 }
524 601
525 602
526 // Return the range in [this], or [NULL]. 603 // Return the range in [this], or [NULL].
527 template<class Config> 604 template<class Config>
528 typename TypeImpl<Config>::RangeType* TypeImpl<Config>::GetRange() { 605 typename TypeImpl<Config>::RangeType* TypeImpl<Config>::GetRange() {
529 DisallowHeapAllocation no_allocation; 606 DisallowHeapAllocation no_allocation;
530 if (this->IsRange()) return this->AsRange(); 607 if (this->IsRange()) return this->AsRange();
531 if (this->IsUnion() && this->AsUnion()->Get(1)->IsRange()) { 608 if (this->IsUnion() && this->AsUnion()->Get(1)->IsRange()) {
532 return this->AsUnion()->Get(1)->AsRange(); 609 return this->AsUnion()->Get(1)->AsRange();
533 } 610 }
534 return NULL; 611 return NULL;
535 } 612 }
536 613
537 614
538 template<class Config> 615 template<class Config>
539 bool TypeImpl<Config>::Contains(i::Object* value) { 616 bool TypeImpl<Config>::Contains(i::Object* value) {
540 DisallowHeapAllocation no_allocation; 617 DisallowHeapAllocation no_allocation;
541 for (Iterator<i::Object> it = this->Constants(); !it.Done(); it.Advance()) { 618 for (Iterator<i::Object> it = this->Constants(); !it.Done(); it.Advance()) {
542 if (*it.Current() == value) return true; 619 if (*it.Current() == value) return true;
543 } 620 }
544 if (IsInteger(value)) { 621 if (IsInteger(value)) {
545 RangeType* range = this->GetRange(); 622 RangeType* range = this->GetRange();
546 if (range != NULL && Contains(range, value)) return true; 623 if (range != NULL && Contains(range, value)) {
624 return true;
rossberg 2014/12/12 13:57:51 Nit: any reason for this reformat? It's now incons
Jarin 2015/01/08 14:30:27 Done.
625 }
547 } 626 }
548 return BitsetType::New(BitsetType::Lub(value))->Is(this); 627 return BitsetType::New(BitsetType::Lub(value))->Is(this);
549 } 628 }
550 629
551 630
552 template<class Config> 631 template<class Config>
553 bool TypeImpl<Config>::UnionType::Wellformed() { 632 bool TypeImpl<Config>::UnionType::Wellformed() {
554 DisallowHeapAllocation no_allocation; 633 DisallowHeapAllocation no_allocation;
555 // This checks the invariants of the union representation: 634 // This checks the invariants of the union representation:
556 // 1. There are at least two elements. 635 // 1. There are at least two elements.
557 // 2. At most one element is a bitset, and it must be the first one. 636 // 2. If there is a range, then the bitset type does not contain
rossberg 2014/12/12 13:57:50 Nit: move this down two places (or to the end) for
Jarin 2015/01/08 14:30:27 Done.
558 // 3. At most one element is a range, and it must be the second one 637 // plain number bits.
638 // 3. At most one element is a bitset, and it must be the first one.
639 // 4. At most one element is a range, and it must be the second one
559 // (even when the first element is not a bitset). 640 // (even when the first element is not a bitset).
560 // 4. No element is itself a union. 641 // 5. No element is itself a union.
561 // 5. No element is a subtype of any other. 642 // 6. No element is a subtype of any other.
562 DCHECK(this->Length() >= 2); // (1) 643 DCHECK(this->Length() >= 2); // (1)
644
645 bitset number_bits = this->Get(0)->IsBitset()
646 ? BitsetType::NumberBits(this->Get(0)->AsBitset())
647 : 0;
648 DCHECK(!this->Get(1)->IsRange() || (number_bits == 0)); // (2)
649
563 for (int i = 0; i < this->Length(); ++i) { 650 for (int i = 0; i < this->Length(); ++i) {
564 if (i != 0) DCHECK(!this->Get(i)->IsBitset()); // (2) 651 if (i != 0) DCHECK(!this->Get(i)->IsBitset()); // (3)
565 if (i != 1) DCHECK(!this->Get(i)->IsRange()); // (3) 652 if (i != 1) DCHECK(!this->Get(i)->IsRange()); // (4)
566 DCHECK(!this->Get(i)->IsUnion()); // (4) 653 DCHECK(!this->Get(i)->IsUnion()); // (5)
567 for (int j = 0; j < this->Length(); ++j) { 654 for (int j = 0; j < this->Length(); ++j) {
568 if (i != j) DCHECK(!this->Get(i)->Is(this->Get(j))); // (5) 655 if (i != j) DCHECK(!this->Get(i)->Is(this->Get(j))); // (6)
569 } 656 }
570 } 657 }
571 return true; 658 return true;
572 } 659 }
573 660
574 661
575 // ----------------------------------------------------------------------------- 662 // -----------------------------------------------------------------------------
576 // Union and intersection 663 // Union and intersection
577 664
578 665
(...skipping 28 matching lines...) Expand all
607 int size2 = type2->IsUnion() ? type2->AsUnion()->Length() : 1; 694 int size2 = type2->IsUnion() ? type2->AsUnion()->Length() : 1;
608 if (!AddIsSafe(size1, size2)) return Any(region); 695 if (!AddIsSafe(size1, size2)) return Any(region);
609 int size = size1 + size2; 696 int size = size1 + size2;
610 if (!AddIsSafe(size, 2)) return Any(region); 697 if (!AddIsSafe(size, 2)) return Any(region);
611 size += 2; 698 size += 2;
612 UnionHandle result = UnionType::New(size, region); 699 UnionHandle result = UnionType::New(size, region);
613 size = 0; 700 size = 0;
614 701
615 // Deal with bitsets. 702 // Deal with bitsets.
616 result->Set(size++, BitsetType::New(bits, region)); 703 result->Set(size++, BitsetType::New(bits, region));
704 // Insert a placeholder for the range.
705 result->Set(size++, None(region));
617 706
618 // Deal with ranges. 707 Limits lims = Limits::Empty(region);
619 TypeHandle range = None(region); 708 size = IntersectAux(type1, type2, result, size, &lims, region);
620 RangeType* range1 = type1->GetRange(); 709
621 RangeType* range2 = type2->GetRange(); 710 // If the range is not empty, then insert it into the union and
622 if (range1 != NULL && range2 != NULL) { 711 // remove the number bits from the bitset.
623 Limits lim = Intersect(Limits(range1), Limits(range2)); 712 if (!IsEmpty(lims)) {
624 if (lim.min->Number() <= lim.max->Number()) { 713 UpdateRange(RangeType::New(lims, region), result, size, region);
625 range = RangeType::New(lim, region); 714
715 // Remove the number bits.
716 bitset number_bits = BitsetType::NumberBits(bits);
717 bits &= ~number_bits;
718 if (SEMANTIC(bits) == BitsetType::kNone) {
719 bits = BitsetType::kNone;
626 } 720 }
721 result->Set(0, BitsetType::New(bits, region));
627 } 722 }
628 result->Set(size++, range);
629
630 size = IntersectAux(type1, type2, result, size, region);
631 return NormalizeUnion(result, size); 723 return NormalizeUnion(result, size);
632 } 724 }
633 725
634 726
635 template<class Config> 727 template<class Config>
636 int TypeImpl<Config>::UpdateRange( 728 int TypeImpl<Config>::UpdateRange(
637 RangeHandle range, UnionHandle result, int size, Region* region) { 729 RangeHandle range, UnionHandle result, int size, Region* region) {
638 TypeHandle old_range = result->Get(1); 730 TypeHandle old_range = result->Get(1);
639 DCHECK(old_range->IsRange() || old_range->IsNone()); 731 DCHECK(old_range->IsRange() || old_range->IsNone());
640 if (range->Is(old_range)) return size; 732 if (range->Is(old_range)) return size;
641 if (!old_range->Is(range->unhandle())) { 733 if (!old_range->Is(range->unhandle())) {
642 range = RangeType::New( 734 range = RangeType::New(
643 Union(Limits(range->AsRange()), Limits(old_range->AsRange())), region); 735 Union(Limits(range->AsRange()), Limits(old_range->AsRange())), region);
644 } 736 }
645 result->Set(1, range); 737 result->Set(1, range);
646 738
647 // Remove any components that just got subsumed. 739 // Remove any components that just got subsumed.
648 for (int i = 2; i < size; ) { 740 for (int i = 2; i < size; ) {
649 if (result->Get(i)->Is(range->unhandle())) { 741 if (result->Get(i)->Is(range->unhandle())) {
650 result->Set(i, result->Get(--size)); 742 result->Set(i, result->Get(--size));
651 } else { 743 } else {
652 ++i; 744 ++i;
653 } 745 }
654 } 746 }
655 return size; 747 return size;
656 } 748 }
657 749
658 750
659 template<class Config> 751 template <class Config>
660 int TypeImpl<Config>::IntersectAux( 752 typename TypeImpl<Config>::Limits TypeImpl<Config>::NumberBitsetToLimits(
661 TypeHandle lhs, TypeHandle rhs, 753 bitset bits, Region* region) {
662 UnionHandle result, int size, Region* region) { 754 bitset representation = REPRESENTATION(bits);
755 bitset number_bits = BitsetType::NumberBits(bits);
756
757 if (representation == BitsetType::kNone && number_bits == BitsetType::kNone) {
758 return Limits::Empty(region);
759 }
760
761 double bitset_min = BitsetType::Min(number_bits);
762 double bitset_max = BitsetType::Max(number_bits);
763
764 // TODO(jarin) Get rid of the heap numbers.
765 i::Factory* f = Config::get_isolate(region)->factory();
766
767 return Limits(f->NewNumber(bitset_min), f->NewNumber(bitset_max),
768 representation);
769 }
770
771
772 template <class Config>
773 typename TypeImpl<Config>::Limits TypeImpl<Config>::IntersectRangeAndBitset(
774 TypeHandle range, TypeHandle bitset, Region* region) {
775 Limits range_lims(range->AsRange());
776 Limits bitset_lims = NumberBitsetToLimits(bitset->AsBitset(), region);
777 return Intersect(range_lims, bitset_lims);
778 }
779
780
781 template <class Config>
782 int TypeImpl<Config>::IntersectAux(TypeHandle lhs, TypeHandle rhs,
783 UnionHandle result, int size, Limits* lims,
784 Region* region) {
663 if (lhs->IsUnion()) { 785 if (lhs->IsUnion()) {
664 for (int i = 0, n = lhs->AsUnion()->Length(); i < n; ++i) { 786 for (int i = 0, n = lhs->AsUnion()->Length(); i < n; ++i) {
665 size = IntersectAux(lhs->AsUnion()->Get(i), rhs, result, size, region); 787 size =
788 IntersectAux(lhs->AsUnion()->Get(i), rhs, result, size, lims, region);
666 } 789 }
667 return size; 790 return size;
668 } 791 }
669 if (rhs->IsUnion()) { 792 if (rhs->IsUnion()) {
670 for (int i = 0, n = rhs->AsUnion()->Length(); i < n; ++i) { 793 for (int i = 0, n = rhs->AsUnion()->Length(); i < n; ++i) {
671 size = IntersectAux(lhs, rhs->AsUnion()->Get(i), result, size, region); 794 size =
795 IntersectAux(lhs, rhs->AsUnion()->Get(i), result, size, lims, region);
672 } 796 }
673 return size; 797 return size;
674 } 798 }
675 799
676 if (!BitsetType::IsInhabited(lhs->BitsetLub() & rhs->BitsetLub())) { 800 if (!BitsetType::IsInhabited(lhs->BitsetLub() & rhs->BitsetLub())) {
677 return size; 801 return size;
678 } 802 }
679 803
680 if (lhs->IsRange()) { 804 if (lhs->IsRange()) {
681 if (rhs->IsBitset() || rhs->IsClass()) { 805 if (rhs->IsBitset()) {
682 return UpdateRange( 806 Limits lim = IntersectRangeAndBitset(lhs, rhs, region);
683 Config::template cast<RangeType>(lhs), result, size, region); 807
808 if (!IsEmpty(lim)) {
809 *lims = Union(lim, *lims);
810 }
811 return size;
684 } 812 }
685 if (rhs->IsConstant() && 813 if (rhs->IsClass()) {
686 Contains(lhs->AsRange(), *rhs->AsConstant()->Value())) { 814 *lims = Union(Limits(rhs->AsRange()), *lims);
815 }
816 if (rhs->IsConstant() && Contains(lhs->AsRange(), rhs->AsConstant())) {
687 return AddToUnion(rhs, result, size, region); 817 return AddToUnion(rhs, result, size, region);
688 } 818 }
819 if (rhs->IsRange()) {
820 Limits lim = Intersect(Limits(lhs->AsRange()), Limits(rhs->AsRange()));
821 if (!IsEmpty(lim)) {
822 *lims = Union(lim, *lims);
823 }
824 }
689 return size; 825 return size;
690 } 826 }
691 if (rhs->IsRange()) { 827 if (rhs->IsRange()) {
692 if (lhs->IsBitset() || lhs->IsClass()) { 828 if (lhs->IsBitset()) {
693 return UpdateRange( 829 Limits lim = IntersectRangeAndBitset(rhs, lhs, region);
694 Config::template cast<RangeType>(rhs), result, size, region); 830
831 if (!IsEmpty(lim)) {
832 *lims = Union(lim, *lims);
833 }
834 return size;
695 } 835 }
696 if (lhs->IsConstant() && 836 if (lhs->IsClass()) {
697 Contains(rhs->AsRange(), *lhs->AsConstant()->Value())) { 837 *lims = Union(Limits(rhs->AsRange()), *lims);
838 }
839 if (lhs->IsConstant() && Contains(rhs->AsRange(), lhs->AsConstant())) {
698 return AddToUnion(lhs, result, size, region); 840 return AddToUnion(lhs, result, size, region);
699 } 841 }
700 return size; 842 return size;
701 } 843 }
702 844
703 if (lhs->IsBitset() || rhs->IsBitset()) { 845 if (lhs->IsBitset() || rhs->IsBitset()) {
704 return AddToUnion(lhs->IsBitset() ? rhs : lhs, result, size, region); 846 return AddToUnion(lhs->IsBitset() ? rhs : lhs, result, size, region);
705 } 847 }
706 if (lhs->IsClass() != rhs->IsClass()) { 848 if (lhs->IsClass() != rhs->IsClass()) {
707 return AddToUnion(lhs->IsClass() ? rhs : lhs, result, size, region); 849 return AddToUnion(lhs->IsClass() ? rhs : lhs, result, size, region);
708 } 850 }
709 if (lhs->SimplyEquals(rhs->unhandle())) { 851 if (lhs->SimplyEquals(rhs->unhandle())) {
710 return AddToUnion(lhs, result, size, region); 852 return AddToUnion(lhs, result, size, region);
711 } 853 }
712 return size; 854 return size;
713 } 855 }
714 856
715 857
858 // Make sure that we produce a well-formed range and bitset:
859 // If the range is non-empty, the number bits in the bitset should be
860 // clear. Moreover, if we have a canonical range (such as Signed32(),
861 // we want to produce a bitset rather than a range.
862 template <class Config>
863 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::NormalizeRangeAndBitset(
864 RangeHandle range, bitset* bits, Region* region) {
865 // Fast path: If the bitset does not mention numbers, we can just keep the
866 // range.
867 bitset number_bits = BitsetType::NumberBits(*bits);
868 if (number_bits == 0) {
869 return range;
870 }
871
872 // If the range is contained within the bitset, return an empty range
873 // (but make sure we take the representation).
874 bitset range_lub = range->BitsetLub();
875 if (BitsetType::Is(BitsetType::NumberBits(range_lub), *bits)) {
876 *bits |= range_lub;
877 return None(region);
878 }
879
880 // Slow path: reconcile the bitset range and the range.
881 double bitset_min = BitsetType::Min(number_bits);
882 double bitset_max = BitsetType::Max(number_bits);
883
884 i::Handle<i::Object> range_min_obj = range->Min();
885 i::Handle<i::Object> range_max_obj = range->Max();
886 double range_min = range_min_obj->Number();
887 double range_max = range_max_obj->Number();
888
889 bitset range_representation = REPRESENTATION(range->BitsetLub());
890 bitset bits_representation = REPRESENTATION(*bits);
891 bitset representation = bits_representation | range_representation;
892
893 // Remove the number bits from the bitset, they would just confuse us now.
894 *bits &= ~number_bits;
895 if (bits_representation == *bits) {
896 *bits = BitsetType::kNone;
rossberg 2014/12/12 13:57:51 Hm, why do we clear bits here? Can't it still cont
Jarin 2015/01/08 14:30:27 I am not sure what you mean here. The kNone type i
rossberg 2015/01/15 15:15:11 Yes, but I'm (still) confused why the empty type i
Jarin 2015/01/16 16:28:39 This is because of the assertion at types.h:631 'D
897 }
898
899 if (representation == range_representation && range_min <= bitset_min &&
900 range_max >= bitset_max) {
901 // Bitset is contained within the range, just return the range.
902 return range;
903 }
904
905 if (bitset_min < range_min) {
906 range_min_obj =
907 Config::get_isolate(region)->factory()->NewNumber(bitset_min);
908 }
909 if (bitset_max > range_max) {
910 range_max_obj =
911 Config::get_isolate(region)->factory()->NewNumber(bitset_max);
912 }
913 return RangeType::New(range_min_obj, range_max_obj, representation, region);
914 }
915
916
716 template<class Config> 917 template<class Config>
717 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Union( 918 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Union(
718 TypeHandle type1, TypeHandle type2, Region* region) { 919 TypeHandle type1, TypeHandle type2, Region* region) {
719 920
720 // Fast case: bit sets. 921 // Fast case: bit sets.
721 if (type1->IsBitset() && type2->IsBitset()) { 922 if (type1->IsBitset() && type2->IsBitset()) {
722 return BitsetType::New(type1->AsBitset() | type2->AsBitset(), region); 923 return BitsetType::New(type1->AsBitset() | type2->AsBitset(), region);
723 } 924 }
724 925
725 // Fast case: top or bottom types. 926 // Fast case: top or bottom types.
726 if (type1->IsAny() || type2->IsNone()) return type1; 927 if (type1->IsAny() || type2->IsNone()) return type1;
727 if (type2->IsAny() || type1->IsNone()) return type2; 928 if (type2->IsAny() || type1->IsNone()) return type2;
728 929
729 // Semi-fast case. 930 // Semi-fast case.
730 if (type1->Is(type2)) return type2; 931 if (type1->Is(type2)) return type2;
731 if (type2->Is(type1)) return type1; 932 if (type2->Is(type1)) return type1;
732 933
733 // Slow case: create union. 934 // Slow case: create union.
734 int size1 = type1->IsUnion() ? type1->AsUnion()->Length() : 1; 935 int size1 = type1->IsUnion() ? type1->AsUnion()->Length() : 1;
735 int size2 = type2->IsUnion() ? type2->AsUnion()->Length() : 1; 936 int size2 = type2->IsUnion() ? type2->AsUnion()->Length() : 1;
736 if (!AddIsSafe(size1, size2)) return Any(region); 937 if (!AddIsSafe(size1, size2)) return Any(region);
737 int size = size1 + size2; 938 int size = size1 + size2;
738 if (!AddIsSafe(size, 2)) return Any(region); 939 if (!AddIsSafe(size, 2)) return Any(region);
739 size += 2; 940 size += 2;
740 UnionHandle result = UnionType::New(size, region); 941 UnionHandle result = UnionType::New(size, region);
741 size = 0; 942 size = 0;
742 943
743 // Deal with bitsets. 944 // Compute the new bitset.
744 TypeHandle bits = BitsetType::New( 945 bitset new_bitset = type1->BitsetGlb() | type2->BitsetGlb();
745 type1->BitsetGlb() | type2->BitsetGlb(), region);
746 result->Set(size++, bits);
747 946
748 // Deal with ranges. 947 // Deal with ranges.
749 TypeHandle range = None(region); 948 TypeHandle range = None(region);
750 RangeType* range1 = type1->GetRange(); 949 RangeType* range1 = type1->GetRange();
751 RangeType* range2 = type2->GetRange(); 950 RangeType* range2 = type2->GetRange();
752 if (range1 != NULL && range2 != NULL) { 951 if (range1 != NULL && range2 != NULL) {
753 range = RangeType::New(Union(Limits(range1), Limits(range2)), region); 952 Limits lims = Union(Limits(range1), Limits(range2));
953 RangeHandle union_range = RangeType::New(lims, region);
954 range = NormalizeRangeAndBitset(union_range, &new_bitset, region);
754 } else if (range1 != NULL) { 955 } else if (range1 != NULL) {
755 range = handle(range1); 956 range = NormalizeRangeAndBitset(handle(range1), &new_bitset, region);
756 } else if (range2 != NULL) { 957 } else if (range2 != NULL) {
757 range = handle(range2); 958 range = NormalizeRangeAndBitset(handle(range2), &new_bitset, region);
758 } 959 }
960 TypeHandle bits = BitsetType::New(new_bitset, region);
961 result->Set(size++, bits);
rossberg 2014/12/12 13:57:50 Maybe only add bits and range here if non-empty?
Jarin 2015/01/08 14:30:27 Let's do that later (if at all), once we figure ou
759 result->Set(size++, range); 962 result->Set(size++, range);
760 963
761 size = AddToUnion(type1, result, size, region); 964 size = AddToUnion(type1, result, size, region);
762 size = AddToUnion(type2, result, size, region); 965 size = AddToUnion(type2, result, size, region);
763 return NormalizeUnion(result, size); 966 return NormalizeUnion(result, size);
764 } 967 }
765 968
766 969
767 // Add [type] to [result] unless [type] is bitset, range, or already subsumed. 970 // Add [type] to [result] unless [type] is bitset, range, or already subsumed.
768 // Return new size of [result]. 971 // Return new size of [result].
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 template<class OtherType> 1113 template<class OtherType>
911 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Convert( 1114 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Convert(
912 typename OtherType::TypeHandle type, Region* region) { 1115 typename OtherType::TypeHandle type, Region* region) {
913 if (type->IsBitset()) { 1116 if (type->IsBitset()) {
914 return BitsetType::New(type->AsBitset(), region); 1117 return BitsetType::New(type->AsBitset(), region);
915 } else if (type->IsClass()) { 1118 } else if (type->IsClass()) {
916 return ClassType::New(type->AsClass()->Map(), region); 1119 return ClassType::New(type->AsClass()->Map(), region);
917 } else if (type->IsConstant()) { 1120 } else if (type->IsConstant()) {
918 return ConstantType::New(type->AsConstant()->Value(), region); 1121 return ConstantType::New(type->AsConstant()->Value(), region);
919 } else if (type->IsRange()) { 1122 } else if (type->IsRange()) {
920 return RangeType::New( 1123 return RangeType::New(type->AsRange()->Min(), type->AsRange()->Max(),
921 type->AsRange()->Min(), type->AsRange()->Max(), region); 1124 type->AsRange()->Representation(), region);
922 } else if (type->IsContext()) { 1125 } else if (type->IsContext()) {
923 TypeHandle outer = Convert<OtherType>(type->AsContext()->Outer(), region); 1126 TypeHandle outer = Convert<OtherType>(type->AsContext()->Outer(), region);
924 return ContextType::New(outer, region); 1127 return ContextType::New(outer, region);
925 } else if (type->IsUnion()) { 1128 } else if (type->IsUnion()) {
926 int length = type->AsUnion()->Length(); 1129 int length = type->AsUnion()->Length();
927 UnionHandle unioned = UnionType::New(length, region); 1130 UnionHandle unioned = UnionType::New(length, region);
928 for (int i = 0; i < length; ++i) { 1131 for (int i = 0; i < length; ++i) {
929 TypeHandle t = Convert<OtherType>(type->AsUnion()->Get(i), region); 1132 TypeHandle t = Convert<OtherType>(type->AsUnion()->Get(i), region);
930 unioned->Set(i, t); 1133 unioned->Set(i, t);
931 } 1134 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 os << name; 1186 os << name;
984 return; 1187 return;
985 } 1188 }
986 1189
987 static const bitset named_bitsets[] = { 1190 static const bitset named_bitsets[] = {
988 #define BITSET_CONSTANT(type, value) REPRESENTATION(k##type), 1191 #define BITSET_CONSTANT(type, value) REPRESENTATION(k##type),
989 REPRESENTATION_BITSET_TYPE_LIST(BITSET_CONSTANT) 1192 REPRESENTATION_BITSET_TYPE_LIST(BITSET_CONSTANT)
990 #undef BITSET_CONSTANT 1193 #undef BITSET_CONSTANT
991 1194
992 #define BITSET_CONSTANT(type, value) SEMANTIC(k##type), 1195 #define BITSET_CONSTANT(type, value) SEMANTIC(k##type),
993 INTERNAL_BITSET_TYPE_LIST(BITSET_CONSTANT) 1196 INTERNAL_BITSET_TYPE_LIST(BITSET_CONSTANT)
994 SEMANTIC_BITSET_TYPE_LIST(BITSET_CONSTANT) 1197 SEMANTIC_BITSET_TYPE_LIST(BITSET_CONSTANT)
rossberg 2014/12/12 13:57:51 Nit: indentation
Jarin 2015/01/08 14:30:27 Done.
995 #undef BITSET_CONSTANT 1198 #undef BITSET_CONSTANT
996 }; 1199 };
997 1200
998 bool is_first = true; 1201 bool is_first = true;
999 os << "("; 1202 os << "(";
1000 for (int i(arraysize(named_bitsets) - 1); bits != 0 && i >= 0; --i) { 1203 for (int i(arraysize(named_bitsets) - 1); bits != 0 && i >= 0; --i) {
1001 bitset subset = named_bitsets[i]; 1204 bitset subset = named_bitsets[i];
1002 if ((bits & subset) == subset) { 1205 if ((bits & subset) == subset) {
1003 if (!is_first) os << " | "; 1206 if (!is_first) os << " | ";
1004 is_first = false; 1207 is_first = false;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; 1300 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>;
1098 1301
1099 template TypeImpl<ZoneTypeConfig>::TypeHandle 1302 template TypeImpl<ZoneTypeConfig>::TypeHandle
1100 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( 1303 TypeImpl<ZoneTypeConfig>::Convert<HeapType>(
1101 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); 1304 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*);
1102 template TypeImpl<HeapTypeConfig>::TypeHandle 1305 template TypeImpl<HeapTypeConfig>::TypeHandle
1103 TypeImpl<HeapTypeConfig>::Convert<Type>( 1306 TypeImpl<HeapTypeConfig>::Convert<Type>(
1104 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); 1307 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*);
1105 1308
1106 } } // namespace v8::internal 1309 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698