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

Side by Side Diff: src/types.cc

Issue 837723006: Steps towards unification of number bitset and range types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Style warnings Created 5 years, 11 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
« no previous file with comments | « src/types.h ('k') | src/types-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
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 rhs->Bound()->Is(lhs->Bound()) &&
62 && rhs->Max()->Number() <= lhs->Max()->Number(); 77 lhs->Min()->Number() <= rhs->Min()->Number() &&
78 rhs->Max()->Number() <= lhs->Max()->Number();
63 } 79 }
64 80
65 81
82 template <class Config>
83 bool TypeImpl<Config>::Contains(typename TypeImpl<Config>::RangeType* lhs,
84 typename TypeImpl<Config>::ConstantType* rhs) {
85 DisallowHeapAllocation no_allocation;
86 return IsInteger(*rhs->Value()) && rhs->Bound()->Is(lhs->Bound()) &&
87 lhs->Min()->Number() <= rhs->Value()->Number() &&
88 rhs->Value()->Number() <= lhs->Max()->Number();
89 }
90
91
66 template<class Config> 92 template<class Config>
67 bool TypeImpl<Config>::Contains( 93 bool TypeImpl<Config>::Contains(
68 typename TypeImpl<Config>::RangeType* range, i::Object* val) { 94 typename TypeImpl<Config>::RangeType* range, i::Object* val) {
69 DisallowHeapAllocation no_allocation; 95 DisallowHeapAllocation no_allocation;
70 return IsInteger(val) 96 return IsInteger(val) &&
71 && range->Min()->Number() <= val->Number() 97 BitsetType::Is(BitsetType::Lub(val), range->Bound()->AsBitset()) &&
72 && val->Number() <= range->Max()->Number(); 98 range->Min()->Number() <= val->Number() &&
99 val->Number() <= range->Max()->Number();
73 } 100 }
74 101
75 102
76 // ----------------------------------------------------------------------------- 103 // -----------------------------------------------------------------------------
77 // Min and Max computation. 104 // Min and Max computation.
78 105
79 template<class Config> 106 template<class Config>
80 double TypeImpl<Config>::Min() { 107 double TypeImpl<Config>::Min() {
81 DCHECK(this->Is(Number())); 108 DCHECK(this->Is(Number()));
82 if (this->IsBitset()) return BitsetType::Min(this->AsBitset()); 109 if (this->IsBitset()) return BitsetType::Min(this->AsBitset());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 145
119 // The largest bitset subsumed by this type. 146 // The largest bitset subsumed by this type.
120 template<class Config> 147 template<class Config>
121 typename TypeImpl<Config>::bitset 148 typename TypeImpl<Config>::bitset
122 TypeImpl<Config>::BitsetType::Glb(TypeImpl* type) { 149 TypeImpl<Config>::BitsetType::Glb(TypeImpl* type) {
123 DisallowHeapAllocation no_allocation; 150 DisallowHeapAllocation no_allocation;
124 if (type->IsBitset()) { 151 if (type->IsBitset()) {
125 return type->AsBitset(); 152 return type->AsBitset();
126 } else if (type->IsUnion()) { 153 } else if (type->IsUnion()) {
127 SLOW_DCHECK(type->AsUnion()->Wellformed()); 154 SLOW_DCHECK(type->AsUnion()->Wellformed());
128 return type->AsUnion()->Get(0)->BitsetGlb(); // Shortcut. 155 return type->AsUnion()->Get(0)->BitsetGlb() |
156 type->AsUnion()->Get(1)->BitsetGlb(); // Shortcut.
157 } else if (type->IsRange()) {
158 bitset glb = SEMANTIC(BitsetType::Glb(type->AsRange()->Min()->Number(),
159 type->AsRange()->Max()->Number()));
160 if (glb == 0) {
161 return kNone;
162 } else {
163 return glb | REPRESENTATION(type->BitsetLub());
164 }
165 } else {
129 // (The remaining BitsetGlb's are None anyway). 166 // (The remaining BitsetGlb's are None anyway).
130 } else {
131 return kNone; 167 return kNone;
132 } 168 }
133 } 169 }
134 170
135 171
136 // The smallest bitset subsuming this type. 172 // The smallest bitset subsuming this type.
137 template<class Config> 173 template<class Config>
138 typename TypeImpl<Config>::bitset 174 typename TypeImpl<Config>::bitset
139 TypeImpl<Config>::BitsetType::Lub(TypeImpl* type) { 175 TypeImpl<Config>::BitsetType::Lub(TypeImpl* type) {
140 DisallowHeapAllocation no_allocation; 176 DisallowHeapAllocation no_allocation;
141 if (type->IsBitset()) return type->AsBitset(); 177 if (type->IsBitset()) return type->AsBitset();
142 if (type->IsUnion()) { 178 if (type->IsUnion()) {
143 int bitset = kNone; 179 int bitset = kNone;
144 for (int i = 0, n = type->AsUnion()->Length(); i < n; ++i) { 180 for (int i = 0, n = type->AsUnion()->Length(); i < n; ++i) {
145 bitset |= type->AsUnion()->Get(i)->BitsetLub(); 181 bitset |= type->AsUnion()->Get(i)->BitsetLub();
146 } 182 }
147 return bitset; 183 return bitset;
148 } 184 }
149 if (type->IsClass()) { 185 if (type->IsClass()) {
150 // Little hack to avoid the need for a region for handlification here... 186 // Little hack to avoid the need for a region for handlification here...
151 return Config::is_class(type) ? Lub(*Config::as_class(type)) : 187 return Config::is_class(type) ? Lub(*Config::as_class(type)) :
152 type->AsClass()->Bound(NULL)->AsBitset(); 188 type->AsClass()->Bound(NULL)->AsBitset();
153 } 189 }
154 if (type->IsConstant()) return type->AsConstant()->Bound()->AsBitset(); 190 if (type->IsConstant()) return type->AsConstant()->Bound()->AsBitset();
155 if (type->IsRange()) return type->AsRange()->BitsetLub(); 191 if (type->IsRange()) return type->AsRange()->Bound()->AsBitset();
156 if (type->IsContext()) return kInternal & kTaggedPointer; 192 if (type->IsContext()) return kInternal & kTaggedPointer;
157 if (type->IsArray()) return kArray; 193 if (type->IsArray()) return kArray;
158 if (type->IsFunction()) return kOtherObject; // TODO(rossberg): kFunction 194 if (type->IsFunction()) return kOtherObject; // TODO(rossberg): kFunction
159 UNREACHABLE(); 195 UNREACHABLE();
160 return kNone; 196 return kNone;
161 } 197 }
162 198
163 199
164 template<class Config> 200 template<class Config>
165 typename TypeImpl<Config>::bitset 201 typename TypeImpl<Config>::bitset
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 typename TypeImpl<Config>::bitset 313 typename TypeImpl<Config>::bitset
278 TypeImpl<Config>::BitsetType::Lub(double value) { 314 TypeImpl<Config>::BitsetType::Lub(double value) {
279 DisallowHeapAllocation no_allocation; 315 DisallowHeapAllocation no_allocation;
280 if (i::IsMinusZero(value)) return kMinusZero; 316 if (i::IsMinusZero(value)) return kMinusZero;
281 if (std::isnan(value)) return kNaN; 317 if (std::isnan(value)) return kNaN;
282 if (IsUint32Double(value) || IsInt32Double(value)) return Lub(value, value); 318 if (IsUint32Double(value) || IsInt32Double(value)) return Lub(value, value);
283 return kPlainNumber; 319 return kPlainNumber;
284 } 320 }
285 321
286 322
287 // Minimum values of regular numeric bitsets when SmiValuesAre31Bits. 323 // Minimum values of regular numeric bitsets.
288 template <class Config> 324 template <class Config>
289 const typename TypeImpl<Config>::BitsetType::BitsetMin 325 const typename TypeImpl<Config>::BitsetType::Boundary
290 TypeImpl<Config>::BitsetType::BitsetMins31[] = { 326 TypeImpl<Config>::BitsetType::BoundariesArray[] = {
291 {kOtherNumber, -V8_INFINITY}, 327 {kPlainNumber, -V8_INFINITY},
292 {kOtherSigned32, kMinInt}, 328 {kNegative32, kMinInt},
293 {kNegativeSignedSmall, -0x40000000}, 329 {kNegative31, -0x40000000},
294 {kUnsignedSmall, 0}, 330 {kUnsigned30, 0},
295 {kOtherUnsigned31, 0x40000000}, 331 {kUnsigned31, 0x40000000},
296 {kOtherUnsigned32, 0x80000000}, 332 {kUnsigned32, 0x80000000},
297 {kOtherNumber, static_cast<double>(kMaxUInt32) + 1}}; 333 {kPlainNumber, static_cast<double>(kMaxUInt32) + 1}
334 };
298 335
299 336
300 // Minimum values of regular numeric bitsets when SmiValuesAre32Bits.
301 // OtherSigned32 and OtherUnsigned31 are empty (see the diagrams in types.h).
302 template <class Config> 337 template <class Config>
303 const typename TypeImpl<Config>::BitsetType::BitsetMin 338 const typename TypeImpl<Config>::BitsetType::Boundary*
304 TypeImpl<Config>::BitsetType::BitsetMins32[] = { 339 TypeImpl<Config>::BitsetType::Boundaries() {
305 {kOtherNumber, -V8_INFINITY}, 340 return BoundariesArray;
306 {kNegativeSignedSmall, kMinInt}, 341 }
307 {kUnsignedSmall, 0}, 342
308 {kOtherUnsigned32, 0x80000000}, 343
309 {kOtherNumber, static_cast<double>(kMaxUInt32) + 1}}; 344 template <class Config>
345 size_t TypeImpl<Config>::BitsetType::BoundariesSize() {
346 // Windows doesn't like arraysize here.
347 // return arraysize(BoundariesArray);
348 return 7;
349 }
310 350
311 351
312 template<class Config> 352 template<class Config>
313 typename TypeImpl<Config>::bitset 353 typename TypeImpl<Config>::bitset
314 TypeImpl<Config>::BitsetType::Lub(double min, double max) { 354 TypeImpl<Config>::BitsetType::Lub(double min, double max) {
315 DisallowHeapAllocation no_allocation; 355 DisallowHeapAllocation no_allocation;
316 int lub = kNone; 356 int lub = kNone;
317 const BitsetMin* mins = BitsetMins(); 357 const Boundary* mins = Boundaries();
318 358
319 // Make sure the min-max range touches 0, so we are guaranteed no holes 359 // Make sure the min-max range touches 0, so we are guaranteed no holes
320 // in unions of valid bitsets. 360 // in unions of valid bitsets.
321 if (max < -1) max = -1; 361 if (max < -1) max = -1;
322 if (min > 0) min = 0; 362 if (min > 0) min = 0;
323 363
324 for (size_t i = 1; i < BitsetMinsSize(); ++i) { 364 for (size_t i = 1; i < BoundariesSize(); ++i) {
325 if (min < mins[i].min) { 365 if (min < mins[i].min) {
326 lub |= mins[i-1].bits; 366 lub |= mins[i-1].bits;
327 if (max < mins[i].min) return lub; 367 if (max < mins[i].min) return lub;
328 } 368 }
329 } 369 }
330 return lub |= mins[BitsetMinsSize()-1].bits; 370 return lub |= mins[BoundariesSize() - 1].bits;
331 } 371 }
332 372
333 373
334 template<class Config> 374 template <class Config>
375 typename TypeImpl<Config>::bitset TypeImpl<Config>::BitsetType::NumberBits(
376 bitset bits) {
377 return SEMANTIC(bits & kPlainNumber);
378 }
379
380
381 template <class Config>
382 void TypeImpl<Config>::BitsetType::CheckNumberBits(bitset bits) {
383 // Check that the bitset does not contain any holes in number ranges.
384 bitset number_bits = NumberBits(bits);
385 if (number_bits != 0) {
386 bitset lub = SEMANTIC(Lub(Min(number_bits), Max(number_bits)));
387 CHECK(lub == number_bits);
388 }
389 }
390
391 template <class Config>
392 typename TypeImpl<Config>::bitset TypeImpl<Config>::BitsetType::Glb(
393 double min, double max) {
394 DisallowHeapAllocation no_allocation;
395 int glb = kNone;
396 const Boundary* mins = Boundaries();
397
398 // If the range does not touch 0, the bound is empty.
399 if (max < -1 || min > 0) return glb;
400
401 for (size_t i = 1; i + 1 < BoundariesSize(); ++i) {
402 if (min <= mins[i].min) {
403 if (max + 1 < mins[i + 1].min) break;
404 glb |= mins[i].bits;
405 }
406 }
407 // OtherNumber also contains float numbers, so it can never be
408 // in the greatest lower bound. (There is also the small trouble
409 // of kOtherNumber having a range hole, which we can conveniently
410 // ignore here.)
411 return glb & ~(SEMANTIC(kOtherNumber));
412 }
413
414
415 template <class Config>
335 double TypeImpl<Config>::BitsetType::Min(bitset bits) { 416 double TypeImpl<Config>::BitsetType::Min(bitset bits) {
336 DisallowHeapAllocation no_allocation; 417 DisallowHeapAllocation no_allocation;
337 DCHECK(Is(bits, kNumber)); 418 DCHECK(Is(bits, kNumber));
338 const BitsetMin* mins = BitsetMins(); 419 const Boundary* mins = Boundaries();
339 bool mz = SEMANTIC(bits & kMinusZero); 420 bool mz = SEMANTIC(bits & kMinusZero);
340 for (size_t i = 0; i < BitsetMinsSize(); ++i) { 421 for (size_t i = 0; i < BoundariesSize(); ++i) {
341 if (Is(SEMANTIC(mins[i].bits), bits)) { 422 if (Is(SEMANTIC(mins[i].bits), bits)) {
342 return mz ? std::min(0.0, mins[i].min) : mins[i].min; 423 return mz ? std::min(0.0, mins[i].min) : mins[i].min;
343 } 424 }
344 } 425 }
345 if (mz) return 0; 426 if (mz) return 0;
346 return base::OS::nan_value(); 427 return base::OS::nan_value();
347 } 428 }
348 429
349 430
350 template<class Config> 431 template<class Config>
351 double TypeImpl<Config>::BitsetType::Max(bitset bits) { 432 double TypeImpl<Config>::BitsetType::Max(bitset bits) {
352 DisallowHeapAllocation no_allocation; 433 DisallowHeapAllocation no_allocation;
353 DCHECK(Is(bits, kNumber)); 434 DCHECK(Is(bits, kNumber));
354 const BitsetMin* mins = BitsetMins(); 435 const Boundary* mins = Boundaries();
355 bool mz = SEMANTIC(bits & kMinusZero); 436 bool mz = SEMANTIC(bits & kMinusZero);
356 if (BitsetType::Is(mins[BitsetMinsSize()-1].bits, bits)) { 437 if (BitsetType::Is(SEMANTIC(mins[BoundariesSize() - 1].bits), bits)) {
357 return +V8_INFINITY; 438 return +V8_INFINITY;
358 } 439 }
359 for (size_t i = BitsetMinsSize()-1; i-- > 0; ) { 440 for (size_t i = BoundariesSize() - 1; i-- > 0;) {
360 if (Is(SEMANTIC(mins[i].bits), bits)) { 441 if (Is(SEMANTIC(mins[i].bits), bits)) {
361 return mz ? 442 return mz ?
362 std::max(0.0, mins[i+1].min - 1) : mins[i+1].min - 1; 443 std::max(0.0, mins[i+1].min - 1) : mins[i+1].min - 1;
363 } 444 }
364 } 445 }
365 if (mz) return 0; 446 if (mz) return 0;
366 return base::OS::nan_value(); 447 return base::OS::nan_value();
367 } 448 }
368 449
369 450
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // T <= (T1 \/ ... \/ Tn) if (T <= T1) \/ ... \/ (T <= Tn) 513 // T <= (T1 \/ ... \/ Tn) if (T <= T1) \/ ... \/ (T <= Tn)
433 if (that->IsUnion()) { 514 if (that->IsUnion()) {
434 for (int i = 0, n = that->AsUnion()->Length(); i < n; ++i) { 515 for (int i = 0, n = that->AsUnion()->Length(); i < n; ++i) {
435 if (this->Is(that->AsUnion()->Get(i))) return true; 516 if (this->Is(that->AsUnion()->Get(i))) return true;
436 if (i > 1 && this->IsRange()) return false; // Shortcut. 517 if (i > 1 && this->IsRange()) return false; // Shortcut.
437 } 518 }
438 return false; 519 return false;
439 } 520 }
440 521
441 if (that->IsRange()) { 522 if (that->IsRange()) {
442 return (this->IsRange() && Contains(that->AsRange(), this->AsRange())) 523 return (this->IsRange() && Contains(that->AsRange(), this->AsRange())) ||
443 || (this->IsConstant() && 524 (this->IsConstant() &&
444 Contains(that->AsRange(), *this->AsConstant()->Value())); 525 Contains(that->AsRange(), this->AsConstant()));
445 } 526 }
446 if (this->IsRange()) return false; 527 if (this->IsRange()) return false;
447 528
448 return this->SimplyEquals(that); 529 return this->SimplyEquals(that);
449 } 530 }
450 531
451 532
452 template<class Config> 533 template<class Config>
453 bool TypeImpl<Config>::NowIs(TypeImpl* that) { 534 bool TypeImpl<Config>::NowIs(TypeImpl* that) {
454 DisallowHeapAllocation no_allocation; 535 DisallowHeapAllocation no_allocation;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // T overlaps (T1 \/ ... \/ Tn) if (T overlaps T1) \/ ... \/ (T overlaps Tn) 577 // T overlaps (T1 \/ ... \/ Tn) if (T overlaps T1) \/ ... \/ (T overlaps Tn)
497 if (that->IsUnion()) { 578 if (that->IsUnion()) {
498 for (int i = 0, n = that->AsUnion()->Length(); i < n; ++i) { 579 for (int i = 0, n = that->AsUnion()->Length(); i < n; ++i) {
499 if (this->Maybe(that->AsUnion()->Get(i))) return true; 580 if (this->Maybe(that->AsUnion()->Get(i))) return true;
500 } 581 }
501 return false; 582 return false;
502 } 583 }
503 584
504 if (!BitsetType::IsInhabited(this->BitsetLub() & that->BitsetLub())) 585 if (!BitsetType::IsInhabited(this->BitsetLub() & that->BitsetLub()))
505 return false; 586 return false;
506 if (this->IsBitset() || that->IsBitset()) return true; 587
588 if (this->IsBitset() && that->IsBitset()) return true;
507 589
508 if (this->IsClass() != that->IsClass()) return true; 590 if (this->IsClass() != that->IsClass()) return true;
509 591
510 if (this->IsRange()) { 592 if (this->IsRange()) {
511 if (that->IsConstant()) { 593 if (that->IsConstant()) {
512 return Contains(this->AsRange(), *that->AsConstant()->Value()); 594 return Contains(this->AsRange(), that->AsConstant());
513 } 595 }
514 return that->IsRange() && Overlap(this->AsRange(), that->AsRange()); 596 if (that->IsRange()) {
597 return Overlap(this->AsRange(), that->AsRange());
598 }
599 if (that->IsBitset()) {
600 bitset number_bits = BitsetType::NumberBits(that->AsBitset());
601 if (number_bits == BitsetType::kNone) {
602 return false;
603 }
604 if ((REPRESENTATION(that->AsBitset()) &
605 REPRESENTATION(this->BitsetLub())) == BitsetType::kNone) {
606 return false;
607 }
608 double min = std::max(BitsetType::Min(number_bits), this->Min());
609 double max = std::min(BitsetType::Max(number_bits), this->Max());
610 return min <= max;
611 }
515 } 612 }
516 if (that->IsRange()) { 613 if (that->IsRange()) {
517 if (this->IsConstant()) { 614 return that->Maybe(this); // This case is handled above.
518 return Contains(that->AsRange(), *this->AsConstant()->Value());
519 }
520 return this->IsRange() && Overlap(this->AsRange(), that->AsRange());
521 } 615 }
522 616
617 if (this->IsBitset() || that->IsBitset()) return true;
618
523 return this->SimplyEquals(that); 619 return this->SimplyEquals(that);
524 } 620 }
525 621
526 622
527 // Return the range in [this], or [NULL]. 623 // Return the range in [this], or [NULL].
528 template<class Config> 624 template<class Config>
529 typename TypeImpl<Config>::RangeType* TypeImpl<Config>::GetRange() { 625 typename TypeImpl<Config>::RangeType* TypeImpl<Config>::GetRange() {
530 DisallowHeapAllocation no_allocation; 626 DisallowHeapAllocation no_allocation;
531 if (this->IsRange()) return this->AsRange(); 627 if (this->IsRange()) return this->AsRange();
532 if (this->IsUnion() && this->AsUnion()->Get(1)->IsRange()) { 628 if (this->IsUnion() && this->AsUnion()->Get(1)->IsRange()) {
(...skipping 20 matching lines...) Expand all
553 template<class Config> 649 template<class Config>
554 bool TypeImpl<Config>::UnionType::Wellformed() { 650 bool TypeImpl<Config>::UnionType::Wellformed() {
555 DisallowHeapAllocation no_allocation; 651 DisallowHeapAllocation no_allocation;
556 // This checks the invariants of the union representation: 652 // This checks the invariants of the union representation:
557 // 1. There are at least two elements. 653 // 1. There are at least two elements.
558 // 2. At most one element is a bitset, and it must be the first one. 654 // 2. At most one element is a bitset, and it must be the first one.
559 // 3. At most one element is a range, and it must be the second one 655 // 3. At most one element is a range, and it must be the second one
560 // (even when the first element is not a bitset). 656 // (even when the first element is not a bitset).
561 // 4. No element is itself a union. 657 // 4. No element is itself a union.
562 // 5. No element is a subtype of any other. 658 // 5. No element is a subtype of any other.
659 // 6. If there is a range, then the bitset type does not contain
660 // plain number bits.
563 DCHECK(this->Length() >= 2); // (1) 661 DCHECK(this->Length() >= 2); // (1)
662
663 bitset number_bits = this->Get(0)->IsBitset()
664 ? BitsetType::NumberBits(this->Get(0)->AsBitset()) : 0;
665 USE(number_bits);
666
564 for (int i = 0; i < this->Length(); ++i) { 667 for (int i = 0; i < this->Length(); ++i) {
565 if (i != 0) DCHECK(!this->Get(i)->IsBitset()); // (2) 668 if (i != 0) DCHECK(!this->Get(i)->IsBitset()); // (2)
566 if (i != 1) DCHECK(!this->Get(i)->IsRange()); // (3) 669 if (i != 1) DCHECK(!this->Get(i)->IsRange()); // (3)
567 DCHECK(!this->Get(i)->IsUnion()); // (4) 670 DCHECK(!this->Get(i)->IsUnion()); // (4)
568 for (int j = 0; j < this->Length(); ++j) { 671 for (int j = 0; j < this->Length(); ++j) {
569 if (i != j) DCHECK(!this->Get(i)->Is(this->Get(j))); // (5) 672 if (i != j) DCHECK(!this->Get(i)->Is(this->Get(j))); // (5)
570 } 673 }
571 } 674 }
675 DCHECK(!this->Get(1)->IsRange() || (number_bits == 0)); // (6)
572 return true; 676 return true;
573 } 677 }
574 678
575 679
576 // ----------------------------------------------------------------------------- 680 // -----------------------------------------------------------------------------
577 // Union and intersection 681 // Union and intersection
578 682
579 683
580 static bool AddIsSafe(int x, int y) { 684 static bool AddIsSafe(int x, int y) {
581 return x >= 0 ? 685 return x >= 0 ?
(...skipping 26 matching lines...) Expand all
608 int size2 = type2->IsUnion() ? type2->AsUnion()->Length() : 1; 712 int size2 = type2->IsUnion() ? type2->AsUnion()->Length() : 1;
609 if (!AddIsSafe(size1, size2)) return Any(region); 713 if (!AddIsSafe(size1, size2)) return Any(region);
610 int size = size1 + size2; 714 int size = size1 + size2;
611 if (!AddIsSafe(size, 2)) return Any(region); 715 if (!AddIsSafe(size, 2)) return Any(region);
612 size += 2; 716 size += 2;
613 UnionHandle result = UnionType::New(size, region); 717 UnionHandle result = UnionType::New(size, region);
614 size = 0; 718 size = 0;
615 719
616 // Deal with bitsets. 720 // Deal with bitsets.
617 result->Set(size++, BitsetType::New(bits, region)); 721 result->Set(size++, BitsetType::New(bits, region));
722 // Insert a placeholder for the range.
723 result->Set(size++, None(region));
618 724
619 // Deal with ranges. 725 Limits lims = Limits::Empty(region);
620 TypeHandle range = None(region); 726 size = IntersectAux(type1, type2, result, size, &lims, region);
621 RangeType* range1 = type1->GetRange(); 727
622 RangeType* range2 = type2->GetRange(); 728 // If the range is not empty, then insert it into the union and
623 if (range1 != NULL && range2 != NULL) { 729 // remove the number bits from the bitset.
624 Limits lim = Intersect(Limits(range1), Limits(range2)); 730 if (!IsEmpty(lims)) {
625 if (lim.min->Number() <= lim.max->Number()) { 731 UpdateRange(RangeType::New(lims, region), result, size, region);
626 range = RangeType::New(lim, region); 732
733 // Remove the number bits.
734 bitset number_bits = BitsetType::NumberBits(bits);
735 bits &= ~number_bits;
736 if (SEMANTIC(bits) == BitsetType::kNone) {
737 bits = BitsetType::kNone;
627 } 738 }
739 result->Set(0, BitsetType::New(bits, region));
628 } 740 }
629 result->Set(size++, range);
630
631 size = IntersectAux(type1, type2, result, size, region);
632 return NormalizeUnion(result, size); 741 return NormalizeUnion(result, size);
633 } 742 }
634 743
635 744
636 template<class Config> 745 template<class Config>
637 int TypeImpl<Config>::UpdateRange( 746 int TypeImpl<Config>::UpdateRange(
638 RangeHandle range, UnionHandle result, int size, Region* region) { 747 RangeHandle range, UnionHandle result, int size, Region* region) {
639 TypeHandle old_range = result->Get(1); 748 TypeHandle old_range = result->Get(1);
640 DCHECK(old_range->IsRange() || old_range->IsNone()); 749 DCHECK(old_range->IsRange() || old_range->IsNone());
641 if (range->Is(old_range)) return size; 750 if (range->Is(old_range)) return size;
642 if (!old_range->Is(range->unhandle())) { 751 if (!old_range->Is(range->unhandle())) {
643 range = RangeType::New( 752 range = RangeType::New(
644 Union(Limits(range->AsRange()), Limits(old_range->AsRange())), region); 753 Union(Limits(range->AsRange()), Limits(old_range->AsRange())), region);
645 } 754 }
646 result->Set(1, range); 755 result->Set(1, range);
647 756
648 // Remove any components that just got subsumed. 757 // Remove any components that just got subsumed.
649 for (int i = 2; i < size; ) { 758 for (int i = 2; i < size; ) {
650 if (result->Get(i)->Is(range->unhandle())) { 759 if (result->Get(i)->Is(range->unhandle())) {
651 result->Set(i, result->Get(--size)); 760 result->Set(i, result->Get(--size));
652 } else { 761 } else {
653 ++i; 762 ++i;
654 } 763 }
655 } 764 }
656 return size; 765 return size;
657 } 766 }
658 767
659 768
660 template<class Config> 769 template <class Config>
661 int TypeImpl<Config>::IntersectAux( 770 typename TypeImpl<Config>::Limits TypeImpl<Config>::ToLimits(bitset bits,
662 TypeHandle lhs, TypeHandle rhs, 771 Region* region) {
663 UnionHandle result, int size, Region* region) { 772 bitset representation = REPRESENTATION(bits);
773 bitset number_bits = BitsetType::NumberBits(bits);
774
775 if (representation == BitsetType::kNone && number_bits == BitsetType::kNone) {
776 return Limits::Empty(region);
777 }
778
779 double bitset_min = BitsetType::Min(number_bits);
780 double bitset_max = BitsetType::Max(number_bits);
781
782 // TODO(jarin) Get rid of the heap numbers.
783 i::Factory* f = Config::isolate(region)->factory();
784
785 return Limits(f->NewNumber(bitset_min), f->NewNumber(bitset_max),
786 representation);
787 }
788
789
790 template <class Config>
791 typename TypeImpl<Config>::Limits TypeImpl<Config>::IntersectRangeAndBitset(
792 TypeHandle range, TypeHandle bitset, Region* region) {
793 Limits range_lims(range->AsRange());
794 Limits bitset_lims = ToLimits(bitset->AsBitset(), region);
795 return Intersect(range_lims, bitset_lims);
796 }
797
798
799 template <class Config>
800 int TypeImpl<Config>::IntersectAux(TypeHandle lhs, TypeHandle rhs,
801 UnionHandle result, int size, Limits* lims,
802 Region* region) {
664 if (lhs->IsUnion()) { 803 if (lhs->IsUnion()) {
665 for (int i = 0, n = lhs->AsUnion()->Length(); i < n; ++i) { 804 for (int i = 0, n = lhs->AsUnion()->Length(); i < n; ++i) {
666 size = IntersectAux(lhs->AsUnion()->Get(i), rhs, result, size, region); 805 size =
806 IntersectAux(lhs->AsUnion()->Get(i), rhs, result, size, lims, region);
667 } 807 }
668 return size; 808 return size;
669 } 809 }
670 if (rhs->IsUnion()) { 810 if (rhs->IsUnion()) {
671 for (int i = 0, n = rhs->AsUnion()->Length(); i < n; ++i) { 811 for (int i = 0, n = rhs->AsUnion()->Length(); i < n; ++i) {
672 size = IntersectAux(lhs, rhs->AsUnion()->Get(i), result, size, region); 812 size =
813 IntersectAux(lhs, rhs->AsUnion()->Get(i), result, size, lims, region);
673 } 814 }
674 return size; 815 return size;
675 } 816 }
676 817
677 if (!BitsetType::IsInhabited(lhs->BitsetLub() & rhs->BitsetLub())) { 818 if (!BitsetType::IsInhabited(lhs->BitsetLub() & rhs->BitsetLub())) {
678 return size; 819 return size;
679 } 820 }
680 821
681 if (lhs->IsRange()) { 822 if (lhs->IsRange()) {
682 if (rhs->IsBitset() || rhs->IsClass()) { 823 if (rhs->IsBitset()) {
683 return UpdateRange( 824 Limits lim = IntersectRangeAndBitset(lhs, rhs, region);
684 Config::template cast<RangeType>(lhs), result, size, region); 825
826 if (!IsEmpty(lim)) {
827 *lims = Union(lim, *lims);
828 }
829 return size;
685 } 830 }
686 if (rhs->IsConstant() && 831 if (rhs->IsClass()) {
687 Contains(lhs->AsRange(), *rhs->AsConstant()->Value())) { 832 *lims = Union(Limits(lhs->AsRange()), *lims);
833 }
834 if (rhs->IsConstant() && Contains(lhs->AsRange(), rhs->AsConstant())) {
688 return AddToUnion(rhs, result, size, region); 835 return AddToUnion(rhs, result, size, region);
689 } 836 }
837 if (rhs->IsRange()) {
838 Limits lim = Intersect(Limits(lhs->AsRange()), Limits(rhs->AsRange()));
839 if (!IsEmpty(lim)) {
840 *lims = Union(lim, *lims);
841 }
842 }
690 return size; 843 return size;
691 } 844 }
692 if (rhs->IsRange()) { 845 if (rhs->IsRange()) {
693 if (lhs->IsBitset() || lhs->IsClass()) { 846 if (lhs->IsBitset()) {
694 return UpdateRange( 847 Limits lim = IntersectRangeAndBitset(rhs, lhs, region);
695 Config::template cast<RangeType>(rhs), result, size, region); 848
849 if (!IsEmpty(lim)) {
850 *lims = Union(lim, *lims);
851 }
852 return size;
696 } 853 }
697 if (lhs->IsConstant() && 854 if (lhs->IsClass()) {
698 Contains(rhs->AsRange(), *lhs->AsConstant()->Value())) { 855 *lims = Union(Limits(rhs->AsRange()), *lims);
856 }
857 if (lhs->IsConstant() && Contains(rhs->AsRange(), lhs->AsConstant())) {
699 return AddToUnion(lhs, result, size, region); 858 return AddToUnion(lhs, result, size, region);
700 } 859 }
701 return size; 860 return size;
702 } 861 }
703 862
704 if (lhs->IsBitset() || rhs->IsBitset()) { 863 if (lhs->IsBitset() || rhs->IsBitset()) {
705 return AddToUnion(lhs->IsBitset() ? rhs : lhs, result, size, region); 864 return AddToUnion(lhs->IsBitset() ? rhs : lhs, result, size, region);
706 } 865 }
707 if (lhs->IsClass() != rhs->IsClass()) { 866 if (lhs->IsClass() != rhs->IsClass()) {
708 return AddToUnion(lhs->IsClass() ? rhs : lhs, result, size, region); 867 return AddToUnion(lhs->IsClass() ? rhs : lhs, result, size, region);
709 } 868 }
710 if (lhs->SimplyEquals(rhs->unhandle())) { 869 if (lhs->SimplyEquals(rhs->unhandle())) {
711 return AddToUnion(lhs, result, size, region); 870 return AddToUnion(lhs, result, size, region);
712 } 871 }
713 return size; 872 return size;
714 } 873 }
715 874
716 875
876 // Make sure that we produce a well-formed range and bitset:
877 // If the range is non-empty, the number bits in the bitset should be
878 // clear. Moreover, if we have a canonical range (such as Signed32(),
879 // we want to produce a bitset rather than a range.
880 template <class Config>
881 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::NormalizeRangeAndBitset(
882 RangeHandle range, bitset* bits, Region* region) {
883 // Fast path: If the bitset does not mention numbers, we can just keep the
884 // range.
885 bitset number_bits = BitsetType::NumberBits(*bits);
886 if (number_bits == 0) {
887 return range;
888 }
889
890 // If the range is contained within the bitset, return an empty range
891 // (but make sure we take the representation).
892 bitset range_lub = range->BitsetLub();
893 if (BitsetType::Is(BitsetType::NumberBits(range_lub), *bits)) {
894 *bits |= range_lub;
895 return None(region);
896 }
897
898 // Slow path: reconcile the bitset range and the range.
899 double bitset_min = BitsetType::Min(number_bits);
900 double bitset_max = BitsetType::Max(number_bits);
901
902 i::Handle<i::Object> range_min_obj = range->Min();
903 i::Handle<i::Object> range_max_obj = range->Max();
904 double range_min = range_min_obj->Number();
905 double range_max = range_max_obj->Number();
906
907 bitset range_representation = REPRESENTATION(range->BitsetLub());
908 bitset bits_representation = REPRESENTATION(*bits);
909 bitset representation =
910 (bits_representation | range_representation) & BitsetType::kNumber;
911
912 // Remove the number bits from the bitset, they would just confuse us now.
913 *bits &= ~number_bits;
914 if (bits_representation == *bits) {
915 *bits = BitsetType::kNone;
916 }
917
918 if (representation == range_representation && range_min <= bitset_min &&
919 range_max >= bitset_max) {
920 // Bitset is contained within the range, just return the range.
921 return range;
922 }
923
924 if (bitset_min < range_min) {
925 range_min_obj = Config::isolate(region)->factory()->NewNumber(bitset_min);
926 }
927 if (bitset_max > range_max) {
928 range_max_obj = Config::isolate(region)->factory()->NewNumber(bitset_max);
929 }
930 return RangeType::New(range_min_obj, range_max_obj,
931 BitsetType::New(representation, region), region);
932 }
933
934
717 template<class Config> 935 template<class Config>
718 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Union( 936 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Union(
719 TypeHandle type1, TypeHandle type2, Region* region) { 937 TypeHandle type1, TypeHandle type2, Region* region) {
720 938
721 // Fast case: bit sets. 939 // Fast case: bit sets.
722 if (type1->IsBitset() && type2->IsBitset()) { 940 if (type1->IsBitset() && type2->IsBitset()) {
723 return BitsetType::New(type1->AsBitset() | type2->AsBitset(), region); 941 return BitsetType::New(type1->AsBitset() | type2->AsBitset(), region);
724 } 942 }
725 943
726 // Fast case: top or bottom types. 944 // Fast case: top or bottom types.
727 if (type1->IsAny() || type2->IsNone()) return type1; 945 if (type1->IsAny() || type2->IsNone()) return type1;
728 if (type2->IsAny() || type1->IsNone()) return type2; 946 if (type2->IsAny() || type1->IsNone()) return type2;
729 947
730 // Semi-fast case. 948 // Semi-fast case.
731 if (type1->Is(type2)) return type2; 949 if (type1->Is(type2)) return type2;
732 if (type2->Is(type1)) return type1; 950 if (type2->Is(type1)) return type1;
733 951
734 // Slow case: create union. 952 // Slow case: create union.
735 int size1 = type1->IsUnion() ? type1->AsUnion()->Length() : 1; 953 int size1 = type1->IsUnion() ? type1->AsUnion()->Length() : 1;
736 int size2 = type2->IsUnion() ? type2->AsUnion()->Length() : 1; 954 int size2 = type2->IsUnion() ? type2->AsUnion()->Length() : 1;
737 if (!AddIsSafe(size1, size2)) return Any(region); 955 if (!AddIsSafe(size1, size2)) return Any(region);
738 int size = size1 + size2; 956 int size = size1 + size2;
739 if (!AddIsSafe(size, 2)) return Any(region); 957 if (!AddIsSafe(size, 2)) return Any(region);
740 size += 2; 958 size += 2;
741 UnionHandle result = UnionType::New(size, region); 959 UnionHandle result = UnionType::New(size, region);
742 size = 0; 960 size = 0;
743 961
744 // Deal with bitsets. 962 // Compute the new bitset.
745 TypeHandle bits = BitsetType::New( 963 bitset new_bitset = type1->BitsetGlb() | type2->BitsetGlb();
746 type1->BitsetGlb() | type2->BitsetGlb(), region);
747 result->Set(size++, bits);
748 964
749 // Deal with ranges. 965 // Deal with ranges.
750 TypeHandle range = None(region); 966 TypeHandle range = None(region);
751 RangeType* range1 = type1->GetRange(); 967 RangeType* range1 = type1->GetRange();
752 RangeType* range2 = type2->GetRange(); 968 RangeType* range2 = type2->GetRange();
753 if (range1 != NULL && range2 != NULL) { 969 if (range1 != NULL && range2 != NULL) {
754 range = RangeType::New(Union(Limits(range1), Limits(range2)), region); 970 Limits lims = Union(Limits(range1), Limits(range2));
971 RangeHandle union_range = RangeType::New(lims, region);
972 range = NormalizeRangeAndBitset(union_range, &new_bitset, region);
755 } else if (range1 != NULL) { 973 } else if (range1 != NULL) {
756 range = handle(range1); 974 range = NormalizeRangeAndBitset(handle(range1), &new_bitset, region);
757 } else if (range2 != NULL) { 975 } else if (range2 != NULL) {
758 range = handle(range2); 976 range = NormalizeRangeAndBitset(handle(range2), &new_bitset, region);
759 } 977 }
978 TypeHandle bits = BitsetType::New(new_bitset, region);
979 result->Set(size++, bits);
760 result->Set(size++, range); 980 result->Set(size++, range);
761 981
762 size = AddToUnion(type1, result, size, region); 982 size = AddToUnion(type1, result, size, region);
763 size = AddToUnion(type2, result, size, region); 983 size = AddToUnion(type2, result, size, region);
764 return NormalizeUnion(result, size); 984 return NormalizeUnion(result, size);
765 } 985 }
766 986
767 987
768 // Add [type] to [result] unless [type] is bitset, range, or already subsumed. 988 // Add [type] to [result] unless [type] is bitset, range, or already subsumed.
769 // Return new size of [result]. 989 // Return new size of [result].
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Convert( 1132 typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Convert(
913 typename OtherType::TypeHandle type, Region* region) { 1133 typename OtherType::TypeHandle type, Region* region) {
914 if (type->IsBitset()) { 1134 if (type->IsBitset()) {
915 return BitsetType::New(type->AsBitset(), region); 1135 return BitsetType::New(type->AsBitset(), region);
916 } else if (type->IsClass()) { 1136 } else if (type->IsClass()) {
917 return ClassType::New(type->AsClass()->Map(), region); 1137 return ClassType::New(type->AsClass()->Map(), region);
918 } else if (type->IsConstant()) { 1138 } else if (type->IsConstant()) {
919 return ConstantType::New(type->AsConstant()->Value(), region); 1139 return ConstantType::New(type->AsConstant()->Value(), region);
920 } else if (type->IsRange()) { 1140 } else if (type->IsRange()) {
921 return RangeType::New( 1141 return RangeType::New(
922 type->AsRange()->Min(), type->AsRange()->Max(), region); 1142 type->AsRange()->Min(), type->AsRange()->Max(),
1143 BitsetType::New(REPRESENTATION(type->BitsetLub()), region), region);
923 } else if (type->IsContext()) { 1144 } else if (type->IsContext()) {
924 TypeHandle outer = Convert<OtherType>(type->AsContext()->Outer(), region); 1145 TypeHandle outer = Convert<OtherType>(type->AsContext()->Outer(), region);
925 return ContextType::New(outer, region); 1146 return ContextType::New(outer, region);
926 } else if (type->IsUnion()) { 1147 } else if (type->IsUnion()) {
927 int length = type->AsUnion()->Length(); 1148 int length = type->AsUnion()->Length();
928 UnionHandle unioned = UnionType::New(length, region); 1149 UnionHandle unioned = UnionType::New(length, region);
929 for (int i = 0; i < length; ++i) { 1150 for (int i = 0; i < length; ++i) {
930 TypeHandle t = Convert<OtherType>(type->AsUnion()->Get(i), region); 1151 TypeHandle t = Convert<OtherType>(type->AsUnion()->Get(i), region);
931 unioned->Set(i, t); 1152 unioned->Set(i, t);
932 } 1153 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 template <class Config> 1199 template <class Config>
979 void TypeImpl<Config>::BitsetType::Print(std::ostream& os, // NOLINT 1200 void TypeImpl<Config>::BitsetType::Print(std::ostream& os, // NOLINT
980 bitset bits) { 1201 bitset bits) {
981 DisallowHeapAllocation no_allocation; 1202 DisallowHeapAllocation no_allocation;
982 const char* name = Name(bits); 1203 const char* name = Name(bits);
983 if (name != NULL) { 1204 if (name != NULL) {
984 os << name; 1205 os << name;
985 return; 1206 return;
986 } 1207 }
987 1208
1209 // clang-format off
988 static const bitset named_bitsets[] = { 1210 static const bitset named_bitsets[] = {
989 #define BITSET_CONSTANT(type, value) REPRESENTATION(k##type), 1211 #define BITSET_CONSTANT(type, value) REPRESENTATION(k##type),
990 REPRESENTATION_BITSET_TYPE_LIST(BITSET_CONSTANT) 1212 REPRESENTATION_BITSET_TYPE_LIST(BITSET_CONSTANT)
991 #undef BITSET_CONSTANT 1213 #undef BITSET_CONSTANT
992 1214
993 #define BITSET_CONSTANT(type, value) SEMANTIC(k##type), 1215 #define BITSET_CONSTANT(type, value) SEMANTIC(k##type),
994 INTERNAL_BITSET_TYPE_LIST(BITSET_CONSTANT) 1216 INTERNAL_BITSET_TYPE_LIST(BITSET_CONSTANT)
995 SEMANTIC_BITSET_TYPE_LIST(BITSET_CONSTANT) 1217 SEMANTIC_BITSET_TYPE_LIST(BITSET_CONSTANT)
996 #undef BITSET_CONSTANT 1218 #undef BITSET_CONSTANT
997 }; 1219 };
1220 // clang-format on
998 1221
999 bool is_first = true; 1222 bool is_first = true;
1000 os << "("; 1223 os << "(";
1001 for (int i(arraysize(named_bitsets) - 1); bits != 0 && i >= 0; --i) { 1224 for (int i(arraysize(named_bitsets) - 1); bits != 0 && i >= 0; --i) {
1002 bitset subset = named_bitsets[i]; 1225 bitset subset = named_bitsets[i];
1003 if ((bits & subset) == subset) { 1226 if ((bits & subset) == subset) {
1004 if (!is_first) os << " | "; 1227 if (!is_first) os << " | ";
1005 is_first = false; 1228 is_first = false;
1006 os << Name(subset); 1229 os << Name(subset);
1007 bits -= subset; 1230 bits -= subset;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; 1321 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>;
1099 1322
1100 template TypeImpl<ZoneTypeConfig>::TypeHandle 1323 template TypeImpl<ZoneTypeConfig>::TypeHandle
1101 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( 1324 TypeImpl<ZoneTypeConfig>::Convert<HeapType>(
1102 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); 1325 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*);
1103 template TypeImpl<HeapTypeConfig>::TypeHandle 1326 template TypeImpl<HeapTypeConfig>::TypeHandle
1104 TypeImpl<HeapTypeConfig>::Convert<Type>( 1327 TypeImpl<HeapTypeConfig>::Convert<Type>(
1105 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); 1328 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*);
1106 1329
1107 } } // namespace v8::internal 1330 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/types.h ('k') | src/types-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698