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 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 Context::NEXT_CONTEXT_LINK, | 1346 Context::NEXT_CONTEXT_LINK, |
1347 Heap::undefined_value(), | 1347 Heap::undefined_value(), |
1348 UPDATE_WRITE_BARRIER); | 1348 UPDATE_WRITE_BARRIER); |
1349 } | 1349 } |
1350 | 1350 |
1351 // Update the head of the list of contexts. | 1351 // Update the head of the list of contexts. |
1352 global_contexts_list_ = head; | 1352 global_contexts_list_ = head; |
1353 } | 1353 } |
1354 | 1354 |
1355 | 1355 |
| 1356 void Heap::VisitExternalResources(v8::ExternalResourceVisitor* visitor) { |
| 1357 AssertNoAllocation no_allocation; |
| 1358 |
| 1359 class VisitorAdapter : public ObjectVisitor { |
| 1360 public: |
| 1361 explicit VisitorAdapter(v8::ExternalResourceVisitor* visitor) |
| 1362 : visitor_(visitor) {} |
| 1363 virtual void VisitPointers(Object** start, Object** end) { |
| 1364 for (Object** p = start; p < end; p++) { |
| 1365 if ((*p)->IsExternalString()) { |
| 1366 visitor_->VisitExternalString(Utils::ToLocal( |
| 1367 Handle<String>(String::cast(*p)))); |
| 1368 } |
| 1369 } |
| 1370 } |
| 1371 private: |
| 1372 v8::ExternalResourceVisitor* visitor_; |
| 1373 } visitor_adapter(visitor); |
| 1374 external_string_table_.Iterate(&visitor_adapter); |
| 1375 } |
| 1376 |
| 1377 |
1356 class NewSpaceScavenger : public StaticNewSpaceVisitor<NewSpaceScavenger> { | 1378 class NewSpaceScavenger : public StaticNewSpaceVisitor<NewSpaceScavenger> { |
1357 public: | 1379 public: |
1358 static inline void VisitPointer(Heap* heap, Object** p) { | 1380 static inline void VisitPointer(Heap* heap, Object** p) { |
1359 Object* object = *p; | 1381 Object* object = *p; |
1360 if (!heap->InNewSpace(object)) return; | 1382 if (!heap->InNewSpace(object)) return; |
1361 Heap::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 1383 Heap::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
1362 reinterpret_cast<HeapObject*>(object)); | 1384 reinterpret_cast<HeapObject*>(object)); |
1363 } | 1385 } |
1364 }; | 1386 }; |
1365 | 1387 |
(...skipping 5160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6526 isolate_->heap()->store_buffer()->Compact(); | 6548 isolate_->heap()->store_buffer()->Compact(); |
6527 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6549 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6528 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6550 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6529 next = chunk->next_chunk(); | 6551 next = chunk->next_chunk(); |
6530 isolate_->memory_allocator()->Free(chunk); | 6552 isolate_->memory_allocator()->Free(chunk); |
6531 } | 6553 } |
6532 chunks_queued_for_free_ = NULL; | 6554 chunks_queued_for_free_ = NULL; |
6533 } | 6555 } |
6534 | 6556 |
6535 } } // namespace v8::internal | 6557 } } // namespace v8::internal |
OLD | NEW |