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

Side by Side Diff: vm/raw_object.cc

Issue 8727015: - Ignore marking bits when visiting pointers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/raw_object.h" 5 #include "vm/raw_object.h"
6 6
7 #include "vm/isolate.h" 7 #include "vm/isolate.h"
8 #include "vm/object.h" 8 #include "vm/object.h"
9 #include "vm/visitor.h" 9 #include "vm/visitor.h"
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 144
145 intptr_t RawObject::VisitPointers(ObjectPointerVisitor* visitor) { 145 intptr_t RawObject::VisitPointers(ObjectPointerVisitor* visitor) {
146 intptr_t size = 0; 146 intptr_t size = 0;
147 NoHandleScope no_handles(Isolate::Current()); 147 NoHandleScope no_handles(Isolate::Current());
148 148
149 // Only reasonable to be called on heap objects. 149 // Only reasonable to be called on heap objects.
150 ASSERT(IsHeapObject()); 150 ASSERT(IsHeapObject());
151 151
152 // Read the necessary data out of the class before visting the class itself. 152 // Read the necessary data out of the class before visting the class itself.
153 ObjectKind kind = ptr()->class_->ptr()->instance_kind_; 153 RawClass* raw_class = ptr()->class_;
154 if (IsMarked()) {
155 // If the object is marked we need to remove the marking bits from the
156 // raw_class which we loaded above.
157 uword header_bits = reinterpret_cast<uword>(raw_class);
158 header_bits = (header_bits & ~kMarkingMask) | kNotMarked;
159 raw_class = reinterpret_cast<RawClass*>(header_bits);
160 }
161 ObjectKind kind = raw_class->ptr()->instance_kind_;
154 162
155 // Visit the class before visting the fields. 163 // Visit the class before visting the fields.
156 visitor->VisitPointer(reinterpret_cast<RawObject**>(&ptr()->class_)); 164 if (!IsMarked()) {
165 visitor->VisitPointer(reinterpret_cast<RawObject**>(&ptr()->class_));
166 }
157 167
158 switch (kind) { 168 switch (kind) {
159 #define RAW_VISITPOINTERS(clazz) \ 169 #define RAW_VISITPOINTERS(clazz) \
160 case clazz::kInstanceKind: { \ 170 case clazz::kInstanceKind: { \
161 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(this); \ 171 Raw##clazz* raw_obj = reinterpret_cast<Raw##clazz*>(this); \
162 size = Raw##clazz::Visit##clazz##Pointers(raw_obj, visitor); \ 172 size = Raw##clazz::Visit##clazz##Pointers(raw_obj, visitor); \
163 break; \ 173 break; \
164 } 174 }
165 CLASS_LIST_NO_OBJECT(RAW_VISITPOINTERS) 175 CLASS_LIST_NO_OBJECT(RAW_VISITPOINTERS)
166 #undef RAW_VISITPOINTERS 176 #undef RAW_VISITPOINTERS
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj, 544 intptr_t RawJSRegExp::VisitJSRegExpPointers(RawJSRegExp* raw_obj,
535 ObjectPointerVisitor* visitor) { 545 ObjectPointerVisitor* visitor) {
536 // Make sure that we got here with the tagged pointer as this. 546 // Make sure that we got here with the tagged pointer as this.
537 ASSERT(raw_obj->IsHeapObject()); 547 ASSERT(raw_obj->IsHeapObject());
538 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_); 548 intptr_t length = Smi::Value(raw_obj->ptr()->data_length_);
539 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 549 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
540 return JSRegExp::InstanceSize(length); 550 return JSRegExp::InstanceSize(length);
541 } 551 }
542 552
543 } // namespace dart 553 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698