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

Unified Diff: src/heap.cc

Issue 3226014: Add functionality for finding code objects from a pc that points into... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 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/heap.h ('k') | src/ia32/frames-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 5368)
+++ src/heap.cc (working copy)
@@ -104,6 +104,7 @@
GCCallback Heap::global_gc_prologue_callback_ = NULL;
GCCallback Heap::global_gc_epilogue_callback_ = NULL;
+HeapObjectCallback Heap::gc_safe_size_of_old_object_ = NULL;
// Variables set based on semispace_size_ and old_generation_size_ in
// ConfigureHeap.
@@ -193,6 +194,33 @@
}
+int Heap::GcSafeSizeOfOldObject(HeapObject* object) {
+ ASSERT(!Heap::InNewSpace(object)); // Code only works for old objects.
+ ASSERT(!MarkCompactCollector::are_map_pointers_encoded());
+ MapWord map_word = object->map_word();
+ map_word.ClearMark();
+ map_word.ClearOverflow();
+ return object->SizeFromMap(map_word.ToMap());
+}
+
+
+int Heap::GcSafeSizeOfOldObjectWithEncodedMap(HeapObject* object) {
+ ASSERT(!Heap::InNewSpace(object)); // Code only works for old objects.
+ ASSERT(MarkCompactCollector::are_map_pointers_encoded());
+ uint32_t marker = Memory::uint32_at(object->address());
+ if (marker == MarkCompactCollector::kSingleFreeEncoding) {
+ return kIntSize;
+ } else if (marker == MarkCompactCollector::kMultiFreeEncoding) {
+ return Memory::int_at(object->address() + kIntSize);
+ } else {
+ MapWord map_word = object->map_word();
+ Address map_address = map_word.DecodeMapAddress(Heap::map_space());
+ Map* map = reinterpret_cast<Map*>(HeapObject::FromAddress(map_address));
+ return object->SizeFromMap(map);
+ }
+}
+
+
GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space) {
// Is global GC requested?
if (space != NEW_SPACE || FLAG_gc_global) {
@@ -742,8 +770,6 @@
MarkCompactCollector::CollectGarbage();
- MarkCompactEpilogue(is_compacting);
-
LOG(ResourceEvent("markcompact", "end"));
gc_state_ = NOT_IN_GC;
@@ -765,9 +791,6 @@
CompilationCache::MarkCompactPrologue();
- Top::MarkCompactPrologue(is_compacting);
- ThreadManager::MarkCompactPrologue(is_compacting);
-
CompletelyClearInstanceofCache();
if (is_compacting) FlushNumberStringCache();
@@ -776,12 +799,6 @@
}
-void Heap::MarkCompactEpilogue(bool is_compacting) {
- Top::MarkCompactEpilogue(is_compacting);
- ThreadManager::MarkCompactEpilogue(is_compacting);
-}
-
-
Object* Heap::FindCodeObject(Address a) {
Object* obj = code_space_->FindObject(a);
if (obj->IsFailure()) {
@@ -4049,6 +4066,8 @@
NewSpaceScavenger::Initialize();
MarkCompactCollector::Initialize();
+ MarkMapPointersAsEncoded(false);
+
// Setup memory allocator and reserve a chunk of memory for new
// space. The chunk is double the size of the requested reserved
// new space size to ensure that we can find a pair of semispaces that
« no previous file with comments | « src/heap.h ('k') | src/ia32/frames-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698