OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 12 matching lines...) Expand all Loading... |
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 "compilation-cache.h" | 30 #include "compilation-cache.h" |
31 #include "execution.h" | 31 #include "execution.h" |
32 #include "heap-profiler.h" | 32 #include "heap-profiler.h" |
| 33 #include "gdb-jit.h" |
33 #include "global-handles.h" | 34 #include "global-handles.h" |
34 #include "ic-inl.h" | 35 #include "ic-inl.h" |
35 #include "mark-compact.h" | 36 #include "mark-compact.h" |
36 #include "objects-visiting.h" | 37 #include "objects-visiting.h" |
37 #include "stub-cache.h" | 38 #include "stub-cache.h" |
38 | 39 |
39 namespace v8 { | 40 namespace v8 { |
40 namespace internal { | 41 namespace internal { |
41 | 42 |
42 // ------------------------------------------------------------------------- | 43 // ------------------------------------------------------------------------- |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 ASSERT(!FLAG_always_compact || !FLAG_never_compact); | 119 ASSERT(!FLAG_always_compact || !FLAG_never_compact); |
119 | 120 |
120 compacting_collection_ = | 121 compacting_collection_ = |
121 FLAG_always_compact || force_compaction_ || compact_on_next_gc_; | 122 FLAG_always_compact || force_compaction_ || compact_on_next_gc_; |
122 compact_on_next_gc_ = false; | 123 compact_on_next_gc_ = false; |
123 | 124 |
124 if (FLAG_never_compact) compacting_collection_ = false; | 125 if (FLAG_never_compact) compacting_collection_ = false; |
125 if (!Heap::map_space()->MapPointersEncodable()) | 126 if (!Heap::map_space()->MapPointersEncodable()) |
126 compacting_collection_ = false; | 127 compacting_collection_ = false; |
127 if (FLAG_collect_maps) CreateBackPointers(); | 128 if (FLAG_collect_maps) CreateBackPointers(); |
| 129 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 130 if (FLAG_gdbjit) { |
| 131 // If GDBJIT interface is active disable compaction. |
| 132 compacting_collection_ = false; |
| 133 } |
| 134 #endif |
128 | 135 |
129 PagedSpaces spaces; | 136 PagedSpaces spaces; |
130 for (PagedSpace* space = spaces.next(); | 137 for (PagedSpace* space = spaces.next(); |
131 space != NULL; space = spaces.next()) { | 138 space != NULL; space = spaces.next()) { |
132 space->PrepareForMarkCompact(compacting_collection_); | 139 space->PrepareForMarkCompact(compacting_collection_); |
133 } | 140 } |
134 | 141 |
135 #ifdef DEBUG | 142 #ifdef DEBUG |
136 live_bytes_ = 0; | 143 live_bytes_ = 0; |
137 live_young_objects_size_ = 0; | 144 live_young_objects_size_ = 0; |
(...skipping 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2899 PROFILE(FunctionMoveEvent(old_addr, new_addr)); | 2906 PROFILE(FunctionMoveEvent(old_addr, new_addr)); |
2900 PROFILE(FunctionCreateEventFromMove(JSFunction::cast(copied_to))); | 2907 PROFILE(FunctionCreateEventFromMove(JSFunction::cast(copied_to))); |
2901 } | 2908 } |
2902 HEAP_PROFILE(ObjectMoveEvent(old_addr, new_addr)); | 2909 HEAP_PROFILE(ObjectMoveEvent(old_addr, new_addr)); |
2903 | 2910 |
2904 return obj_size; | 2911 return obj_size; |
2905 } | 2912 } |
2906 | 2913 |
2907 | 2914 |
2908 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) { | 2915 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) { |
| 2916 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 2917 if (obj->IsCode()) { |
| 2918 GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj)); |
| 2919 } |
| 2920 #endif |
2909 #ifdef ENABLE_LOGGING_AND_PROFILING | 2921 #ifdef ENABLE_LOGGING_AND_PROFILING |
2910 if (obj->IsCode()) { | 2922 if (obj->IsCode()) { |
2911 PROFILE(CodeDeleteEvent(obj->address())); | 2923 PROFILE(CodeDeleteEvent(obj->address())); |
2912 } else if (obj->IsJSFunction()) { | 2924 } else if (obj->IsJSFunction()) { |
2913 PROFILE(FunctionDeleteEvent(obj->address())); | 2925 PROFILE(FunctionDeleteEvent(obj->address())); |
2914 } | 2926 } |
2915 #endif | 2927 #endif |
2916 } | 2928 } |
2917 | 2929 |
2918 | 2930 |
2919 int MarkCompactCollector::SizeOfMarkedObject(HeapObject* obj) { | 2931 int MarkCompactCollector::SizeOfMarkedObject(HeapObject* obj) { |
2920 MapWord map_word = obj->map_word(); | 2932 MapWord map_word = obj->map_word(); |
2921 map_word.ClearMark(); | 2933 map_word.ClearMark(); |
2922 return obj->SizeFromMap(map_word.ToMap()); | 2934 return obj->SizeFromMap(map_word.ToMap()); |
2923 } | 2935 } |
2924 | 2936 |
2925 | 2937 |
2926 void MarkCompactCollector::Initialize() { | 2938 void MarkCompactCollector::Initialize() { |
2927 StaticPointersToNewGenUpdatingVisitor::Initialize(); | 2939 StaticPointersToNewGenUpdatingVisitor::Initialize(); |
2928 StaticMarkingVisitor::Initialize(); | 2940 StaticMarkingVisitor::Initialize(); |
2929 } | 2941 } |
2930 | 2942 |
2931 | 2943 |
2932 } } // namespace v8::internal | 2944 } } // namespace v8::internal |
OLD | NEW |