| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 public: | 1672 public: |
| 1673 explicit StringTableCleaner(Heap* heap) : heap_(heap), pointers_removed_(0) {} | 1673 explicit StringTableCleaner(Heap* heap) : heap_(heap), pointers_removed_(0) {} |
| 1674 | 1674 |
| 1675 virtual void VisitPointers(Object** start, Object** end) { | 1675 virtual void VisitPointers(Object** start, Object** end) { |
| 1676 // Visit all HeapObject pointers in [start, end). | 1676 // Visit all HeapObject pointers in [start, end). |
| 1677 for (Object** p = start; p < end; p++) { | 1677 for (Object** p = start; p < end; p++) { |
| 1678 Object* o = *p; | 1678 Object* o = *p; |
| 1679 if (o->IsHeapObject() && | 1679 if (o->IsHeapObject() && |
| 1680 Marking::IsWhite(Marking::MarkBitFrom(HeapObject::cast(o)))) { | 1680 Marking::IsWhite(Marking::MarkBitFrom(HeapObject::cast(o)))) { |
| 1681 if (finalize_external_strings) { | 1681 if (finalize_external_strings) { |
| 1682 // We must never finalize a string that was copied (has a forwarding | 1682 DCHECK(o->IsExternalString()); |
| 1683 // map). | |
| 1684 CHECK(o->IsExternalString()); | |
| 1685 heap_->FinalizeExternalString(String::cast(*p)); | 1683 heap_->FinalizeExternalString(String::cast(*p)); |
| 1686 } else { | 1684 } else { |
| 1687 pointers_removed_++; | 1685 pointers_removed_++; |
| 1688 } | 1686 } |
| 1689 // Set the entry to the_hole_value (as deleted). | 1687 // Set the entry to the_hole_value (as deleted). |
| 1690 *p = heap_->the_hole_value(); | 1688 *p = heap_->the_hole_value(); |
| 1691 } else { | |
| 1692 // Anything in the external string table has to be either a string or | |
| 1693 // the hole. | |
| 1694 CHECK(!finalize_external_strings || o->IsExternalString() || | |
| 1695 o->IsTheHole()); | |
| 1696 } | 1689 } |
| 1697 } | 1690 } |
| 1698 } | 1691 } |
| 1699 | 1692 |
| 1700 int PointersRemoved() { | 1693 int PointersRemoved() { |
| 1701 DCHECK(!finalize_external_strings); | 1694 DCHECK(!finalize_external_strings); |
| 1702 return pointers_removed_; | 1695 return pointers_removed_; |
| 1703 } | 1696 } |
| 1704 | 1697 |
| 1705 private: | 1698 private: |
| (...skipping 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4681 SlotsBuffer* buffer = *buffer_address; | 4674 SlotsBuffer* buffer = *buffer_address; |
| 4682 while (buffer != NULL) { | 4675 while (buffer != NULL) { |
| 4683 SlotsBuffer* next_buffer = buffer->next(); | 4676 SlotsBuffer* next_buffer = buffer->next(); |
| 4684 DeallocateBuffer(buffer); | 4677 DeallocateBuffer(buffer); |
| 4685 buffer = next_buffer; | 4678 buffer = next_buffer; |
| 4686 } | 4679 } |
| 4687 *buffer_address = NULL; | 4680 *buffer_address = NULL; |
| 4688 } | 4681 } |
| 4689 } // namespace internal | 4682 } // namespace internal |
| 4690 } // namespace v8 | 4683 } // namespace v8 |
| OLD | NEW |