OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 Context::NEXT_CONTEXT_LINK, | 1347 Context::NEXT_CONTEXT_LINK, |
1348 Heap::undefined_value(), | 1348 Heap::undefined_value(), |
1349 UPDATE_WRITE_BARRIER); | 1349 UPDATE_WRITE_BARRIER); |
1350 } | 1350 } |
1351 | 1351 |
1352 // Update the head of the list of contexts. | 1352 // Update the head of the list of contexts. |
1353 global_contexts_list_ = head; | 1353 global_contexts_list_ = head; |
1354 } | 1354 } |
1355 | 1355 |
1356 | 1356 |
| 1357 void Heap::VisitExternalResources(v8::ExternalResourceVisitor* visitor) { |
| 1358 CollectAllGarbage(kMakeHeapIterableMask); |
| 1359 AssertNoAllocation no_allocation; |
| 1360 HeapIterator iterator; |
| 1361 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 1362 if (obj->IsExternalString()) { |
| 1363 visitor->VisitExternalString(Utils::ToLocal( |
| 1364 i::Handle<i::String>(String::cast(obj)))); |
| 1365 } |
| 1366 } |
| 1367 } |
| 1368 |
| 1369 |
1357 class NewSpaceScavenger : public StaticNewSpaceVisitor<NewSpaceScavenger> { | 1370 class NewSpaceScavenger : public StaticNewSpaceVisitor<NewSpaceScavenger> { |
1358 public: | 1371 public: |
1359 static inline void VisitPointer(Heap* heap, Object** p) { | 1372 static inline void VisitPointer(Heap* heap, Object** p) { |
1360 Object* object = *p; | 1373 Object* object = *p; |
1361 if (!heap->InNewSpace(object)) return; | 1374 if (!heap->InNewSpace(object)) return; |
1362 Heap::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 1375 Heap::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
1363 reinterpret_cast<HeapObject*>(object)); | 1376 reinterpret_cast<HeapObject*>(object)); |
1364 } | 1377 } |
1365 }; | 1378 }; |
1366 | 1379 |
(...skipping 5265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6632 isolate_->heap()->store_buffer()->Compact(); | 6645 isolate_->heap()->store_buffer()->Compact(); |
6633 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6646 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6634 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6647 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6635 next = chunk->next_chunk(); | 6648 next = chunk->next_chunk(); |
6636 isolate_->memory_allocator()->Free(chunk); | 6649 isolate_->memory_allocator()->Free(chunk); |
6637 } | 6650 } |
6638 chunks_queued_for_free_ = NULL; | 6651 chunks_queued_for_free_ = NULL; |
6639 } | 6652 } |
6640 | 6653 |
6641 } } // namespace v8::internal | 6654 } } // namespace v8::internal |
OLD | NEW |