Index: src/heap-snapshot-generator.cc |
diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc |
index eac30eb61874acbde56ac52ec58a1a9752cd1d33..cafee77b4ce10d20be74ee3df7fe290349cff63f 100644 |
--- a/src/heap-snapshot-generator.cc |
+++ b/src/heap-snapshot-generator.cc |
@@ -1056,23 +1056,30 @@ class IndexedReferencesExtractor : public ObjectVisitor { |
static void MarkVisitedField(HeapObject* obj, int offset) { |
if (offset < 0) return; |
Address field = obj->address() + offset; |
- ASSERT(!Memory::Object_at(field)->IsFailure()); |
ASSERT(Memory::Object_at(field)->IsHeapObject()); |
- Object* untagged = *reinterpret_cast<Object**>(field); |
- intptr_t tagged = reinterpret_cast<intptr_t>(untagged) | kFailureTag; |
- *reinterpret_cast<Object**>(field) = reinterpret_cast<Object*>(tagged); |
+ intptr_t p = reinterpret_cast<intptr_t>(Memory::Object_at(field)); |
+ ASSERT(!IsMarked(p)); |
+ intptr_t p_tagged = p | kTag; |
+ Memory::Object_at(field) = reinterpret_cast<Object*>(p_tagged); |
} |
private: |
bool CheckVisitedAndUnmark(Object** field) { |
- if ((*field)->IsFailure()) { |
- intptr_t untagged = reinterpret_cast<intptr_t>(*field) & ~kFailureTagMask; |
- *field = reinterpret_cast<Object*>(untagged | kHeapObjectTag); |
+ intptr_t p = reinterpret_cast<intptr_t>(*field); |
+ if (IsMarked(p)) { |
+ intptr_t p_untagged = (p & ~kTaggingMask) | kHeapObjectTag; |
+ *field = reinterpret_cast<Object*>(p_untagged); |
ASSERT((*field)->IsHeapObject()); |
return true; |
} |
return false; |
} |
+ |
+ static const intptr_t kTaggingMask = 3; |
+ static const intptr_t kTag = 3; |
+ |
+ static bool IsMarked(intptr_t p) { return (p & kTaggingMask) == kTag; } |
+ |
V8HeapExplorer* generator_; |
HeapObject* parent_obj_; |
int parent_; |