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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.cc
===================================================================
--- src/frames.cc (revision 9327)
+++ src/frames.cc (working copy)
@@ -1162,23 +1162,40 @@
}
+static int GcSafeSizeOfCodeSpaceObject(HeapObject* object) {
+ MapWord map_word = object->map_word();
+ Map* map = map_word.IsForwardingAddress() ?
+ map_word.ToForwardingAddress()->map() : map_word.ToMap();
+ return object->SizeFromMap(map);
+}
+
+
Code* PcToCodeCache::GcSafeFindCodeForPc(Address pc) {
Heap* heap = isolate_->heap();
// Check if the pc points into a large object chunk.
- LargeObjectChunk* chunk = heap->lo_space()->FindChunkContainingPc(pc);
- if (chunk != NULL) return GcSafeCastToCode(chunk->GetObject(), pc);
+ LargePage* large_page = heap->lo_space()->FindPageContainingPc(pc);
+ if (large_page != NULL) return GcSafeCastToCode(large_page->GetObject(), pc);
- // Iterate through the 8K page until we reach the end or find an
- // object starting after the pc.
+ // Iterate through the page until we reach the end or find an object starting
+ // after the pc.
Page* page = Page::FromAddress(pc);
- HeapObjectIterator iterator(page, heap->GcSafeSizeOfOldObjectFunction());
- HeapObject* previous = NULL;
+
+ Address addr = page->skip_list()->StartFor(pc);
+
+ Address top = heap->code_space()->top();
+ Address limit = heap->code_space()->limit();
+
while (true) {
- HeapObject* next = iterator.next();
- if (next == NULL || next->address() >= pc) {
- return GcSafeCastToCode(previous, pc);
+ if (addr == top && addr != limit) {
+ addr = limit;
+ continue;
}
- previous = next;
+
+ HeapObject* obj = HeapObject::FromAddress(addr);
+ int obj_size = GcSafeSizeOfCodeSpaceObject(obj);
+ Address next_addr = addr + obj_size;
+ if (next_addr >= pc) return GcSafeCastToCode(obj, pc);
+ addr = next_addr;
}
}
« 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