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 10 matching lines...) Expand all Loading... |
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 "execution.h" | 30 #include "execution.h" |
| 31 #include "heap-profiler.h" |
31 #include "global-handles.h" | 32 #include "global-handles.h" |
32 #include "ic-inl.h" | 33 #include "ic-inl.h" |
33 #include "mark-compact.h" | 34 #include "mark-compact.h" |
34 #include "stub-cache.h" | 35 #include "stub-cache.h" |
35 | 36 |
36 namespace v8 { | 37 namespace v8 { |
37 namespace internal { | 38 namespace internal { |
38 | 39 |
39 // ------------------------------------------------------------------------- | 40 // ------------------------------------------------------------------------- |
40 // MarkCompactCollector | 41 // MarkCompactCollector |
(...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2211 obj_size); | 2212 obj_size); |
2212 } | 2213 } |
2213 } | 2214 } |
2214 | 2215 |
2215 ASSERT(!HeapObject::FromAddress(new_addr)->IsCode()); | 2216 ASSERT(!HeapObject::FromAddress(new_addr)->IsCode()); |
2216 | 2217 |
2217 HeapObject* copied_to = HeapObject::FromAddress(new_addr); | 2218 HeapObject* copied_to = HeapObject::FromAddress(new_addr); |
2218 if (copied_to->IsJSFunction()) { | 2219 if (copied_to->IsJSFunction()) { |
2219 PROFILE(FunctionMoveEvent(old_addr, new_addr)); | 2220 PROFILE(FunctionMoveEvent(old_addr, new_addr)); |
2220 } | 2221 } |
| 2222 HEAP_PROFILE(ObjectMoveEvent(old_addr, new_addr)); |
2221 | 2223 |
2222 return obj_size; | 2224 return obj_size; |
2223 } | 2225 } |
2224 | 2226 |
2225 | 2227 |
2226 int MarkCompactCollector::RelocateOldPointerObject(HeapObject* obj) { | 2228 int MarkCompactCollector::RelocateOldPointerObject(HeapObject* obj) { |
2227 return RelocateOldNonCodeObject(obj, Heap::old_pointer_space()); | 2229 return RelocateOldNonCodeObject(obj, Heap::old_pointer_space()); |
2228 } | 2230 } |
2229 | 2231 |
2230 | 2232 |
(...skipping 26 matching lines...) Expand all Loading... |
2257 Heap::MoveBlock(new_addr, old_addr, obj_size); | 2259 Heap::MoveBlock(new_addr, old_addr, obj_size); |
2258 } | 2260 } |
2259 | 2261 |
2260 HeapObject* copied_to = HeapObject::FromAddress(new_addr); | 2262 HeapObject* copied_to = HeapObject::FromAddress(new_addr); |
2261 if (copied_to->IsCode()) { | 2263 if (copied_to->IsCode()) { |
2262 // May also update inline cache target. | 2264 // May also update inline cache target. |
2263 Code::cast(copied_to)->Relocate(new_addr - old_addr); | 2265 Code::cast(copied_to)->Relocate(new_addr - old_addr); |
2264 // Notify the logger that compiled code has moved. | 2266 // Notify the logger that compiled code has moved. |
2265 PROFILE(CodeMoveEvent(old_addr, new_addr)); | 2267 PROFILE(CodeMoveEvent(old_addr, new_addr)); |
2266 } | 2268 } |
| 2269 HEAP_PROFILE(ObjectMoveEvent(old_addr, new_addr)); |
2267 | 2270 |
2268 return obj_size; | 2271 return obj_size; |
2269 } | 2272 } |
2270 | 2273 |
2271 | 2274 |
2272 int MarkCompactCollector::RelocateNewObject(HeapObject* obj) { | 2275 int MarkCompactCollector::RelocateNewObject(HeapObject* obj) { |
2273 int obj_size = obj->Size(); | 2276 int obj_size = obj->Size(); |
2274 | 2277 |
2275 // Get forwarding address | 2278 // Get forwarding address |
2276 Address old_addr = obj->address(); | 2279 Address old_addr = obj->address(); |
(...skipping 24 matching lines...) Expand all Loading... |
2301 #ifdef DEBUG | 2304 #ifdef DEBUG |
2302 if (FLAG_gc_verbose) { | 2305 if (FLAG_gc_verbose) { |
2303 PrintF("relocate %p -> %p\n", old_addr, new_addr); | 2306 PrintF("relocate %p -> %p\n", old_addr, new_addr); |
2304 } | 2307 } |
2305 #endif | 2308 #endif |
2306 | 2309 |
2307 HeapObject* copied_to = HeapObject::FromAddress(new_addr); | 2310 HeapObject* copied_to = HeapObject::FromAddress(new_addr); |
2308 if (copied_to->IsJSFunction()) { | 2311 if (copied_to->IsJSFunction()) { |
2309 PROFILE(FunctionMoveEvent(old_addr, new_addr)); | 2312 PROFILE(FunctionMoveEvent(old_addr, new_addr)); |
2310 } | 2313 } |
| 2314 HEAP_PROFILE(ObjectMoveEvent(old_addr, new_addr)); |
2311 | 2315 |
2312 return obj_size; | 2316 return obj_size; |
2313 } | 2317 } |
2314 | 2318 |
2315 | 2319 |
2316 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) { | 2320 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) { |
2317 #ifdef ENABLE_LOGGING_AND_PROFILING | 2321 #ifdef ENABLE_LOGGING_AND_PROFILING |
2318 if (obj->IsCode()) { | 2322 if (obj->IsCode()) { |
2319 PROFILE(CodeDeleteEvent(obj->address())); | 2323 PROFILE(CodeDeleteEvent(obj->address())); |
2320 } else if (obj->IsJSFunction()) { | 2324 } else if (obj->IsJSFunction()) { |
2321 PROFILE(FunctionDeleteEvent(obj->address())); | 2325 PROFILE(FunctionDeleteEvent(obj->address())); |
2322 } | 2326 } |
2323 #endif | 2327 #endif |
2324 } | 2328 } |
2325 | 2329 |
2326 } } // namespace v8::internal | 2330 } } // namespace v8::internal |
OLD | NEW |