OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 v->VisitPointers(start, start + old_space_strings_.length()); | 588 v->VisitPointers(start, start + old_space_strings_.length()); |
589 } | 589 } |
590 } | 590 } |
591 | 591 |
592 | 592 |
593 // Verify() is inline to avoid ifdef-s around its calls in release | 593 // Verify() is inline to avoid ifdef-s around its calls in release |
594 // mode. | 594 // mode. |
595 void ExternalStringTable::Verify() { | 595 void ExternalStringTable::Verify() { |
596 #ifdef DEBUG | 596 #ifdef DEBUG |
597 for (int i = 0; i < new_space_strings_.length(); ++i) { | 597 for (int i = 0; i < new_space_strings_.length(); ++i) { |
598 ASSERT(heap_->InNewSpace(new_space_strings_[i])); | 598 Object* obj = Object::cast(new_space_strings_[i]); |
599 ASSERT(new_space_strings_[i] != HEAP->raw_unchecked_the_hole_value()); | 599 // TODO(yangguo): check that the object is indeed an external string. |
| 600 ASSERT(heap_->InNewSpace(obj)); |
| 601 ASSERT(obj != HEAP->raw_unchecked_the_hole_value()); |
| 602 if (obj->IsExternalAsciiString()) { |
| 603 ExternalAsciiString* string = ExternalAsciiString::cast(obj); |
| 604 ASSERT(String::IsAscii(string->GetChars(), string->length())); |
| 605 } |
600 } | 606 } |
601 for (int i = 0; i < old_space_strings_.length(); ++i) { | 607 for (int i = 0; i < old_space_strings_.length(); ++i) { |
602 ASSERT(!heap_->InNewSpace(old_space_strings_[i])); | 608 Object* obj = Object::cast(new_space_strings_[i]); |
603 ASSERT(old_space_strings_[i] != HEAP->raw_unchecked_the_hole_value()); | 609 // TODO(yangguo): check that the object is indeed an external string. |
| 610 ASSERT(!heap_->InNewSpace(obj)); |
| 611 ASSERT(obj != HEAP->raw_unchecked_the_hole_value()); |
| 612 if (obj->IsExternalAsciiString()) { |
| 613 ExternalAsciiString* string = ExternalAsciiString::cast(obj); |
| 614 ASSERT(String::IsAscii(string->GetChars(), string->length())); |
| 615 } |
604 } | 616 } |
605 #endif | 617 #endif |
606 } | 618 } |
607 | 619 |
608 | 620 |
609 void ExternalStringTable::AddOldString(String* string) { | 621 void ExternalStringTable::AddOldString(String* string) { |
610 ASSERT(string->IsExternalString()); | 622 ASSERT(string->IsExternalString()); |
611 ASSERT(!heap_->InNewSpace(string)); | 623 ASSERT(!heap_->InNewSpace(string)); |
612 old_space_strings_.Add(string); | 624 old_space_strings_.Add(string); |
613 } | 625 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 AssertNoAllocation::~AssertNoAllocation() { } | 796 AssertNoAllocation::~AssertNoAllocation() { } |
785 DisableAssertNoAllocation::DisableAssertNoAllocation() { } | 797 DisableAssertNoAllocation::DisableAssertNoAllocation() { } |
786 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } | 798 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } |
787 | 799 |
788 #endif | 800 #endif |
789 | 801 |
790 | 802 |
791 } } // namespace v8::internal | 803 } } // namespace v8::internal |
792 | 804 |
793 #endif // V8_HEAP_INL_H_ | 805 #endif // V8_HEAP_INL_H_ |
OLD | NEW |