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 AssertNoAllocation no_allocation; |
| 1359 |
| 1360 class VisitorAdapter : public ObjectVisitor { |
| 1361 public: |
| 1362 explicit VisitorAdapter(v8::ExternalResourceVisitor* visitor) |
| 1363 : visitor_(visitor) {} |
| 1364 virtual void VisitPointers(Object** start, Object** end) { |
| 1365 for (Object** p = start; p < end; p++) { |
| 1366 if ((*p)->IsExternalString()) { |
| 1367 visitor_->VisitExternalString(Utils::ToLocal( |
| 1368 Handle<String>(String::cast(*p)))); |
| 1369 } |
| 1370 } |
| 1371 } |
| 1372 private: |
| 1373 v8::ExternalResourceVisitor* visitor_; |
| 1374 } visitor_adapter(visitor); |
| 1375 external_string_table_.Iterate(&visitor_adapter); |
| 1376 } |
| 1377 |
| 1378 |
1357 class NewSpaceScavenger : public StaticNewSpaceVisitor<NewSpaceScavenger> { | 1379 class NewSpaceScavenger : public StaticNewSpaceVisitor<NewSpaceScavenger> { |
1358 public: | 1380 public: |
1359 static inline void VisitPointer(Heap* heap, Object** p) { | 1381 static inline void VisitPointer(Heap* heap, Object** p) { |
1360 Object* object = *p; | 1382 Object* object = *p; |
1361 if (!heap->InNewSpace(object)) return; | 1383 if (!heap->InNewSpace(object)) return; |
1362 Heap::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 1384 Heap::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
1363 reinterpret_cast<HeapObject*>(object)); | 1385 reinterpret_cast<HeapObject*>(object)); |
1364 } | 1386 } |
1365 }; | 1387 }; |
1366 | 1388 |
(...skipping 5265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6632 isolate_->heap()->store_buffer()->Compact(); | 6654 isolate_->heap()->store_buffer()->Compact(); |
6633 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6655 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6634 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6656 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6635 next = chunk->next_chunk(); | 6657 next = chunk->next_chunk(); |
6636 isolate_->memory_allocator()->Free(chunk); | 6658 isolate_->memory_allocator()->Free(chunk); |
6637 } | 6659 } |
6638 chunks_queued_for_free_ = NULL; | 6660 chunks_queued_for_free_ = NULL; |
6639 } | 6661 } |
6640 | 6662 |
6641 } } // namespace v8::internal | 6663 } } // namespace v8::internal |
OLD | NEW |