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

Unified Diff: src/heap.cc

Issue 316533002: Fix PathTracer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index ff7a9ff12f20d6f7e37751f7d2bd91fb26939684..28bd81b3c4a8dd33c5bfcc06d1133d801d1812e5 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -5837,9 +5837,8 @@ void PathTracer::MarkRecursively(Object** p, MarkVisitor* mark_visitor) {
HeapObject* obj = HeapObject::cast(*p);
- Object* map = obj->map();
-
- if (!map->IsHeapObject()) return; // visited before
+ MapWord map_word = obj->map_word();
+ if (!map_word.ToMap()->IsHeapObject()) return; // visited before
if (found_target_in_trace_) return; // stop if target found
object_stack_.Add(obj);
@@ -5853,11 +5852,11 @@ void PathTracer::MarkRecursively(Object** p, MarkVisitor* mark_visitor) {
bool is_native_context = SafeIsNativeContext(obj);
// not visited yet
- Map* map_p = reinterpret_cast<Map*>(HeapObject::cast(map));
-
- Address map_addr = map_p->address();
+ Map* map = Map::cast(map_word.ToMap());
- obj->set_map_no_write_barrier(reinterpret_cast<Map*>(map_addr + kMarkTag));
+ MapWord marked_map_word =
+ MapWord::FromRawValue(obj->map_word().ToRawValue() + kMarkTag);
+ obj->set_map_word(marked_map_word);
// Scan the object body.
if (is_native_context && (visit_mode_ == VISIT_ONLY_STRONG)) {
@@ -5868,17 +5867,16 @@ void PathTracer::MarkRecursively(Object** p, MarkVisitor* mark_visitor) {
Context::kHeaderSize + Context::FIRST_WEAK_SLOT * kPointerSize);
mark_visitor->VisitPointers(start, end);
} else {
- obj->IterateBody(map_p->instance_type(),
- obj->SizeFromMap(map_p),
- mark_visitor);
+ obj->IterateBody(map->instance_type(), obj->SizeFromMap(map), mark_visitor);
}
// Scan the map after the body because the body is a lot more interesting
// when doing leak detection.
- MarkRecursively(&map, mark_visitor);
+ MarkRecursively(reinterpret_cast<Object**>(&map), mark_visitor);
- if (!found_target_in_trace_) // don't pop if found the target
+ if (!found_target_in_trace_) { // don't pop if found the target
object_stack_.RemoveLast();
+ }
}
@@ -5887,25 +5885,18 @@ void PathTracer::UnmarkRecursively(Object** p, UnmarkVisitor* unmark_visitor) {
HeapObject* obj = HeapObject::cast(*p);
- Object* map = obj->map();
-
- if (map->IsHeapObject()) return; // unmarked already
-
- Address map_addr = reinterpret_cast<Address>(map);
-
- map_addr -= kMarkTag;
-
- ASSERT_TAG_ALIGNED(map_addr);
+ MapWord map_word = obj->map_word();
+ if (map_word.ToMap()->IsHeapObject()) return; // unmarked already
- HeapObject* map_p = HeapObject::FromAddress(map_addr);
+ MapWord unmarked_map_word =
+ MapWord::FromRawValue(map_word.ToRawValue() - kMarkTag);
+ obj->set_map_word(unmarked_map_word);
- obj->set_map_no_write_barrier(reinterpret_cast<Map*>(map_p));
+ Map* map = Map::cast(unmarked_map_word.ToMap());
- UnmarkRecursively(reinterpret_cast<Object**>(&map_p), unmark_visitor);
+ UnmarkRecursively(reinterpret_cast<Object**>(&map), unmark_visitor);
- obj->IterateBody(Map::cast(map_p)->instance_type(),
- obj->SizeFromMap(Map::cast(map_p)),
- unmark_visitor);
+ obj->IterateBody(map->instance_type(), obj->SizeFromMap(map), unmark_visitor);
}
« no previous file with comments | « src/heap.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698