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

Side by Side Diff: src/types.cc

Issue 230923005: FYI -- apparently, there are more bugs... (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Completed Created 6 years, 8 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
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 "types.h" 5 #include "types.h"
6 6
7 #include "string-stream.h" 7 #include "string-stream.h"
8 #include "types-inl.h" 8 #include "types-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 return false; 300 return false;
301 } 301 }
302 302
303 return false; 303 return false;
304 } 304 }
305 305
306 306
307 template<class Config> 307 template<class Config>
308 bool TypeImpl<Config>::NowIs(TypeImpl* that) { 308 bool TypeImpl<Config>::NowIs(TypeImpl* that) {
309 // TODO(rossberg): this is incorrect for
310 // Union(Constant(V), T)->NowIs(Class(M))
311 // but fuzzing does not cover that!
309 DisallowHeapAllocation no_allocation; 312 DisallowHeapAllocation no_allocation;
310 if (this->IsConstant()) { 313 if (this->IsConstant()) {
311 i::Object* object = *this->AsConstant(); 314 i::Object* object = *this->AsConstant();
312 if (object->IsHeapObject()) { 315 if (object->IsHeapObject()) {
313 i::Map* map = i::HeapObject::cast(object)->map(); 316 i::Map* map = i::HeapObject::cast(object)->map();
314 for (Iterator<i::Map> it = that->Classes(); !it.Done(); it.Advance()) { 317 for (Iterator<i::Map> it = that->Classes(); !it.Done(); it.Advance()) {
315 if (*it.Current() == map) return true; 318 if (*it.Current() == map) return true;
316 } 319 }
317 } 320 }
318 } 321 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 444
442 // Slow case: may need to produce a Unioned object. 445 // Slow case: may need to produce a Unioned object.
443 int size = 0; 446 int size = 0;
444 if (!type1->IsBitset()) { 447 if (!type1->IsBitset()) {
445 size += (type1->IsUnion() ? Config::struct_length(type1->AsUnion()) : 1); 448 size += (type1->IsUnion() ? Config::struct_length(type1->AsUnion()) : 1);
446 } 449 }
447 if (!type2->IsBitset()) { 450 if (!type2->IsBitset()) {
448 size += (type2->IsUnion() ? Config::struct_length(type2->AsUnion()) : 1); 451 size += (type2->IsUnion() ? Config::struct_length(type2->AsUnion()) : 1);
449 } 452 }
450 int bitset = type1->GlbBitset() | type2->GlbBitset(); 453 int bitset = type1->GlbBitset() | type2->GlbBitset();
451 if (IsInhabited(bitset)) ++size; 454 if (bitset != kNone) ++size;
452 ASSERT(size >= 1); 455 ASSERT(size >= 1);
453 StructHandle unioned = Config::struct_create(kUnionTag, size, region); 456 StructHandle unioned = Config::struct_create(kUnionTag, size, region);
454 457
455 size = 0; 458 size = 0;
456 if (IsInhabited(bitset)) { 459 if (bitset != kNone) {
457 Config::struct_set(unioned, size++, Config::from_bitset(bitset, region)); 460 Config::struct_set(unioned, size++, Config::from_bitset(bitset, region));
458 } 461 }
459 size = ExtendUnion(unioned, type1, size); 462 size = ExtendUnion(unioned, type1, size);
460 size = ExtendUnion(unioned, type2, size); 463 size = ExtendUnion(unioned, type2, size);
461 464
462 if (size == 1) { 465 if (size == 1) {
463 return Config::struct_get(unioned, 0); 466 return Config::struct_get(unioned, 0);
464 } else { 467 } else {
465 Config::struct_shrink(unioned, size); 468 Config::struct_shrink(unioned, size);
466 return Config::from_struct(unioned); 469 return Config::from_struct(unioned);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 // Slow case: may need to produce a Unioned object. 520 // Slow case: may need to produce a Unioned object.
518 int size = INT_MAX; 521 int size = INT_MAX;
519 if (!type1->IsBitset()) { 522 if (!type1->IsBitset()) {
520 size = (type1->IsUnion() ? Config::struct_length(type1->AsUnion()) : 1); 523 size = (type1->IsUnion() ? Config::struct_length(type1->AsUnion()) : 1);
521 } 524 }
522 if (!type2->IsBitset()) { 525 if (!type2->IsBitset()) {
523 size = Min(size, 526 size = Min(size,
524 type2->IsUnion() ? Config::struct_length(type2->AsUnion()) : 1); 527 type2->IsUnion() ? Config::struct_length(type2->AsUnion()) : 1);
525 } 528 }
526 int bitset = type1->GlbBitset() & type2->GlbBitset(); 529 int bitset = type1->GlbBitset() & type2->GlbBitset();
527 if (IsInhabited(bitset)) ++size; 530 if (bitset != kNone) ++size;
528 ASSERT(size >= 1); 531 ASSERT(size >= 1);
529 StructHandle unioned = Config::struct_create(kUnionTag, size, region); 532 StructHandle unioned = Config::struct_create(kUnionTag, size, region);
530 533
531 size = 0; 534 size = 0;
532 if (IsInhabited(bitset)) { 535 if (bitset != kNone) {
533 Config::struct_set(unioned, size++, Config::from_bitset(bitset, region)); 536 Config::struct_set(unioned, size++, Config::from_bitset(bitset, region));
534 } 537 }
535 size = ExtendIntersection(unioned, type1, type2, size); 538 size = ExtendIntersection(unioned, type1, type2, size);
536 size = ExtendIntersection(unioned, type2, type1, size); 539 size = ExtendIntersection(unioned, type2, type1, size);
537 540
538 if (size == 0) { 541 if (size == 0) {
539 return None(region); 542 return None(region);
540 } else if (size == 1) { 543 } else if (size == 1) {
541 return Config::struct_get(unioned, 0); 544 return Config::struct_get(unioned, 0);
542 } else { 545 } else {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; 691 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>;
689 692
690 template TypeImpl<ZoneTypeConfig>::TypeHandle 693 template TypeImpl<ZoneTypeConfig>::TypeHandle
691 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( 694 TypeImpl<ZoneTypeConfig>::Convert<HeapType>(
692 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); 695 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*);
693 template TypeImpl<HeapTypeConfig>::TypeHandle 696 template TypeImpl<HeapTypeConfig>::TypeHandle
694 TypeImpl<HeapTypeConfig>::Convert<Type>( 697 TypeImpl<HeapTypeConfig>::Convert<Type>(
695 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); 698 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*);
696 699
697 } } // namespace v8::internal 700 } } // namespace v8::internal
OLDNEW
« src/types.h ('K') | « src/types.h ('k') | test/cctest/test-types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698