Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 38d4bd1f45834522309563b4da3d039af59fa632..ddd97c6c450f17e7942c0cce781021dfe535c26f 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -9863,13 +9863,36 @@ bool Map::EquivalentToForNormalization(Map* other, |
void ConstantPoolArray::ConstantPoolIterateBody(ObjectVisitor* v) { |
- for (int i = 0; i < count_of_code_ptr_entries(); i++) { |
- int index = first_code_ptr_index() + i; |
- v->VisitCodeEntry(reinterpret_cast<Address>(RawFieldOfElementAt(index))); |
+ ConstantPoolArray::Iterator code_iter(this, ConstantPoolArray::CODE_PTR); |
+ while (!code_iter.is_finished()) { |
+ v->VisitCodeEntry(reinterpret_cast<Address>( |
+ RawFieldOfElementAt(code_iter.next_index()))); |
} |
- for (int i = 0; i < count_of_heap_ptr_entries(); i++) { |
- int index = first_heap_ptr_index() + i; |
- v->VisitPointer(RawFieldOfElementAt(index)); |
+ |
+ ConstantPoolArray::Iterator heap_iter(this, ConstantPoolArray::HEAP_PTR); |
+ while (!heap_iter.is_finished()) { |
+ v->VisitPointer(RawFieldOfElementAt(heap_iter.next_index())); |
+ } |
+} |
+ |
+ |
+void ConstantPoolArray::ClearPtrEntries(Isolate* isolate) { |
+ Type type[] = { CODE_PTR, HEAP_PTR }; |
+ Address default_value[] = { |
+ isolate->builtins()->builtin(Builtins::kIllegal)->entry(), |
+ reinterpret_cast<Address>(isolate->heap()->undefined_value()) }; |
+ |
+ for (int i = 0; i < 2; ++i) { |
+ for (int s = 0; s <= final_section(); ++s) { |
+ LayoutSection section = static_cast<LayoutSection>(s); |
+ if (number_of_entries(type[i], section) > 0) { |
+ int offset = OffsetOfElementAt(first_index(type[i], section)); |
+ MemsetPointer( |
+ reinterpret_cast<Address*>(HeapObject::RawField(this, offset)), |
+ default_value[i], |
+ number_of_entries(type[i], section)); |
+ } |
+ } |
} |
} |