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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap-inl.h ('k') | src/incremental-marking.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "heap-snapshot-generator-inl.h" 7 #include "heap-snapshot-generator-inl.h"
8 8
9 #include "allocation-tracker.h" 9 #include "allocation-tracker.h"
10 #include "code-stubs.h" 10 #include "code-stubs.h"
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 void VisitPointers(Object** start, Object** end) { 1049 void VisitPointers(Object** start, Object** end) {
1050 for (Object** p = start; p < end; p++) { 1050 for (Object** p = start; p < end; p++) {
1051 ++next_index_; 1051 ++next_index_;
1052 if (CheckVisitedAndUnmark(p)) continue; 1052 if (CheckVisitedAndUnmark(p)) continue;
1053 generator_->SetHiddenReference(parent_obj_, parent_, next_index_, *p); 1053 generator_->SetHiddenReference(parent_obj_, parent_, next_index_, *p);
1054 } 1054 }
1055 } 1055 }
1056 static void MarkVisitedField(HeapObject* obj, int offset) { 1056 static void MarkVisitedField(HeapObject* obj, int offset) {
1057 if (offset < 0) return; 1057 if (offset < 0) return;
1058 Address field = obj->address() + offset; 1058 Address field = obj->address() + offset;
1059 ASSERT(!Memory::Object_at(field)->IsFailure());
1060 ASSERT(Memory::Object_at(field)->IsHeapObject()); 1059 ASSERT(Memory::Object_at(field)->IsHeapObject());
1061 Object* untagged = *reinterpret_cast<Object**>(field); 1060 intptr_t p = reinterpret_cast<intptr_t>(Memory::Object_at(field));
1062 intptr_t tagged = reinterpret_cast<intptr_t>(untagged) | kFailureTag; 1061 ASSERT(!IsMarked(p));
1063 *reinterpret_cast<Object**>(field) = reinterpret_cast<Object*>(tagged); 1062 intptr_t p_tagged = p | kTag;
1063 Memory::Object_at(field) = reinterpret_cast<Object*>(p_tagged);
1064 } 1064 }
1065 1065
1066 private: 1066 private:
1067 bool CheckVisitedAndUnmark(Object** field) { 1067 bool CheckVisitedAndUnmark(Object** field) {
1068 if ((*field)->IsFailure()) { 1068 intptr_t p = reinterpret_cast<intptr_t>(*field);
1069 intptr_t untagged = reinterpret_cast<intptr_t>(*field) & ~kFailureTagMask; 1069 if (IsMarked(p)) {
1070 *field = reinterpret_cast<Object*>(untagged | kHeapObjectTag); 1070 intptr_t p_untagged = (p & ~kTaggingMask) | kHeapObjectTag;
1071 *field = reinterpret_cast<Object*>(p_untagged);
1071 ASSERT((*field)->IsHeapObject()); 1072 ASSERT((*field)->IsHeapObject());
1072 return true; 1073 return true;
1073 } 1074 }
1074 return false; 1075 return false;
1075 } 1076 }
1077
1078 static const intptr_t kTaggingMask = 3;
1079 static const intptr_t kTag = 3;
1080
1081 static bool IsMarked(intptr_t p) { return (p & kTaggingMask) == kTag; }
1082
1076 V8HeapExplorer* generator_; 1083 V8HeapExplorer* generator_;
1077 HeapObject* parent_obj_; 1084 HeapObject* parent_obj_;
1078 int parent_; 1085 int parent_;
1079 int next_index_; 1086 int next_index_;
1080 }; 1087 };
1081 1088
1082 1089
1083 bool V8HeapExplorer::ExtractReferencesPass1(int entry, HeapObject* obj) { 1090 bool V8HeapExplorer::ExtractReferencesPass1(int entry, HeapObject* obj) {
1084 if (obj->IsFixedArray()) return false; // FixedArrays are processed on pass 2 1091 if (obj->IsFixedArray()) return false; // FixedArrays are processed on pass 2
1085 1092
(...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after
3142 writer_->AddString("\"<dummy>\""); 3149 writer_->AddString("\"<dummy>\"");
3143 for (int i = 1; i < sorted_strings.length(); ++i) { 3150 for (int i = 1; i < sorted_strings.length(); ++i) {
3144 writer_->AddCharacter(','); 3151 writer_->AddCharacter(',');
3145 SerializeString(sorted_strings[i]); 3152 SerializeString(sorted_strings[i]);
3146 if (writer_->aborted()) return; 3153 if (writer_->aborted()) return;
3147 } 3154 }
3148 } 3155 }
3149 3156
3150 3157
3151 } } // namespace v8::internal 3158 } } // namespace v8::internal
OLDNEW
« 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