| 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 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2812 } else { | 2812 } else { |
| 2813 Heap::MoveBlockToOldSpaceAndUpdateRegionMarks(new_addr, | 2813 Heap::MoveBlockToOldSpaceAndUpdateRegionMarks(new_addr, |
| 2814 old_addr, | 2814 old_addr, |
| 2815 obj_size); | 2815 obj_size); |
| 2816 } | 2816 } |
| 2817 } | 2817 } |
| 2818 | 2818 |
| 2819 ASSERT(!HeapObject::FromAddress(new_addr)->IsCode()); | 2819 ASSERT(!HeapObject::FromAddress(new_addr)->IsCode()); |
| 2820 | 2820 |
| 2821 HeapObject* copied_to = HeapObject::FromAddress(new_addr); | 2821 HeapObject* copied_to = HeapObject::FromAddress(new_addr); |
| 2822 if (copied_to->IsJSFunction()) { | 2822 if (copied_to->IsSharedFunctionInfo()) { |
| 2823 PROFILE(FunctionMoveEvent(old_addr, new_addr)); | 2823 PROFILE(SFIMoveEvent(old_addr, new_addr)); |
| 2824 PROFILE(FunctionCreateEventFromMove(JSFunction::cast(copied_to))); | |
| 2825 } | 2824 } |
| 2826 HEAP_PROFILE(ObjectMoveEvent(old_addr, new_addr)); | 2825 HEAP_PROFILE(ObjectMoveEvent(old_addr, new_addr)); |
| 2827 | 2826 |
| 2828 return obj_size; | 2827 return obj_size; |
| 2829 } | 2828 } |
| 2830 | 2829 |
| 2831 | 2830 |
| 2832 int MarkCompactCollector::RelocateOldPointerObject(HeapObject* obj) { | 2831 int MarkCompactCollector::RelocateOldPointerObject(HeapObject* obj) { |
| 2833 return RelocateOldNonCodeObject(obj, Heap::old_pointer_space()); | 2832 return RelocateOldNonCodeObject(obj, Heap::old_pointer_space()); |
| 2834 } | 2833 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2905 obj_size); | 2904 obj_size); |
| 2906 } | 2905 } |
| 2907 | 2906 |
| 2908 #ifdef DEBUG | 2907 #ifdef DEBUG |
| 2909 if (FLAG_gc_verbose) { | 2908 if (FLAG_gc_verbose) { |
| 2910 PrintF("relocate %p -> %p\n", old_addr, new_addr); | 2909 PrintF("relocate %p -> %p\n", old_addr, new_addr); |
| 2911 } | 2910 } |
| 2912 #endif | 2911 #endif |
| 2913 | 2912 |
| 2914 HeapObject* copied_to = HeapObject::FromAddress(new_addr); | 2913 HeapObject* copied_to = HeapObject::FromAddress(new_addr); |
| 2915 if (copied_to->IsJSFunction()) { | 2914 if (copied_to->IsSharedFunctionInfo()) { |
| 2916 PROFILE(FunctionMoveEvent(old_addr, new_addr)); | 2915 PROFILE(SFIMoveEvent(old_addr, new_addr)); |
| 2917 PROFILE(FunctionCreateEventFromMove(JSFunction::cast(copied_to))); | |
| 2918 } | 2916 } |
| 2919 HEAP_PROFILE(ObjectMoveEvent(old_addr, new_addr)); | 2917 HEAP_PROFILE(ObjectMoveEvent(old_addr, new_addr)); |
| 2920 | 2918 |
| 2921 return obj_size; | 2919 return obj_size; |
| 2922 } | 2920 } |
| 2923 | 2921 |
| 2924 | 2922 |
| 2925 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) { | 2923 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) { |
| 2926 #ifdef ENABLE_GDB_JIT_INTERFACE | 2924 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 2927 if (obj->IsCode()) { | 2925 if (obj->IsCode()) { |
| 2928 GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj)); | 2926 GDBJITInterface::RemoveCode(reinterpret_cast<Code*>(obj)); |
| 2929 } | 2927 } |
| 2930 #endif | 2928 #endif |
| 2931 #ifdef ENABLE_LOGGING_AND_PROFILING | 2929 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 2932 if (obj->IsCode()) { | 2930 if (obj->IsCode()) { |
| 2933 PROFILE(CodeDeleteEvent(obj->address())); | 2931 PROFILE(CodeDeleteEvent(obj->address())); |
| 2934 } else if (obj->IsJSFunction()) { | |
| 2935 PROFILE(FunctionDeleteEvent(obj->address())); | |
| 2936 } | 2932 } |
| 2937 #endif | 2933 #endif |
| 2938 } | 2934 } |
| 2939 | 2935 |
| 2940 | 2936 |
| 2941 int MarkCompactCollector::SizeOfMarkedObject(HeapObject* obj) { | 2937 int MarkCompactCollector::SizeOfMarkedObject(HeapObject* obj) { |
| 2942 MapWord map_word = obj->map_word(); | 2938 MapWord map_word = obj->map_word(); |
| 2943 map_word.ClearMark(); | 2939 map_word.ClearMark(); |
| 2944 return obj->SizeFromMap(map_word.ToMap()); | 2940 return obj->SizeFromMap(map_word.ToMap()); |
| 2945 } | 2941 } |
| 2946 | 2942 |
| 2947 | 2943 |
| 2948 void MarkCompactCollector::Initialize() { | 2944 void MarkCompactCollector::Initialize() { |
| 2949 StaticPointersToNewGenUpdatingVisitor::Initialize(); | 2945 StaticPointersToNewGenUpdatingVisitor::Initialize(); |
| 2950 StaticMarkingVisitor::Initialize(); | 2946 StaticMarkingVisitor::Initialize(); |
| 2951 } | 2947 } |
| 2952 | 2948 |
| 2953 | 2949 |
| 2954 } } // namespace v8::internal | 2950 } } // namespace v8::internal |
| OLD | NEW |