| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
| (...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2087 | 2087 |
| 2088 | 2088 |
| 2089 // Mark all objects reachable (transitively) from objects on the marking | 2089 // Mark all objects reachable (transitively) from objects on the marking |
| 2090 // stack including references only considered in the atomic marking pause. | 2090 // stack including references only considered in the atomic marking pause. |
| 2091 void MarkCompactCollector::ProcessEphemeralMarking( | 2091 void MarkCompactCollector::ProcessEphemeralMarking( |
| 2092 ObjectVisitor* visitor, bool only_process_harmony_weak_collections) { | 2092 ObjectVisitor* visitor, bool only_process_harmony_weak_collections) { |
| 2093 bool work_to_do = true; | 2093 bool work_to_do = true; |
| 2094 DCHECK(marking_deque_.IsEmpty() && !marking_deque_.overflowed()); | 2094 DCHECK(marking_deque_.IsEmpty() && !marking_deque_.overflowed()); |
| 2095 while (work_to_do) { | 2095 while (work_to_do) { |
| 2096 if (!only_process_harmony_weak_collections) { | 2096 if (!only_process_harmony_weak_collections) { |
| 2097 #ifdef TRACE_RETAINING_PATH |
| 2098 heap()->SetCurrentRootRetainer(std::string("[weak global handles]")); |
| 2099 #endif |
| 2097 isolate()->global_handles()->IterateObjectGroups( | 2100 isolate()->global_handles()->IterateObjectGroups( |
| 2098 visitor, &IsUnmarkedHeapObjectWithHeap); | 2101 visitor, &IsUnmarkedHeapObjectWithHeap); |
| 2099 MarkImplicitRefGroups(); | 2102 MarkImplicitRefGroups(); |
| 2100 } | 2103 } |
| 2104 #ifdef TRACE_RETAINING_PATH |
| 2105 heap()->SetCurrentRootRetainer(std::string("[weak harmony collections]")); |
| 2106 #endif |
| 2101 ProcessWeakCollections(); | 2107 ProcessWeakCollections(); |
| 2102 work_to_do = !marking_deque_.IsEmpty(); | 2108 work_to_do = !marking_deque_.IsEmpty(); |
| 2103 ProcessMarkingDeque(); | 2109 ProcessMarkingDeque(); |
| 2104 } | 2110 } |
| 2105 } | 2111 } |
| 2106 | 2112 |
| 2107 | 2113 |
| 2108 void MarkCompactCollector::ProcessTopOptimizedFrame(ObjectVisitor* visitor) { | 2114 void MarkCompactCollector::ProcessTopOptimizedFrame(ObjectVisitor* visitor) { |
| 2115 #ifdef TRACE_RETAINING_PATH |
| 2116 heap()->SetCurrentRootRetainer(std::string("[top optimized frame]")); |
| 2117 #endif |
| 2109 for (StackFrameIterator it(isolate(), isolate()->thread_local_top()); | 2118 for (StackFrameIterator it(isolate(), isolate()->thread_local_top()); |
| 2110 !it.done(); it.Advance()) { | 2119 !it.done(); it.Advance()) { |
| 2111 if (it.frame()->type() == StackFrame::JAVA_SCRIPT) { | 2120 if (it.frame()->type() == StackFrame::JAVA_SCRIPT) { |
| 2112 return; | 2121 return; |
| 2113 } | 2122 } |
| 2114 if (it.frame()->type() == StackFrame::OPTIMIZED) { | 2123 if (it.frame()->type() == StackFrame::OPTIMIZED) { |
| 2115 Code* code = it.frame()->LookupCode(); | 2124 Code* code = it.frame()->LookupCode(); |
| 2116 if (!code->CanDeoptAt(it.frame()->pc())) { | 2125 if (!code->CanDeoptAt(it.frame()->pc())) { |
| 2117 code->CodeIterateBody(visitor); | 2126 code->CodeIterateBody(visitor); |
| 2118 } | 2127 } |
| (...skipping 2286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4405 | 4414 |
| 4406 void SlotsBufferAllocator::DeallocateChain(SlotsBuffer** buffer_address) { | 4415 void SlotsBufferAllocator::DeallocateChain(SlotsBuffer** buffer_address) { |
| 4407 SlotsBuffer* buffer = *buffer_address; | 4416 SlotsBuffer* buffer = *buffer_address; |
| 4408 while (buffer != NULL) { | 4417 while (buffer != NULL) { |
| 4409 SlotsBuffer* next_buffer = buffer->next(); | 4418 SlotsBuffer* next_buffer = buffer->next(); |
| 4410 DeallocateBuffer(buffer); | 4419 DeallocateBuffer(buffer); |
| 4411 buffer = next_buffer; | 4420 buffer = next_buffer; |
| 4412 } | 4421 } |
| 4413 *buffer_address = NULL; | 4422 *buffer_address = NULL; |
| 4414 } | 4423 } |
| 4424 |
| 4425 |
| 4426 #ifdef TRACE_RETAINING_PATH |
| 4427 void MarkingDeque::AddRetainedObject(HeapObject* obj) { |
| 4428 obj->GetHeap()->AddRetainedObject(obj); |
| 4429 } |
| 4430 #endif |
| 4415 } | 4431 } |
| 4416 } // namespace v8::internal | 4432 } // namespace v8::internal |
| OLD | NEW |