Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1265)

Side by Side Diff: src/mark-compact.cc

Issue 546089: Fix issue 553: function frame is skipped in profile when compare stub is called. (Closed)
Patch Set: Introduced dedicated log event types, added stuff for DevTools Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mark-compact.h ('k') | src/platform.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 old_object->set_map_word(encoding); 962 old_object->set_map_word(encoding);
963 *offset += object_size; 963 *offset += object_size;
964 ASSERT(*offset <= Page::kObjectAreaSize); 964 ASSERT(*offset <= Page::kObjectAreaSize);
965 } 965 }
966 966
967 967
968 // Most non-live objects are ignored. 968 // Most non-live objects are ignored.
969 inline void IgnoreNonLiveObject(HeapObject* object) {} 969 inline void IgnoreNonLiveObject(HeapObject* object) {}
970 970
971 971
972 // A code deletion event is logged for non-live code objects.
973 inline void LogNonLiveCodeObject(HeapObject* object) {
974 if (object->IsCode()) LOG(CodeDeleteEvent(object->address()));
975 }
976
977
978 // Function template that, given a range of addresses (eg, a semispace or a 972 // Function template that, given a range of addresses (eg, a semispace or a
979 // paged space page), iterates through the objects in the range to clear 973 // paged space page), iterates through the objects in the range to clear
980 // mark bits and compute and encode forwarding addresses. As a side effect, 974 // mark bits and compute and encode forwarding addresses. As a side effect,
981 // maximal free chunks are marked so that they can be skipped on subsequent 975 // maximal free chunks are marked so that they can be skipped on subsequent
982 // sweeps. 976 // sweeps.
983 // 977 //
984 // The template parameters are an allocation function, a forwarding address 978 // The template parameters are an allocation function, a forwarding address
985 // encoding function, and a function to process non-live objects. 979 // encoding function, and a function to process non-live objects.
986 template<MarkCompactCollector::AllocationFunction Alloc, 980 template<MarkCompactCollector::AllocationFunction Alloc,
987 MarkCompactCollector::EncodingFunction Encode, 981 MarkCompactCollector::EncodingFunction Encode,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 current += object->Size()) { 1109 current += object->Size()) {
1116 object = HeapObject::FromAddress(current); 1110 object = HeapObject::FromAddress(current);
1117 if (object->IsMarked()) { 1111 if (object->IsMarked()) {
1118 object->ClearMark(); 1112 object->ClearMark();
1119 MarkCompactCollector::tracer()->decrement_marked_count(); 1113 MarkCompactCollector::tracer()->decrement_marked_count();
1120 if (!is_previous_alive) { // Transition from free to live. 1114 if (!is_previous_alive) { // Transition from free to live.
1121 dealloc(free_start, static_cast<int>(current - free_start)); 1115 dealloc(free_start, static_cast<int>(current - free_start));
1122 is_previous_alive = true; 1116 is_previous_alive = true;
1123 } 1117 }
1124 } else { 1118 } else {
1125 if (object->IsCode()) { 1119 MarkCompactCollector::ReportDeleteIfNeeded(object);
1126 // Notify the logger that compiled code has been collected.
1127 LOG(CodeDeleteEvent(Code::cast(object)->address()));
1128 }
1129 if (is_previous_alive) { // Transition from live to free. 1120 if (is_previous_alive) { // Transition from live to free.
1130 free_start = current; 1121 free_start = current;
1131 is_previous_alive = false; 1122 is_previous_alive = false;
1132 } 1123 }
1133 } 1124 }
1134 // The object is now unmarked for the call to Size() at the top of the 1125 // The object is now unmarked for the call to Size() at the top of the
1135 // loop. 1126 // loop.
1136 } 1127 }
1137 1128
1138 // If the last region was not live we need to deallocate from 1129 // If the last region was not live we need to deallocate from
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 // Compute the forwarding pointers in each space. 1196 // Compute the forwarding pointers in each space.
1206 EncodeForwardingAddressesInPagedSpace<MCAllocateFromOldPointerSpace, 1197 EncodeForwardingAddressesInPagedSpace<MCAllocateFromOldPointerSpace,
1207 IgnoreNonLiveObject>( 1198 IgnoreNonLiveObject>(
1208 Heap::old_pointer_space()); 1199 Heap::old_pointer_space());
1209 1200
1210 EncodeForwardingAddressesInPagedSpace<MCAllocateFromOldDataSpace, 1201 EncodeForwardingAddressesInPagedSpace<MCAllocateFromOldDataSpace,
1211 IgnoreNonLiveObject>( 1202 IgnoreNonLiveObject>(
1212 Heap::old_data_space()); 1203 Heap::old_data_space());
1213 1204
1214 EncodeForwardingAddressesInPagedSpace<MCAllocateFromCodeSpace, 1205 EncodeForwardingAddressesInPagedSpace<MCAllocateFromCodeSpace,
1215 LogNonLiveCodeObject>( 1206 ReportDeleteIfNeeded>(
1216 Heap::code_space()); 1207 Heap::code_space());
1217 1208
1218 EncodeForwardingAddressesInPagedSpace<MCAllocateFromCellSpace, 1209 EncodeForwardingAddressesInPagedSpace<MCAllocateFromCellSpace,
1219 IgnoreNonLiveObject>( 1210 IgnoreNonLiveObject>(
1220 Heap::cell_space()); 1211 Heap::cell_space());
1221 1212
1222 1213
1223 // Compute new space next to last after the old and code spaces have been 1214 // Compute new space next to last after the old and code spaces have been
1224 // compacted. Objects in new space can be promoted to old or code space. 1215 // compacted. Objects in new space can be promoted to old or code space.
1225 EncodeForwardingAddressesInNewSpace(); 1216 EncodeForwardingAddressesInNewSpace();
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 if (new_addr != old_addr) { 1936 if (new_addr != old_addr) {
1946 memmove(new_addr, old_addr, obj_size); // Copy contents. 1937 memmove(new_addr, old_addr, obj_size); // Copy contents.
1947 } 1938 }
1948 1939
1949 HeapObject* copied_to = HeapObject::FromAddress(new_addr); 1940 HeapObject* copied_to = HeapObject::FromAddress(new_addr);
1950 if (copied_to->IsCode()) { 1941 if (copied_to->IsCode()) {
1951 // May also update inline cache target. 1942 // May also update inline cache target.
1952 Code::cast(copied_to)->Relocate(new_addr - old_addr); 1943 Code::cast(copied_to)->Relocate(new_addr - old_addr);
1953 // Notify the logger that compiled code has moved. 1944 // Notify the logger that compiled code has moved.
1954 LOG(CodeMoveEvent(old_addr, new_addr)); 1945 LOG(CodeMoveEvent(old_addr, new_addr));
1946 } else if (copied_to->IsJSFunction()) {
1947 LOG(FunctionMoveEvent(old_addr, new_addr));
1955 } 1948 }
1956 1949
1957 return obj_size; 1950 return obj_size;
1958 } 1951 }
1959 1952
1960 1953
1961 int MarkCompactCollector::RelocateNewObject(HeapObject* obj) { 1954 int MarkCompactCollector::RelocateNewObject(HeapObject* obj) {
1962 int obj_size = obj->Size(); 1955 int obj_size = obj->Size();
1963 1956
1964 // Get forwarding address 1957 // Get forwarding address
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 // Phase 5: rebuild remembered sets 1990 // Phase 5: rebuild remembered sets
1998 1991
1999 void MarkCompactCollector::RebuildRSets() { 1992 void MarkCompactCollector::RebuildRSets() {
2000 #ifdef DEBUG 1993 #ifdef DEBUG
2001 ASSERT(state_ == RELOCATE_OBJECTS); 1994 ASSERT(state_ == RELOCATE_OBJECTS);
2002 state_ = REBUILD_RSETS; 1995 state_ = REBUILD_RSETS;
2003 #endif 1996 #endif
2004 Heap::RebuildRSets(); 1997 Heap::RebuildRSets();
2005 } 1998 }
2006 1999
2000
2001 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) {
2002 #ifdef ENABLE_LOGGING_AND_PROFILING
2003 if (obj->IsCode()) {
2004 LOG(CodeDeleteEvent(obj->address()));
2005 } else if (obj->IsJSFunction()) {
2006 LOG(FunctionDeleteEvent(obj->address()));
2007 }
2008 #endif
2009 }
2010
2007 } } // namespace v8::internal 2011 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mark-compact.h ('k') | src/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698