| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 // ------------------------------------------------------------------------- | 1155 // ------------------------------------------------------------------------- |
| 1156 | 1156 |
| 1157 | 1157 |
| 1158 Code* PcToCodeCache::GcSafeCastToCode(HeapObject* object, Address pc) { | 1158 Code* PcToCodeCache::GcSafeCastToCode(HeapObject* object, Address pc) { |
| 1159 Code* code = reinterpret_cast<Code*>(object); | 1159 Code* code = reinterpret_cast<Code*>(object); |
| 1160 ASSERT(code != NULL && code->contains(pc)); | 1160 ASSERT(code != NULL && code->contains(pc)); |
| 1161 return code; | 1161 return code; |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 | 1164 |
| 1165 static int GcSafeSizeOfCodeSpaceObject(HeapObject* object) { |
| 1166 MapWord map_word = object->map_word(); |
| 1167 Map* map = map_word.IsForwardingAddress() ? |
| 1168 map_word.ToForwardingAddress()->map() : map_word.ToMap(); |
| 1169 return object->SizeFromMap(map); |
| 1170 } |
| 1171 |
| 1172 |
| 1165 Code* PcToCodeCache::GcSafeFindCodeForPc(Address pc) { | 1173 Code* PcToCodeCache::GcSafeFindCodeForPc(Address pc) { |
| 1166 Heap* heap = isolate_->heap(); | 1174 Heap* heap = isolate_->heap(); |
| 1167 // Check if the pc points into a large object chunk. | 1175 // Check if the pc points into a large object chunk. |
| 1168 LargePage* large_page = heap->lo_space()->FindPageContainingPc(pc); | 1176 LargePage* large_page = heap->lo_space()->FindPageContainingPc(pc); |
| 1169 if (large_page != NULL) return GcSafeCastToCode(large_page->GetObject(), pc); | 1177 if (large_page != NULL) return GcSafeCastToCode(large_page->GetObject(), pc); |
| 1170 | 1178 |
| 1171 // Iterate through the page until we reach the end or find an object starting | 1179 // Iterate through the page until we reach the end or find an object starting |
| 1172 // after the pc. | 1180 // after the pc. |
| 1173 Page* page = Page::FromAddress(pc); | 1181 Page* page = Page::FromAddress(pc); |
| 1174 HeapObjectIterator iterator(page, heap->GcSafeSizeOfOldObjectFunction()); | 1182 HeapObjectIterator iterator(page, &GcSafeSizeOfCodeSpaceObject); |
| 1175 HeapObject* previous = NULL; | 1183 HeapObject* previous = NULL; |
| 1176 while (true) { | 1184 while (true) { |
| 1177 HeapObject* next = iterator.Next(); | 1185 HeapObject* next = iterator.Next(); |
| 1178 if (next == NULL || next->address() >= pc) { | 1186 if (next == NULL || next->address() >= pc) { |
| 1179 return GcSafeCastToCode(previous, pc); | 1187 return GcSafeCastToCode(previous, pc); |
| 1180 } | 1188 } |
| 1181 previous = next; | 1189 previous = next; |
| 1182 } | 1190 } |
| 1183 } | 1191 } |
| 1184 | 1192 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 ZoneList<StackFrame*> list(10); | 1278 ZoneList<StackFrame*> list(10); |
| 1271 for (StackFrameIterator it; !it.done(); it.Advance()) { | 1279 for (StackFrameIterator it; !it.done(); it.Advance()) { |
| 1272 StackFrame* frame = AllocateFrameCopy(it.frame()); | 1280 StackFrame* frame = AllocateFrameCopy(it.frame()); |
| 1273 list.Add(frame); | 1281 list.Add(frame); |
| 1274 } | 1282 } |
| 1275 return list.ToVector(); | 1283 return list.ToVector(); |
| 1276 } | 1284 } |
| 1277 | 1285 |
| 1278 | 1286 |
| 1279 } } // namespace v8::internal | 1287 } } // namespace v8::internal |
| OLD | NEW |