OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
15 // | 15 // |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "code-events.h" | |
30 #include "code-stubs.h" | 31 #include "code-stubs.h" |
31 #include "compilation-cache.h" | 32 #include "compilation-cache.h" |
32 #include "deoptimizer.h" | 33 #include "deoptimizer.h" |
33 #include "execution.h" | 34 #include "execution.h" |
34 #include "gdb-jit.h" | |
35 #include "global-handles.h" | 35 #include "global-handles.h" |
36 #include "heap-profiler.h" | 36 #include "heap-profiler.h" |
37 #include "ic-inl.h" | 37 #include "ic-inl.h" |
38 #include "incremental-marking.h" | 38 #include "incremental-marking.h" |
39 #include "liveobjectlist-inl.h" | 39 #include "liveobjectlist-inl.h" |
40 #include "mark-compact.h" | 40 #include "mark-compact.h" |
41 #include "objects-visiting.h" | 41 #include "objects-visiting.h" |
42 #include "objects-visiting-inl.h" | 42 #include "objects-visiting-inl.h" |
43 #include "stub-cache.h" | 43 #include "stub-cache.h" |
44 | 44 |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
682 #ifdef DEBUG | 682 #ifdef DEBUG |
683 ASSERT(state_ == IDLE); | 683 ASSERT(state_ == IDLE); |
684 state_ = PREPARE_GC; | 684 state_ = PREPARE_GC; |
685 #endif | 685 #endif |
686 | 686 |
687 ASSERT(!FLAG_never_compact || !FLAG_always_compact); | 687 ASSERT(!FLAG_never_compact || !FLAG_always_compact); |
688 | 688 |
689 #ifdef ENABLE_GDB_JIT_INTERFACE | 689 #ifdef ENABLE_GDB_JIT_INTERFACE |
690 if (FLAG_gdbjit) { | 690 if (FLAG_gdbjit) { |
691 // If GDBJIT interface is active disable compaction. | 691 // If GDBJIT interface is active disable compaction. |
692 compacting_collection_ = false; | 692 // DO NOT SUBMIT. |
danno
2012/07/25 13:50:42
Is this left-over debug code?
Sigurður Ásgeirsson
2012/07/25 14:38:35
This and the other crud was my initial attempt at
| |
693 FLAG_never_compact = true; | |
693 } | 694 } |
694 #endif | 695 #endif |
695 | 696 |
696 // Clear marking bits if incremental marking is aborted. | 697 // Clear marking bits if incremental marking is aborted. |
697 if (was_marked_incrementally_ && abort_incremental_marking_) { | 698 if (was_marked_incrementally_ && abort_incremental_marking_) { |
698 heap()->incremental_marking()->Abort(); | 699 heap()->incremental_marking()->Abort(); |
699 ClearMarkbits(); | 700 ClearMarkbits(); |
700 AbortCompaction(); | 701 AbortCompaction(); |
701 was_marked_incrementally_ = false; | 702 was_marked_incrementally_ = false; |
702 } | 703 } |
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2815 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { | 2816 if (Page::FromAddress(code_entry)->IsEvacuationCandidate()) { |
2816 SlotsBuffer::AddTo(&slots_buffer_allocator_, | 2817 SlotsBuffer::AddTo(&slots_buffer_allocator_, |
2817 &migration_slots_buffer_, | 2818 &migration_slots_buffer_, |
2818 SlotsBuffer::CODE_ENTRY_SLOT, | 2819 SlotsBuffer::CODE_ENTRY_SLOT, |
2819 code_entry_slot, | 2820 code_entry_slot, |
2820 SlotsBuffer::IGNORE_OVERFLOW); | 2821 SlotsBuffer::IGNORE_OVERFLOW); |
2821 } | 2822 } |
2822 } | 2823 } |
2823 } else if (dest == CODE_SPACE) { | 2824 } else if (dest == CODE_SPACE) { |
2824 PROFILE(heap()->isolate(), CodeMoveEvent(src, dst)); | 2825 PROFILE(heap()->isolate(), CodeMoveEvent(src, dst)); |
2826 JIT_CODE_EVENT(MoveCode(src, dst)); | |
2825 heap()->MoveBlock(dst, src, size); | 2827 heap()->MoveBlock(dst, src, size); |
2826 SlotsBuffer::AddTo(&slots_buffer_allocator_, | 2828 SlotsBuffer::AddTo(&slots_buffer_allocator_, |
2827 &migration_slots_buffer_, | 2829 &migration_slots_buffer_, |
2828 SlotsBuffer::RELOCATED_CODE_OBJECT, | 2830 SlotsBuffer::RELOCATED_CODE_OBJECT, |
2829 dst, | 2831 dst, |
2830 SlotsBuffer::IGNORE_OVERFLOW); | 2832 SlotsBuffer::IGNORE_OVERFLOW); |
2831 Code::cast(HeapObject::FromAddress(dst))->Relocate(dst - src); | 2833 Code::cast(HeapObject::FromAddress(dst))->Relocate(dst - src); |
2832 } else { | 2834 } else { |
2833 ASSERT(dest == OLD_DATA_SPACE || dest == NEW_SPACE); | 2835 ASSERT(dest == OLD_DATA_SPACE || dest == NEW_SPACE); |
2834 heap()->MoveBlock(dst, src, size); | 2836 heap()->MoveBlock(dst, src, size); |
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4122 code_flusher_ = NULL; | 4124 code_flusher_ = NULL; |
4123 } | 4125 } |
4124 } | 4126 } |
4125 | 4127 |
4126 | 4128 |
4127 // TODO(1466) ReportDeleteIfNeeded is not called currently. | 4129 // TODO(1466) ReportDeleteIfNeeded is not called currently. |
4128 // Our profiling tools do not expect intersections between | 4130 // Our profiling tools do not expect intersections between |
4129 // code objects. We should either reenable it or change our tools. | 4131 // code objects. We should either reenable it or change our tools. |
4130 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj, | 4132 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj, |
4131 Isolate* isolate) { | 4133 Isolate* isolate) { |
4132 #ifdef ENABLE_GDB_JIT_INTERFACE | |
4133 if (obj->IsCode()) { | |
4134 GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj)); | |
4135 } | |
4136 #endif | |
4137 if (obj->IsCode()) { | 4134 if (obj->IsCode()) { |
4138 PROFILE(isolate, CodeDeleteEvent(obj->address())); | 4135 PROFILE(isolate, CodeDeleteEvent(obj->address())); |
4136 JIT_CODE_EVENT(RemoveCode(reinterpret_cast<Code*>(obj))); | |
4139 } | 4137 } |
4140 } | 4138 } |
4141 | 4139 |
4142 | 4140 |
4143 void MarkCompactCollector::Initialize() { | 4141 void MarkCompactCollector::Initialize() { |
4144 StaticMarkingVisitor::Initialize(); | 4142 StaticMarkingVisitor::Initialize(); |
4145 } | 4143 } |
4146 | 4144 |
4147 | 4145 |
4148 bool SlotsBuffer::IsTypedSlot(ObjectSlot slot) { | 4146 bool SlotsBuffer::IsTypedSlot(ObjectSlot slot) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4279 while (buffer != NULL) { | 4277 while (buffer != NULL) { |
4280 SlotsBuffer* next_buffer = buffer->next(); | 4278 SlotsBuffer* next_buffer = buffer->next(); |
4281 DeallocateBuffer(buffer); | 4279 DeallocateBuffer(buffer); |
4282 buffer = next_buffer; | 4280 buffer = next_buffer; |
4283 } | 4281 } |
4284 *buffer_address = NULL; | 4282 *buffer_address = NULL; |
4285 } | 4283 } |
4286 | 4284 |
4287 | 4285 |
4288 } } // namespace v8::internal | 4286 } } // namespace v8::internal |
OLD | NEW |