Chromium Code Reviews| Index: src/objects.cc |
| diff --git a/src/objects.cc b/src/objects.cc |
| index 277d320588d04ccbdb92a715e6bdc147333beb85..4d27fe4f8bea18cc78f7c51d6a26a9ad1df87282 100644 |
| --- a/src/objects.cc |
| +++ b/src/objects.cc |
| @@ -9963,13 +9963,49 @@ 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) { |
| + if (number_of_entries(CODE_PTR, SMALL_SECTION) > 0) { |
|
ulan
2014/06/02 12:32:58
Type type[] = {CODE_PTR, HEAP_PTR};
Address value[
rmcilroy
2014/06/03 12:32:28
Done. I'm not convinced this is clearer though.
|
| + int offset = OffsetOfElementAt(first_index(CODE_PTR, SMALL_SECTION)); |
| + MemsetPointer( |
| + reinterpret_cast<Address*>(HeapObject::RawField(this, offset)), |
| + isolate->builtins()->builtin(Builtins::kIllegal)->entry(), |
| + number_of_entries(CODE_PTR, SMALL_SECTION)); |
| + } |
| + if (number_of_entries(HEAP_PTR, SMALL_SECTION) > 0) { |
| + int offset = OffsetOfElementAt(first_index(HEAP_PTR, SMALL_SECTION)); |
| + MemsetPointer( |
| + HeapObject::RawField(this, offset), |
| + isolate->heap()->undefined_value(), |
| + number_of_entries(HEAP_PTR, SMALL_SECTION)); |
| + } |
| + if (is_extended_layout()) { |
| + if (number_of_entries(CODE_PTR, EXTENDED_SECTION) > 0) { |
| + int offset = OffsetOfElementAt(first_index(CODE_PTR, EXTENDED_SECTION)); |
| + MemsetPointer( |
| + reinterpret_cast<Address*>(HeapObject::RawField(this, offset)), |
| + isolate->builtins()->builtin(Builtins::kIllegal)->entry(), |
| + number_of_entries(CODE_PTR, EXTENDED_SECTION)); |
| + } |
| + if (number_of_entries(HEAP_PTR, EXTENDED_SECTION) > 0) { |
| + int offset = OffsetOfElementAt(first_index(HEAP_PTR, EXTENDED_SECTION)); |
| + MemsetPointer( |
| + HeapObject::RawField(this, offset), |
| + isolate->heap()->undefined_value(), |
| + number_of_entries(HEAP_PTR, EXTENDED_SECTION)); |
| + } |
| } |
| } |