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

Side by Side Diff: src/types.cc

Issue 26959004: Ensure lower <= upper bound (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/types.h ('k') | src/typing.cc » ('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 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 return union_get(this->as_union(), 0)->GlbBitset(); 233 return union_get(this->as_union(), 0)->GlbBitset();
234 } else { 234 } else {
235 return kNone; 235 return kNone;
236 } 236 }
237 } 237 }
238 238
239 239
240 // Check this <= that. 240 // Check this <= that.
241 bool Type::SlowIs(Type* that) { 241 bool Type::SlowIs(Type* that) {
242 // Fast path for bitsets. 242 // Fast path for bitsets.
243 if (this->is_none()) return true;
243 if (that->is_bitset()) { 244 if (that->is_bitset()) {
244 return (this->LubBitset() | that->as_bitset()) == that->as_bitset(); 245 return (this->LubBitset() | that->as_bitset()) == that->as_bitset();
245 } 246 }
246 247
247 if (that->is_class()) { 248 if (that->is_class()) {
248 return this->is_class() && *this->as_class() == *that->as_class(); 249 return this->is_class() && *this->as_class() == *that->as_class();
249 } 250 }
250 if (that->is_constant()) { 251 if (that->is_constant()) {
251 return this->is_constant() && *this->as_constant() == *that->as_constant(); 252 return this->is_constant() && *this->as_constant() == *that->as_constant();
252 } 253 }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 for (unsigned i = 0; i < sizeof(val)*8; ++i) { 520 for (unsigned i = 0; i < sizeof(val)*8; ++i) {
520 int mask = (1 << i); 521 int mask = (1 << i);
521 if ((val & mask) != 0) { 522 if ((val & mask) != 0) {
522 if (!first_entry) PrintF(out, ","); 523 if (!first_entry) PrintF(out, ",");
523 first_entry = false; 524 first_entry = false;
524 PrintF(out, "%s", GetPrimitiveName(mask)); 525 PrintF(out, "%s", GetPrimitiveName(mask));
525 } 526 }
526 } 527 }
527 PrintF(out, "}"); 528 PrintF(out, "}");
528 } else if (is_constant()) { 529 } else if (is_constant()) {
529 PrintF(out, "Constant(%p)", static_cast<void*>(*as_constant())); 530 PrintF(out, "Constant(%p : ", static_cast<void*>(*as_constant()));
531 from_bitset(LubBitset())->TypePrint(out);
532 PrintF(")");
530 } else if (is_class()) { 533 } else if (is_class()) {
531 PrintF(out, "Class(%p)", static_cast<void*>(*as_class())); 534 PrintF(out, "Class(%p < ", static_cast<void*>(*as_class()));
535 from_bitset(LubBitset())->TypePrint(out);
536 PrintF(")");
532 } else if (is_union()) { 537 } else if (is_union()) {
533 PrintF(out, "{"); 538 PrintF(out, "{");
534 Handle<Unioned> unioned = as_union(); 539 Handle<Unioned> unioned = as_union();
535 for (int i = 0; i < unioned->length(); ++i) { 540 for (int i = 0; i < unioned->length(); ++i) {
536 Handle<Type> type_i = union_get(unioned, i); 541 Handle<Type> type_i = union_get(unioned, i);
537 if (i > 0) PrintF(out, ","); 542 if (i > 0) PrintF(out, ",");
538 type_i->TypePrint(out); 543 type_i->TypePrint(out);
539 } 544 }
540 PrintF(out, "}"); 545 PrintF(out, "}");
541 } 546 }
542 } 547 }
543 #endif 548 #endif
544 549
545 550
546 } } // namespace v8::internal 551 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/types.h ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698