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

Side by Side Diff: src/frames.cc

Issue 7945009: Merge experimental/gc branch to the bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap.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 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
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 LargeObjectChunk* chunk = heap->lo_space()->FindChunkContainingPc(pc); 1176 LargePage* large_page = heap->lo_space()->FindPageContainingPc(pc);
1169 if (chunk != NULL) return GcSafeCastToCode(chunk->GetObject(), pc); 1177 if (large_page != NULL) return GcSafeCastToCode(large_page->GetObject(), pc);
1170 1178
1171 // Iterate through the 8K page until we reach the end or find an 1179 // Iterate through the page until we reach the end or find an object starting
1172 // object starting 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
1175 HeapObject* previous = NULL; 1183 Address addr = page->skip_list()->StartFor(pc);
1184
1185 Address top = heap->code_space()->top();
1186 Address limit = heap->code_space()->limit();
1187
1176 while (true) { 1188 while (true) {
1177 HeapObject* next = iterator.next(); 1189 if (addr == top && addr != limit) {
1178 if (next == NULL || next->address() >= pc) { 1190 addr = limit;
1179 return GcSafeCastToCode(previous, pc); 1191 continue;
1180 } 1192 }
1181 previous = next; 1193
1194 HeapObject* obj = HeapObject::FromAddress(addr);
1195 int obj_size = GcSafeSizeOfCodeSpaceObject(obj);
1196 Address next_addr = addr + obj_size;
1197 if (next_addr >= pc) return GcSafeCastToCode(obj, pc);
1198 addr = next_addr;
1182 } 1199 }
1183 } 1200 }
1184 1201
1185 1202
1186 PcToCodeCache::PcToCodeCacheEntry* PcToCodeCache::GetCacheEntry(Address pc) { 1203 PcToCodeCache::PcToCodeCacheEntry* PcToCodeCache::GetCacheEntry(Address pc) {
1187 isolate_->counters()->pc_to_code()->Increment(); 1204 isolate_->counters()->pc_to_code()->Increment();
1188 ASSERT(IsPowerOf2(kPcToCodeCacheSize)); 1205 ASSERT(IsPowerOf2(kPcToCodeCacheSize));
1189 uint32_t hash = ComputeIntegerHash( 1206 uint32_t hash = ComputeIntegerHash(
1190 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(pc))); 1207 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(pc)));
1191 uint32_t index = hash & (kPcToCodeCacheSize - 1); 1208 uint32_t index = hash & (kPcToCodeCacheSize - 1);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 ZoneList<StackFrame*> list(10); 1287 ZoneList<StackFrame*> list(10);
1271 for (StackFrameIterator it; !it.done(); it.Advance()) { 1288 for (StackFrameIterator it; !it.done(); it.Advance()) {
1272 StackFrame* frame = AllocateFrameCopy(it.frame()); 1289 StackFrame* frame = AllocateFrameCopy(it.frame());
1273 list.Add(frame); 1290 list.Add(frame);
1274 } 1291 }
1275 return list.ToVector(); 1292 return list.ToVector();
1276 } 1293 }
1277 1294
1278 1295
1279 } } // namespace v8::internal 1296 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698