| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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/heap/objects-visiting.h" | 7 #include "src/heap/objects-visiting.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 static int WeakNextOffset() { | 297 static int WeakNextOffset() { |
| 298 return FixedArray::SizeFor(Context::NEXT_CONTEXT_LINK); | 298 return FixedArray::SizeFor(Context::NEXT_CONTEXT_LINK); |
| 299 } | 299 } |
| 300 | 300 |
| 301 static void VisitLiveObject(Heap* heap, Context* context, | 301 static void VisitLiveObject(Heap* heap, Context* context, |
| 302 WeakObjectRetainer* retainer) { | 302 WeakObjectRetainer* retainer) { |
| 303 // Process the three weak lists linked off the context. | 303 // Process the three weak lists linked off the context. |
| 304 DoWeakList<JSFunction>(heap, context, retainer, | 304 DoWeakList<JSFunction>(heap, context, retainer, |
| 305 Context::OPTIMIZED_FUNCTIONS_LIST); | 305 Context::OPTIMIZED_FUNCTIONS_LIST); |
| 306 DoWeakList<Code>(heap, context, retainer, Context::OPTIMIZED_CODE_LIST); | 306 |
| 307 DoWeakList<Code>(heap, context, retainer, Context::DEOPTIMIZED_CODE_LIST); | 307 // Code objects are always allocated in Code space, we do not have to visit |
| 308 // them during scavenges. |
| 309 if (heap->gc_state() == Heap::MARK_COMPACT) { |
| 310 DoWeakList<Code>(heap, context, retainer, Context::OPTIMIZED_CODE_LIST); |
| 311 DoWeakList<Code>(heap, context, retainer, Context::DEOPTIMIZED_CODE_LIST); |
| 312 } |
| 308 } | 313 } |
| 309 | 314 |
| 310 template <class T> | 315 template <class T> |
| 311 static void DoWeakList(Heap* heap, Context* context, | 316 static void DoWeakList(Heap* heap, Context* context, |
| 312 WeakObjectRetainer* retainer, int index) { | 317 WeakObjectRetainer* retainer, int index) { |
| 313 // Visit the weak list, removing dead intermediate elements. | 318 // Visit the weak list, removing dead intermediate elements. |
| 314 Object* list_head = VisitWeakList<T>(heap, context->get(index), retainer); | 319 Object* list_head = VisitWeakList<T>(heap, context->get(index), retainer); |
| 315 | 320 |
| 316 // Update the list head. | 321 // Update the list head. |
| 317 context->set(index, list_head, UPDATE_WRITE_BARRIER); | 322 context->set(index, list_head, UPDATE_WRITE_BARRIER); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 412 |
| 408 | 413 |
| 409 template Object* VisitWeakList<JSArrayBuffer>(Heap* heap, Object* list, | 414 template Object* VisitWeakList<JSArrayBuffer>(Heap* heap, Object* list, |
| 410 WeakObjectRetainer* retainer); | 415 WeakObjectRetainer* retainer); |
| 411 | 416 |
| 412 | 417 |
| 413 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, | 418 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, |
| 414 WeakObjectRetainer* retainer); | 419 WeakObjectRetainer* retainer); |
| 415 } | 420 } |
| 416 } // namespace v8::internal | 421 } // namespace v8::internal |
| OLD | NEW |