| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 compacting_(false), | 46 compacting_(false), |
| 47 was_marked_incrementally_(false), | 47 was_marked_incrementally_(false), |
| 48 sweeping_in_progress_(false), | 48 sweeping_in_progress_(false), |
| 49 pending_sweeper_jobs_semaphore_(0), | 49 pending_sweeper_jobs_semaphore_(0), |
| 50 evacuation_(false), | 50 evacuation_(false), |
| 51 migration_slots_buffer_(NULL), | 51 migration_slots_buffer_(NULL), |
| 52 heap_(heap), | 52 heap_(heap), |
| 53 marking_deque_memory_(NULL), | 53 marking_deque_memory_(NULL), |
| 54 marking_deque_memory_committed_(false), | 54 marking_deque_memory_committed_(false), |
| 55 code_flusher_(NULL), | 55 code_flusher_(NULL), |
| 56 have_code_to_deoptimize_(false) { | 56 have_code_to_deoptimize_(false), |
| 57 last_mark_compact_time_(0) { |
| 57 } | 58 } |
| 58 | 59 |
| 59 #ifdef VERIFY_HEAP | 60 #ifdef VERIFY_HEAP |
| 60 class VerifyMarkingVisitor : public ObjectVisitor { | 61 class VerifyMarkingVisitor : public ObjectVisitor { |
| 61 public: | 62 public: |
| 62 explicit VerifyMarkingVisitor(Heap* heap) : heap_(heap) {} | 63 explicit VerifyMarkingVisitor(Heap* heap) : heap_(heap) {} |
| 63 | 64 |
| 64 void VisitPointers(Object** start, Object** end) { | 65 void VisitPointers(Object** start, Object** end) { |
| 65 for (Object** current = start; current < end; current++) { | 66 for (Object** current = start; current < end; current++) { |
| 66 if ((*current)->IsHeapObject()) { | 67 if ((*current)->IsHeapObject()) { |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 // objects (empty string, illegal builtin). | 872 // objects (empty string, illegal builtin). |
| 872 isolate()->stub_cache()->Clear(); | 873 isolate()->stub_cache()->Clear(); |
| 873 | 874 |
| 874 if (have_code_to_deoptimize_) { | 875 if (have_code_to_deoptimize_) { |
| 875 // Some code objects were marked for deoptimization during the GC. | 876 // Some code objects were marked for deoptimization during the GC. |
| 876 Deoptimizer::DeoptimizeMarkedCode(isolate()); | 877 Deoptimizer::DeoptimizeMarkedCode(isolate()); |
| 877 have_code_to_deoptimize_ = false; | 878 have_code_to_deoptimize_ = false; |
| 878 } | 879 } |
| 879 | 880 |
| 880 heap_->incremental_marking()->ClearIdleMarkingDelayCounter(); | 881 heap_->incremental_marking()->ClearIdleMarkingDelayCounter(); |
| 882 last_mark_compact_time_ = static_cast<size_t>( |
| 883 V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * |
| 884 static_cast<double>(base::Time::kMillisecondsPerSecond)); |
| 881 } | 885 } |
| 882 | 886 |
| 883 | 887 |
| 884 // ------------------------------------------------------------------------- | 888 // ------------------------------------------------------------------------- |
| 885 // Phase 1: tracing and marking live objects. | 889 // Phase 1: tracing and marking live objects. |
| 886 // before: all objects are in normal state. | 890 // before: all objects are in normal state. |
| 887 // after: a live object's map pointer is marked as '00'. | 891 // after: a live object's map pointer is marked as '00'. |
| 888 | 892 |
| 889 // Marking all live objects in the heap as part of mark-sweep or mark-compact | 893 // Marking all live objects in the heap as part of mark-sweep or mark-compact |
| 890 // collection. Before marking, all objects are in their normal state. After | 894 // collection. Before marking, all objects are in their normal state. After |
| (...skipping 3705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4596 SlotsBuffer* buffer = *buffer_address; | 4600 SlotsBuffer* buffer = *buffer_address; |
| 4597 while (buffer != NULL) { | 4601 while (buffer != NULL) { |
| 4598 SlotsBuffer* next_buffer = buffer->next(); | 4602 SlotsBuffer* next_buffer = buffer->next(); |
| 4599 DeallocateBuffer(buffer); | 4603 DeallocateBuffer(buffer); |
| 4600 buffer = next_buffer; | 4604 buffer = next_buffer; |
| 4601 } | 4605 } |
| 4602 *buffer_address = NULL; | 4606 *buffer_address = NULL; |
| 4603 } | 4607 } |
| 4604 } | 4608 } |
| 4605 } // namespace v8::internal | 4609 } // namespace v8::internal |
| OLD | NEW |