Chromium Code Reviews| Index: src/heap.cc |
| diff --git a/src/heap.cc b/src/heap.cc |
| index c06a592efacb435b04bf248fa1bb7eaebb5f8322..4254a68dc09fe63ec46cff50b06e9164cf6f94e5 100644 |
| --- a/src/heap.cc |
| +++ b/src/heap.cc |
| @@ -731,7 +731,7 @@ void Heap::MoveElements(FixedArray* array, |
| int len) { |
| if (len == 0) return; |
| - ASSERT(array->map() != HEAP->fixed_cow_array_map()); |
| + ASSERT(array->map() != this->fixed_cow_array_map()); |
|
Sven Panne
2013/09/10 12:55:53
Why do we need "this->"?
|
| Object** dst_objects = array->data_start() + dst_index; |
| OS::MemMove(dst_objects, |
| array->data_start() + src_index, |
| @@ -765,9 +765,9 @@ class StringTableVerifier : public ObjectVisitor { |
| }; |
| -static void VerifyStringTable() { |
| +static void VerifyStringTable(Heap* heap) { |
| StringTableVerifier verifier; |
| - HEAP->string_table()->IterateElements(&verifier); |
| + heap->string_table()->IterateElements(&verifier); |
| } |
| #endif // VERIFY_HEAP |
| @@ -922,7 +922,7 @@ bool Heap::PerformGarbageCollection(GarbageCollector collector, |
| #ifdef VERIFY_HEAP |
| if (FLAG_verify_heap) { |
| - VerifyStringTable(); |
| + VerifyStringTable(this); |
| } |
| #endif |
| @@ -1046,7 +1046,7 @@ bool Heap::PerformGarbageCollection(GarbageCollector collector, |
| #ifdef VERIFY_HEAP |
| if (FLAG_verify_heap) { |
| - VerifyStringTable(); |
| + VerifyStringTable(this); |
| } |
| #endif |
| @@ -1154,29 +1154,33 @@ class ScavengeVisitor: public ObjectVisitor { |
| // new space. |
| class VerifyNonPointerSpacePointersVisitor: public ObjectVisitor { |
| public: |
| + explicit VerifyNonPointerSpacePointersVisitor(Heap* heap) : heap_(heap) {} |
| void VisitPointers(Object** start, Object**end) { |
| for (Object** current = start; current < end; current++) { |
| if ((*current)->IsHeapObject()) { |
| - CHECK(!HEAP->InNewSpace(HeapObject::cast(*current))); |
| + CHECK(!heap_->InNewSpace(HeapObject::cast(*current))); |
| } |
| } |
| } |
| + |
| + private: |
| + Heap* heap_; |
| }; |
| -static void VerifyNonPointerSpacePointers() { |
| +static void VerifyNonPointerSpacePointers(Heap* heap) { |
| // Verify that there are no pointers to new space in spaces where we |
| // do not expect them. |
| - VerifyNonPointerSpacePointersVisitor v; |
| - HeapObjectIterator code_it(HEAP->code_space()); |
| + VerifyNonPointerSpacePointersVisitor v(heap); |
| + HeapObjectIterator code_it(heap->code_space()); |
| for (HeapObject* object = code_it.Next(); |
| object != NULL; object = code_it.Next()) |
| object->Iterate(&v); |
| // The old data space was normally swept conservatively so that the iterator |
| // doesn't work, so we normally skip the next bit. |
| - if (!HEAP->old_data_space()->was_swept_conservatively()) { |
| - HeapObjectIterator data_it(HEAP->old_data_space()); |
| + if (!heap->old_data_space()->was_swept_conservatively()) { |
| + HeapObjectIterator data_it(heap->old_data_space()); |
| for (HeapObject* object = data_it.Next(); |
| object != NULL; object = data_it.Next()) |
| object->Iterate(&v); |
| @@ -1323,7 +1327,7 @@ void Heap::Scavenge() { |
| RelocationLock relocation_lock(this); |
| #ifdef VERIFY_HEAP |
| - if (FLAG_verify_heap) VerifyNonPointerSpacePointers(); |
| + if (FLAG_verify_heap) VerifyNonPointerSpacePointers(this); |
| #endif |
| gc_state_ = SCAVENGE; |
| @@ -2377,7 +2381,7 @@ void Heap::SelectScavengingVisitorsTable() { |
| void Heap::ScavengeObjectSlow(HeapObject** p, HeapObject* object) { |
| - SLOW_ASSERT(HEAP->InFromSpace(object)); |
| + SLOW_ASSERT(object->GetIsolate()->heap()->InFromSpace(object)); |
| MapWord first_word = object->map_word(); |
| SLOW_ASSERT(!first_word.IsForwardingAddress()); |
| Map* map = first_word.ToMap(); |
| @@ -7841,7 +7845,7 @@ int KeyedLookupCache::Lookup(Map* map, Name* name) { |
| void KeyedLookupCache::Update(Map* map, Name* name, int field_offset) { |
| if (!name->IsUniqueName()) { |
| String* internalized_string; |
| - if (!HEAP->InternalizeStringIfExists( |
| + if (!map->GetIsolate()->heap()->InternalizeStringIfExists( |
| String::cast(name), &internalized_string)) { |
| return; |
| } |
| @@ -7849,7 +7853,7 @@ void KeyedLookupCache::Update(Map* map, Name* name, int field_offset) { |
| } |
| // This cache is cleared only between mark compact passes, so we expect the |
| // cache to only contain old space names. |
| - ASSERT(!HEAP->InNewSpace(name)); |
| + ASSERT(!map->GetIsolate()->heap()->InNewSpace(name)); |
| int index = (Hash(map, name) & kHashMask); |
| // After a GC there will be free slots, so we use them in order (this may |