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

Side by Side Diff: runtime/vm/raw_object.h

Issue 1027243003: Revert "Eliminate fake-Isolate workaround from concurrent sweeper." (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | « runtime/vm/pages.cc ('k') | runtime/vm/raw_object.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #ifndef VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 ptr()->tags_ = RememberedBit::update(false, tags); 388 ptr()->tags_ = RememberedBit::update(false, tags);
389 } 389 }
390 390
391 bool IsDartInstance() { 391 bool IsDartInstance() {
392 return (!IsHeapObject() || (GetClassId() >= kInstanceCid)); 392 return (!IsHeapObject() || (GetClassId() >= kInstanceCid));
393 } 393 }
394 bool IsFreeListElement() { 394 bool IsFreeListElement() {
395 return ((GetClassId() == kFreeListElement)); 395 return ((GetClassId() == kFreeListElement));
396 } 396 }
397 397
398 // Uses the class table of the current isolate, when needed.
399 intptr_t Size() const { 398 intptr_t Size() const {
400 uword tags = ptr()->tags_; 399 uword tags = ptr()->tags_;
401 intptr_t result = SizeTag::decode(tags); 400 intptr_t result = SizeTag::decode(tags);
402 if (result != 0) { 401 if (result != 0) {
403 ASSERT(result == SizeFromClass()); 402 ASSERT(result == SizeFromClass());
404 return result; 403 return result;
405 } 404 }
406 result = SizeFromClass(); 405 result = SizeFromClass();
407 ASSERT(result > SizeTag::kMaxSizeTag); 406 ASSERT(result > SizeTag::kMaxSizeTag);
408 return result; 407 return result;
409 } 408 }
410 409
411 // Like above, but avoids Thread/Isolate::Current.
412 intptr_t Size(const ClassTable* class_table) const {
413 uword tags = ptr()->tags_;
414 intptr_t result = SizeTag::decode(tags);
415 if (result != 0) {
416 ASSERT(result == SizeFromClass(class_table));
417 return result;
418 }
419 result = SizeFromClass(class_table);
420 ASSERT(result > SizeTag::kMaxSizeTag);
421 return result;
422 }
423
424 bool Contains(uword addr) const { 410 bool Contains(uword addr) const {
425 intptr_t this_size = Size(); 411 intptr_t this_size = Size();
426 uword this_addr = RawObject::ToAddr(this); 412 uword this_addr = RawObject::ToAddr(this);
427 return (addr >= this_addr) && (addr < (this_addr + this_size)); 413 return (addr >= this_addr) && (addr < (this_addr + this_size));
428 } 414 }
429 415
430 void Validate(Isolate* isolate) const; 416 void Validate(Isolate* isolate) const;
431 intptr_t VisitPointers(ObjectPointerVisitor* visitor); 417 intptr_t VisitPointers(ObjectPointerVisitor* visitor);
432 bool FindObject(FindObjectVisitor* visitor); 418 bool FindObject(FindObjectVisitor* visitor);
433 419
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 BitField<intptr_t, kReservedTagPos, kReservedTagSize> {}; // NOLINT 470 BitField<intptr_t, kReservedTagPos, kReservedTagSize> {}; // NOLINT
485 471
486 // TODO(koda): After handling tags_, return const*, like Object::raw_ptr(). 472 // TODO(koda): After handling tags_, return const*, like Object::raw_ptr().
487 RawObject* ptr() const { 473 RawObject* ptr() const {
488 ASSERT(IsHeapObject()); 474 ASSERT(IsHeapObject());
489 return reinterpret_cast<RawObject*>( 475 return reinterpret_cast<RawObject*>(
490 reinterpret_cast<uword>(this) - kHeapObjectTag); 476 reinterpret_cast<uword>(this) - kHeapObjectTag);
491 } 477 }
492 478
493 intptr_t SizeFromClass() const; 479 intptr_t SizeFromClass() const;
494 intptr_t SizeFromClass(const ClassTable* class_table) const;
495 480
496 intptr_t GetClassId() const { 481 intptr_t GetClassId() const {
497 uword tags = ptr()->tags_; 482 uword tags = ptr()->tags_;
498 return ClassIdTag::decode(tags); 483 return ClassIdTag::decode(tags);
499 } 484 }
500 485
501 template<class TagBitField> 486 template<class TagBitField>
502 void UpdateTagBit(bool value) { 487 void UpdateTagBit(bool value) {
503 uword tags = ptr()->tags_; 488 uword tags = ptr()->tags_;
504 uword old_tags; 489 uword old_tags;
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2176 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2192 kTypedDataInt8ArrayViewCid + 15); 2177 kTypedDataInt8ArrayViewCid + 15);
2193 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2178 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2194 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2179 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2195 return (kNullCid - kTypedDataInt8ArrayCid); 2180 return (kNullCid - kTypedDataInt8ArrayCid);
2196 } 2181 }
2197 2182
2198 } // namespace dart 2183 } // namespace dart
2199 2184
2200 #endif // VM_RAW_OBJECT_H_ 2185 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/pages.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698