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

Unified Diff: src/heap-snapshot-generator.cc

Issue 259173003: Kiss goodbye to MaybeObject. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase + addressed comments Created 6 years, 8 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-inl.h ('k') | src/incremental-marking.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « src/heap-inl.h ('k') | src/incremental-marking.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698