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

Side by Side Diff: src/types.cc

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 65
66 template<class T> 66 template<class T>
67 Handle<Type> Type::Iterator<T>::get_type() { 67 Handle<Type> Type::Iterator<T>::get_type() {
68 ASSERT(!Done()); 68 ASSERT(!Done());
69 return type_->is_union() ? union_get(type_->as_union(), index_) : type_; 69 return type_->is_union() ? union_get(type_->as_union(), index_) : type_;
70 } 70 }
71 71
72 template<> 72 template<>
73 Handle<Map> Type::Iterator<Map>::Current() { 73 Handle<i::Map> Type::Iterator<i::Map>::Current() {
74 return get_type()->as_class(); 74 return get_type()->as_class();
75 } 75 }
76 76
77 template<> 77 template<>
78 Handle<v8::internal::Object> Type::Iterator<v8::internal::Object>::Current() { 78 Handle<i::Object> Type::Iterator<i::Object>::Current() {
79 return get_type()->as_constant(); 79 return get_type()->as_constant();
80 } 80 }
81 81
82 82
83 template<> 83 template<>
84 bool Type::Iterator<Map>::matches(Handle<Type> type) { 84 bool Type::Iterator<i::Map>::matches(Handle<Type> type) {
85 return type->is_class(); 85 return type->is_class();
86 } 86 }
87 87
88 template<> 88 template<>
89 bool Type::Iterator<v8::internal::Object>::matches(Handle<Type> type) { 89 bool Type::Iterator<i::Object>::matches(Handle<Type> type) {
90 return type->is_constant(); 90 return type->is_constant();
91 } 91 }
92 92
93 93
94 template<class T> 94 template<class T>
95 void Type::Iterator<T>::Advance() { 95 void Type::Iterator<T>::Advance() {
96 ++index_; 96 ++index_;
97 if (type_->is_union()) { 97 if (type_->is_union()) {
98 Handle<Unioned> unioned = type_->as_union(); 98 Handle<Unioned> unioned = type_->as_union();
99 for (; index_ < unioned->length(); ++index_) { 99 for (; index_ < unioned->length(); ++index_) {
100 if (matches(union_get(unioned, index_))) return; 100 if (matches(union_get(unioned, index_))) return;
101 } 101 }
102 } else if (index_ == 0 && matches(type_)) { 102 } else if (index_ == 0 && matches(type_)) {
103 return; 103 return;
104 } 104 }
105 index_ = -1; 105 index_ = -1;
106 } 106 }
107 107
108 template class Type::Iterator<Map>; 108 template class Type::Iterator<i::Map>;
109 template class Type::Iterator<v8::internal::Object>; 109 template class Type::Iterator<i::Object>;
110 110
111 111
112 // Get the smallest bitset subsuming this type. 112 // Get the smallest bitset subsuming this type.
113 int Type::LubBitset() { 113 int Type::LubBitset() {
114 if (this->is_bitset()) { 114 if (this->is_bitset()) {
115 return this->as_bitset(); 115 return this->as_bitset();
116 } else if (this->is_union()) { 116 } else if (this->is_union()) {
117 Handle<Unioned> unioned = this->as_union(); 117 Handle<Unioned> unioned = this->as_union();
118 int bitset = kNone; 118 int bitset = kNone;
119 for (int i = 0; i < unioned->length(); ++i) { 119 for (int i = 0; i < unioned->length(); ++i) {
120 bitset |= union_get(unioned, i)->LubBitset(); 120 bitset |= union_get(unioned, i)->LubBitset();
121 } 121 }
122 return bitset; 122 return bitset;
123 } else if (this->is_class()) {
124 return LubBitset(*this->as_class());
123 } else { 125 } else {
124 Map* map = NULL; 126 return LubBitset(*this->as_constant());
125 if (this->is_class()) {
126 map = *this->as_class();
127 } else {
128 Handle<v8::internal::Object> value = this->as_constant();
129 if (value->IsSmi()) return kSmi;
130 map = HeapObject::cast(*value)->map();
131 if (map->instance_type() == HEAP_NUMBER_TYPE) {
132 int32_t i;
133 uint32_t u;
134 if (value->ToInt32(&i)) return Smi::IsValid(i) ? kSmi : kOtherSigned32;
135 if (value->ToUint32(&u)) return kUnsigned32;
136 return kDouble;
137 }
138 if (map->instance_type() == ODDBALL_TYPE) {
139 if (value->IsUndefined()) return kUndefined;
140 if (value->IsNull()) return kNull;
141 if (value->IsTrue() || value->IsFalse()) return kBoolean;
142 if (value->IsTheHole()) return kAny; // TODO(rossberg): kNone?
143 UNREACHABLE();
144 }
145 }
146 switch (map->instance_type()) {
147 case STRING_TYPE:
148 case ASCII_STRING_TYPE:
149 case CONS_STRING_TYPE:
150 case CONS_ASCII_STRING_TYPE:
151 case SLICED_STRING_TYPE:
152 case SLICED_ASCII_STRING_TYPE:
153 case EXTERNAL_STRING_TYPE:
154 case EXTERNAL_ASCII_STRING_TYPE:
155 case EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE:
156 case SHORT_EXTERNAL_STRING_TYPE:
157 case SHORT_EXTERNAL_ASCII_STRING_TYPE:
158 case SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE:
159 case INTERNALIZED_STRING_TYPE:
160 case ASCII_INTERNALIZED_STRING_TYPE:
161 case CONS_INTERNALIZED_STRING_TYPE:
162 case CONS_ASCII_INTERNALIZED_STRING_TYPE:
163 case EXTERNAL_INTERNALIZED_STRING_TYPE:
164 case EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE:
165 case EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE:
166 case SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE:
167 case SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE:
168 case SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE:
169 return kString;
170 case SYMBOL_TYPE:
171 return kSymbol;
172 case ODDBALL_TYPE:
173 return kOddball;
174 case HEAP_NUMBER_TYPE:
175 return kDouble;
176 case JS_VALUE_TYPE:
177 case JS_DATE_TYPE:
178 case JS_OBJECT_TYPE:
179 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
180 case JS_GENERATOR_OBJECT_TYPE:
181 case JS_MODULE_TYPE:
182 case JS_GLOBAL_OBJECT_TYPE:
183 case JS_BUILTINS_OBJECT_TYPE:
184 case JS_GLOBAL_PROXY_TYPE:
185 case JS_ARRAY_BUFFER_TYPE:
186 case JS_TYPED_ARRAY_TYPE:
187 case JS_DATA_VIEW_TYPE:
188 case JS_SET_TYPE:
189 case JS_MAP_TYPE:
190 case JS_WEAK_MAP_TYPE:
191 case JS_WEAK_SET_TYPE:
192 if (map->is_undetectable()) return kUndetectable;
193 return kOtherObject;
194 case JS_ARRAY_TYPE:
195 return kArray;
196 case JS_FUNCTION_TYPE:
197 return kFunction;
198 case JS_REGEXP_TYPE:
199 return kRegExp;
200 case JS_PROXY_TYPE:
201 case JS_FUNCTION_PROXY_TYPE:
202 return kProxy;
203 case MAP_TYPE:
204 // When compiling stub templates, the meta map is used as a place holder
205 // for the actual map with which the template is later instantiated.
206 // We treat it as a kind of type variable whose upper bound is Any.
207 // TODO(rossberg): for caching of CompareNilIC stubs to work correctly,
208 // we must exclude Undetectable here. This makes no sense, really,
209 // because it means that the template isn't actually parametric.
210 // Also, it doesn't apply elsewhere. 8-(
211 // We ought to find a cleaner solution for compiling stubs parameterised
212 // over type or class variables, esp ones with bounds...
213 return kDetectable;
214 case DECLARED_ACCESSOR_INFO_TYPE:
215 case EXECUTABLE_ACCESSOR_INFO_TYPE:
216 case ACCESSOR_PAIR_TYPE:
217 case FIXED_ARRAY_TYPE:
218 return kInternal;
219 default:
220 UNREACHABLE();
221 return kNone;
222 }
223 } 127 }
224 } 128 }
225 129
130
131 int Type::LubBitset(i::Object* value) {
132 if (value->IsSmi()) return kSmi;
133 i::Map* map = i::HeapObject::cast(value)->map();
134 if (map->instance_type() == HEAP_NUMBER_TYPE) {
135 int32_t i;
136 uint32_t u;
137 if (value->ToInt32(&i)) return Smi::IsValid(i) ? kSmi : kOtherSigned32;
138 if (value->ToUint32(&u)) return kUnsigned32;
139 return kDouble;
140 }
141 if (map->instance_type() == ODDBALL_TYPE) {
142 if (value->IsUndefined()) return kUndefined;
143 if (value->IsNull()) return kNull;
144 if (value->IsBoolean()) return kBoolean;
145 if (value->IsTheHole()) return kAny; // TODO(rossberg): kNone?
146 UNREACHABLE();
147 }
148 return Type::LubBitset(map);
149 }
150
151
152 int Type::LubBitset(i::Map* map) {
153 switch (map->instance_type()) {
154 case STRING_TYPE:
155 case ASCII_STRING_TYPE:
156 case CONS_STRING_TYPE:
157 case CONS_ASCII_STRING_TYPE:
158 case SLICED_STRING_TYPE:
159 case SLICED_ASCII_STRING_TYPE:
160 case EXTERNAL_STRING_TYPE:
161 case EXTERNAL_ASCII_STRING_TYPE:
162 case EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE:
163 case SHORT_EXTERNAL_STRING_TYPE:
164 case SHORT_EXTERNAL_ASCII_STRING_TYPE:
165 case SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE:
166 case INTERNALIZED_STRING_TYPE:
167 case ASCII_INTERNALIZED_STRING_TYPE:
168 case CONS_INTERNALIZED_STRING_TYPE:
169 case CONS_ASCII_INTERNALIZED_STRING_TYPE:
170 case EXTERNAL_INTERNALIZED_STRING_TYPE:
171 case EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE:
172 case EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE:
173 case SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE:
174 case SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE:
175 case SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE:
176 return kString;
177 case SYMBOL_TYPE:
178 return kSymbol;
179 case ODDBALL_TYPE:
180 return kOddball;
181 case HEAP_NUMBER_TYPE:
182 return kDouble;
183 case JS_VALUE_TYPE:
184 case JS_DATE_TYPE:
185 case JS_OBJECT_TYPE:
186 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
187 case JS_GENERATOR_OBJECT_TYPE:
188 case JS_MODULE_TYPE:
189 case JS_GLOBAL_OBJECT_TYPE:
190 case JS_BUILTINS_OBJECT_TYPE:
191 case JS_GLOBAL_PROXY_TYPE:
192 case JS_ARRAY_BUFFER_TYPE:
193 case JS_TYPED_ARRAY_TYPE:
194 case JS_DATA_VIEW_TYPE:
195 case JS_SET_TYPE:
196 case JS_MAP_TYPE:
197 case JS_WEAK_MAP_TYPE:
198 case JS_WEAK_SET_TYPE:
199 if (map->is_undetectable()) return kUndetectable;
200 return kOtherObject;
201 case JS_ARRAY_TYPE:
202 return kArray;
203 case JS_FUNCTION_TYPE:
204 return kFunction;
205 case JS_REGEXP_TYPE:
206 return kRegExp;
207 case JS_PROXY_TYPE:
208 case JS_FUNCTION_PROXY_TYPE:
209 return kProxy;
210 case MAP_TYPE:
211 // When compiling stub templates, the meta map is used as a place holder
212 // for the actual map with which the template is later instantiated.
213 // We treat it as a kind of type variable whose upper bound is Any.
214 // TODO(rossberg): for caching of CompareNilIC stubs to work correctly,
215 // we must exclude Undetectable here. This makes no sense, really,
216 // because it means that the template isn't actually parametric.
217 // Also, it doesn't apply elsewhere. 8-(
218 // We ought to find a cleaner solution for compiling stubs parameterised
219 // over type or class variables, esp ones with bounds...
220 return kDetectable;
221 case DECLARED_ACCESSOR_INFO_TYPE:
222 case EXECUTABLE_ACCESSOR_INFO_TYPE:
223 case ACCESSOR_PAIR_TYPE:
224 case FIXED_ARRAY_TYPE:
225 return kInternal;
226 default:
227 UNREACHABLE();
228 return kNone;
229 }
230 }
231
226 232
227 // Get the largest bitset subsumed by this type. 233 // Get the largest bitset subsumed by this type.
228 int Type::GlbBitset() { 234 int Type::GlbBitset() {
229 if (this->is_bitset()) { 235 if (this->is_bitset()) {
230 return this->as_bitset(); 236 return this->as_bitset();
231 } else if (this->is_union()) { 237 } else if (this->is_union()) {
232 // All but the first are non-bitsets and thus would yield kNone anyway. 238 // All but the first are non-bitsets and thus would yield kNone anyway.
233 return union_get(this->as_union(), 0)->GlbBitset(); 239 return union_get(this->as_union(), 0)->GlbBitset();
234 } else { 240 } else {
235 return kNone; 241 return kNone;
236 } 242 }
237 } 243 }
238 244
239 245
246 // Most precise _current_ type of a value (usually its class).
247 Type* Type::OfCurrently(Handle<i::Object> value) {
248 if (value->IsSmi()) return Smi();
249 i::Map* map = i::HeapObject::cast(*value)->map();
250 if (map->instance_type() == HEAP_NUMBER_TYPE ||
251 map->instance_type() == ODDBALL_TYPE) {
252 return Type::Of(value);
253 }
254 return Class(i::handle(map));
255 }
256
257
240 // Check this <= that. 258 // Check this <= that.
241 bool Type::SlowIs(Type* that) { 259 bool Type::SlowIs(Type* that) {
242 // Fast path for bitsets. 260 // Fast path for bitsets.
243 if (this->is_none()) return true; 261 if (this->is_none()) return true;
244 if (that->is_bitset()) { 262 if (that->is_bitset()) {
245 return (this->LubBitset() | that->as_bitset()) == that->as_bitset(); 263 return (this->LubBitset() | that->as_bitset()) == that->as_bitset();
246 } 264 }
247 265
248 if (that->is_class()) { 266 if (that->is_class()) {
249 return this->is_class() && *this->as_class() == *that->as_class(); 267 return this->is_class() && *this->as_class() == *that->as_class();
(...skipping 22 matching lines...) Expand all
272 if (this->Is(that_i)) return true; 290 if (this->Is(that_i)) return true;
273 if (this->is_bitset()) break; // Fast fail, no other field is a bitset. 291 if (this->is_bitset()) break; // Fast fail, no other field is a bitset.
274 } 292 }
275 return false; 293 return false;
276 } 294 }
277 295
278 return false; 296 return false;
279 } 297 }
280 298
281 299
300 bool Type::IsCurrently(Type* that) {
301 return this->Is(that) ||
302 (this->is_constant() && that->is_class() &&
303 this->as_constant()->IsHeapObject() &&
304 i::HeapObject::cast(*this->as_constant())->map() == *that->as_class());
305 }
306
307
282 // Check this overlaps that. 308 // Check this overlaps that.
283 bool Type::Maybe(Type* that) { 309 bool Type::Maybe(Type* that) {
284 // Fast path for bitsets. 310 // Fast path for bitsets.
285 if (this->is_bitset()) { 311 if (this->is_bitset()) {
286 return (this->as_bitset() & that->LubBitset()) != 0; 312 return (this->as_bitset() & that->LubBitset()) != 0;
287 } 313 }
288 if (that->is_bitset()) { 314 if (that->is_bitset()) {
289 return (this->LubBitset() & that->as_bitset()) != 0; 315 return (this->LubBitset() & that->as_bitset()) != 0;
290 } 316 }
291 317
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // Semi-fast case: Unioned objects are neither involved nor produced. 393 // Semi-fast case: Unioned objects are neither involved nor produced.
368 if (!(type1->is_union() || type2->is_union())) { 394 if (!(type1->is_union() || type2->is_union())) {
369 if (type1->Is(type2)) return *type2; 395 if (type1->Is(type2)) return *type2;
370 if (type2->Is(type1)) return *type1; 396 if (type2->Is(type1)) return *type1;
371 } 397 }
372 398
373 // Slow case: may need to produce a Unioned object. 399 // Slow case: may need to produce a Unioned object.
374 Isolate* isolate = NULL; 400 Isolate* isolate = NULL;
375 int size = type1->is_bitset() || type2->is_bitset() ? 1 : 0; 401 int size = type1->is_bitset() || type2->is_bitset() ? 1 : 0;
376 if (!type1->is_bitset()) { 402 if (!type1->is_bitset()) {
377 isolate = HeapObject::cast(*type1)->GetIsolate(); 403 isolate = i::HeapObject::cast(*type1)->GetIsolate();
378 size += (type1->is_union() ? type1->as_union()->length() : 1); 404 size += (type1->is_union() ? type1->as_union()->length() : 1);
379 } 405 }
380 if (!type2->is_bitset()) { 406 if (!type2->is_bitset()) {
381 isolate = HeapObject::cast(*type2)->GetIsolate(); 407 isolate = i::HeapObject::cast(*type2)->GetIsolate();
382 size += (type2->is_union() ? type2->as_union()->length() : 1); 408 size += (type2->is_union() ? type2->as_union()->length() : 1);
383 } 409 }
384 ASSERT(isolate != NULL); 410 ASSERT(isolate != NULL);
385 ASSERT(size >= 2); 411 ASSERT(size >= 2);
386 Handle<Unioned> unioned = isolate->factory()->NewFixedArray(size); 412 Handle<Unioned> unioned = isolate->factory()->NewFixedArray(size);
387 size = 0; 413 size = 0;
388 414
389 int bitset = type1->GlbBitset() | type2->GlbBitset(); 415 int bitset = type1->GlbBitset() | type2->GlbBitset();
390 if (bitset != kNone) unioned->set(size++, from_bitset(bitset)); 416 if (bitset != kNone) unioned->set(size++, from_bitset(bitset));
391 size = type1->ExtendUnion(unioned, size); 417 size = type1->ExtendUnion(unioned, size);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // Semi-fast case: Unioned objects are neither involved nor produced. 469 // Semi-fast case: Unioned objects are neither involved nor produced.
444 if (!(type1->is_union() || type2->is_union())) { 470 if (!(type1->is_union() || type2->is_union())) {
445 if (type1->Is(type2)) return *type1; 471 if (type1->Is(type2)) return *type1;
446 if (type2->Is(type1)) return *type2; 472 if (type2->Is(type1)) return *type2;
447 } 473 }
448 474
449 // Slow case: may need to produce a Unioned object. 475 // Slow case: may need to produce a Unioned object.
450 Isolate* isolate = NULL; 476 Isolate* isolate = NULL;
451 int size = 0; 477 int size = 0;
452 if (!type1->is_bitset()) { 478 if (!type1->is_bitset()) {
453 isolate = HeapObject::cast(*type1)->GetIsolate(); 479 isolate = i::HeapObject::cast(*type1)->GetIsolate();
454 size = (type1->is_union() ? type1->as_union()->length() : 2); 480 size = (type1->is_union() ? type1->as_union()->length() : 2);
455 } 481 }
456 if (!type2->is_bitset()) { 482 if (!type2->is_bitset()) {
457 isolate = HeapObject::cast(*type2)->GetIsolate(); 483 isolate = i::HeapObject::cast(*type2)->GetIsolate();
458 int size2 = (type2->is_union() ? type2->as_union()->length() : 2); 484 int size2 = (type2->is_union() ? type2->as_union()->length() : 2);
459 size = (size == 0 ? size2 : Min(size, size2)); 485 size = (size == 0 ? size2 : Min(size, size2));
460 } 486 }
461 ASSERT(isolate != NULL); 487 ASSERT(isolate != NULL);
462 ASSERT(size >= 2); 488 ASSERT(size >= 2);
463 Handle<Unioned> unioned = isolate->factory()->NewFixedArray(size); 489 Handle<Unioned> unioned = isolate->factory()->NewFixedArray(size);
464 size = 0; 490 size = 0;
465 491
466 int bitset = type1->GlbBitset() & type2->GlbBitset(); 492 int bitset = type1->GlbBitset() & type2->GlbBitset();
467 if (bitset != kNone) unioned->set(size++, from_bitset(bitset)); 493 if (bitset != kNone) unioned->set(size++, from_bitset(bitset));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 526
501 527
502 #ifdef OBJECT_PRINT 528 #ifdef OBJECT_PRINT
503 void Type::TypePrint() { 529 void Type::TypePrint() {
504 TypePrint(stdout); 530 TypePrint(stdout);
505 PrintF(stdout, "\n"); 531 PrintF(stdout, "\n");
506 Flush(stdout); 532 Flush(stdout);
507 } 533 }
508 534
509 535
536 const char* Type::bitset_name(int bitset) {
537 switch (bitset) {
538 #define PRINT_COMPOSED_TYPE(type, value) case k##type: return #type;
539 BITSET_TYPE_LIST(PRINT_COMPOSED_TYPE)
540 #undef PRINT_COMPOSED_TYPE
541 default:
542 return NULL;
543 }
544 }
545
546
510 void Type::TypePrint(FILE* out) { 547 void Type::TypePrint(FILE* out) {
511 if (is_bitset()) { 548 if (is_bitset()) {
512 int val = as_bitset(); 549 int bitset = as_bitset();
513 const char* composed_name = GetComposedName(val); 550 const char* name = bitset_name(bitset);
514 if (composed_name != NULL) { 551 if (name != NULL) {
515 PrintF(out, "%s", composed_name); 552 PrintF(out, "%s", name);
516 return; 553 } else {
554 bool is_first = true;
555 PrintF(out, "(");
556 for (int mask = 1; mask != 0; mask = mask << 1) {
557 if ((bitset & mask) != 0) {
558 if (!is_first) PrintF(out, " | ");
559 is_first = false;
560 PrintF(out, "%s", bitset_name(mask));
561 }
562 }
563 PrintF(out, ")");
517 } 564 }
518 bool first_entry = true;
519 PrintF(out, "{");
520 for (unsigned i = 0; i < sizeof(val)*8; ++i) {
521 int mask = (1 << i);
522 if ((val & mask) != 0) {
523 if (!first_entry) PrintF(out, ",");
524 first_entry = false;
525 PrintF(out, "%s", GetPrimitiveName(mask));
526 }
527 }
528 PrintF(out, "}");
529 } else if (is_constant()) { 565 } else if (is_constant()) {
530 PrintF(out, "Constant(%p : ", static_cast<void*>(*as_constant())); 566 PrintF(out, "Constant(%p : ", static_cast<void*>(*as_constant()));
531 from_bitset(LubBitset())->TypePrint(out); 567 from_bitset(LubBitset())->TypePrint(out);
532 PrintF(")"); 568 PrintF(")");
533 } else if (is_class()) { 569 } else if (is_class()) {
534 PrintF(out, "Class(%p < ", static_cast<void*>(*as_class())); 570 PrintF(out, "Class(%p < ", static_cast<void*>(*as_class()));
535 from_bitset(LubBitset())->TypePrint(out); 571 from_bitset(LubBitset())->TypePrint(out);
536 PrintF(")"); 572 PrintF(")");
537 } else if (is_union()) { 573 } else if (is_union()) {
538 PrintF(out, "{"); 574 PrintF(out, "(");
539 Handle<Unioned> unioned = as_union(); 575 Handle<Unioned> unioned = as_union();
540 for (int i = 0; i < unioned->length(); ++i) { 576 for (int i = 0; i < unioned->length(); ++i) {
541 Handle<Type> type_i = union_get(unioned, i); 577 Handle<Type> type_i = union_get(unioned, i);
542 if (i > 0) PrintF(out, ","); 578 if (i > 0) PrintF(out, " | ");
543 type_i->TypePrint(out); 579 type_i->TypePrint(out);
544 } 580 }
545 PrintF(out, "}"); 581 PrintF(out, ")");
546 } 582 }
547 } 583 }
548 #endif 584 #endif
549 585
550 586
551 } } // namespace v8::internal 587 } } // namespace v8::internal
OLDNEW
« include/v8-platform.h ('K') | « src/types.h ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698