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

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

Issue 1582004: C++ profiles processor: wire up to VM. (Closed)
Patch Set: Created 10 years, 8 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/log.cc ('k') | src/platform.h » ('j') | src/platform-linux.cc » ('J')
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 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 // Move contents. 2092 // Move contents.
2093 Heap::MoveBlock(reinterpret_cast<Object**>(new_addr), 2093 Heap::MoveBlock(reinterpret_cast<Object**>(new_addr),
2094 reinterpret_cast<Object**>(old_addr), 2094 reinterpret_cast<Object**>(old_addr),
2095 obj_size); 2095 obj_size);
2096 } 2096 }
2097 2097
2098 ASSERT(!HeapObject::FromAddress(new_addr)->IsCode()); 2098 ASSERT(!HeapObject::FromAddress(new_addr)->IsCode());
2099 2099
2100 HeapObject* copied_to = HeapObject::FromAddress(new_addr); 2100 HeapObject* copied_to = HeapObject::FromAddress(new_addr);
2101 if (copied_to->IsJSFunction()) { 2101 if (copied_to->IsJSFunction()) {
2102 LOG(FunctionMoveEvent(old_addr, new_addr)); 2102 PROFILE(FunctionMoveEvent(old_addr, new_addr));
2103 } 2103 }
2104 2104
2105 return obj_size; 2105 return obj_size;
2106 } 2106 }
2107 2107
2108 2108
2109 int MarkCompactCollector::RelocateOldPointerObject(HeapObject* obj) { 2109 int MarkCompactCollector::RelocateOldPointerObject(HeapObject* obj) {
2110 return RelocateOldNonCodeObject(obj, Heap::old_pointer_space()); 2110 return RelocateOldNonCodeObject(obj, Heap::old_pointer_space());
2111 } 2111 }
2112 2112
(...skipping 27 matching lines...) Expand all
2140 Heap::MoveBlock(reinterpret_cast<Object**>(new_addr), 2140 Heap::MoveBlock(reinterpret_cast<Object**>(new_addr),
2141 reinterpret_cast<Object**>(old_addr), 2141 reinterpret_cast<Object**>(old_addr),
2142 obj_size); 2142 obj_size);
2143 } 2143 }
2144 2144
2145 HeapObject* copied_to = HeapObject::FromAddress(new_addr); 2145 HeapObject* copied_to = HeapObject::FromAddress(new_addr);
2146 if (copied_to->IsCode()) { 2146 if (copied_to->IsCode()) {
2147 // May also update inline cache target. 2147 // May also update inline cache target.
2148 Code::cast(copied_to)->Relocate(new_addr - old_addr); 2148 Code::cast(copied_to)->Relocate(new_addr - old_addr);
2149 // Notify the logger that compiled code has moved. 2149 // Notify the logger that compiled code has moved.
2150 LOG(CodeMoveEvent(old_addr, new_addr)); 2150 PROFILE(CodeMoveEvent(old_addr, new_addr));
2151 } 2151 }
2152 2152
2153 return obj_size; 2153 return obj_size;
2154 } 2154 }
2155 2155
2156 2156
2157 int MarkCompactCollector::RelocateNewObject(HeapObject* obj) { 2157 int MarkCompactCollector::RelocateNewObject(HeapObject* obj) {
2158 int obj_size = obj->Size(); 2158 int obj_size = obj->Size();
2159 2159
2160 // Get forwarding address 2160 // Get forwarding address
(...skipping 19 matching lines...) Expand all
2180 obj_size); 2180 obj_size);
2181 2181
2182 #ifdef DEBUG 2182 #ifdef DEBUG
2183 if (FLAG_gc_verbose) { 2183 if (FLAG_gc_verbose) {
2184 PrintF("relocate %p -> %p\n", old_addr, new_addr); 2184 PrintF("relocate %p -> %p\n", old_addr, new_addr);
2185 } 2185 }
2186 #endif 2186 #endif
2187 2187
2188 HeapObject* copied_to = HeapObject::FromAddress(new_addr); 2188 HeapObject* copied_to = HeapObject::FromAddress(new_addr);
2189 if (copied_to->IsJSFunction()) { 2189 if (copied_to->IsJSFunction()) {
2190 LOG(FunctionMoveEvent(old_addr, new_addr)); 2190 PROFILE(FunctionMoveEvent(old_addr, new_addr));
2191 } 2191 }
2192 2192
2193 return obj_size; 2193 return obj_size;
2194 } 2194 }
2195 2195
2196 2196
2197 // ------------------------------------------------------------------------- 2197 // -------------------------------------------------------------------------
2198 // Phase 5: rebuild remembered sets 2198 // Phase 5: rebuild remembered sets
2199 2199
2200 void MarkCompactCollector::RebuildRSets() { 2200 void MarkCompactCollector::RebuildRSets() {
2201 #ifdef DEBUG 2201 #ifdef DEBUG
2202 ASSERT(state_ == RELOCATE_OBJECTS); 2202 ASSERT(state_ == RELOCATE_OBJECTS);
2203 state_ = REBUILD_RSETS; 2203 state_ = REBUILD_RSETS;
2204 #endif 2204 #endif
2205 Heap::RebuildRSets(); 2205 Heap::RebuildRSets();
2206 } 2206 }
2207 2207
2208 2208
2209 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) { 2209 void MarkCompactCollector::ReportDeleteIfNeeded(HeapObject* obj) {
2210 #ifdef ENABLE_LOGGING_AND_PROFILING 2210 #ifdef ENABLE_LOGGING_AND_PROFILING
2211 if (obj->IsCode()) { 2211 if (obj->IsCode()) {
2212 LOG(CodeDeleteEvent(obj->address())); 2212 PROFILE(CodeDeleteEvent(obj->address()));
2213 } else if (obj->IsJSFunction()) { 2213 } else if (obj->IsJSFunction()) {
2214 LOG(FunctionDeleteEvent(obj->address())); 2214 PROFILE(FunctionDeleteEvent(obj->address()));
2215 } 2215 }
2216 #endif 2216 #endif
2217 } 2217 }
2218 2218
2219 } } // namespace v8::internal 2219 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/platform.h » ('j') | src/platform-linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698