Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 8501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8512 DART_FORCE_INLINE void Object::SetRaw(RawObject* value) { | 8512 DART_FORCE_INLINE void Object::SetRaw(RawObject* value) { |
| 8513 // NOTE: The assignment "raw_ = value" should be the first statement in | 8513 // NOTE: The assignment "raw_ = value" should be the first statement in |
| 8514 // this function. Also do not use 'value' in this function after the | 8514 // this function. Also do not use 'value' in this function after the |
| 8515 // assignment (use 'raw_' instead). | 8515 // assignment (use 'raw_' instead). |
| 8516 raw_ = value; | 8516 raw_ = value; |
| 8517 if ((reinterpret_cast<uword>(value) & kSmiTagMask) == kSmiTag) { | 8517 if ((reinterpret_cast<uword>(value) & kSmiTagMask) == kSmiTag) { |
| 8518 set_vtable(Smi::handle_vtable_); | 8518 set_vtable(Smi::handle_vtable_); |
| 8519 return; | 8519 return; |
| 8520 } | 8520 } |
| 8521 intptr_t cid = value->GetClassId(); | 8521 intptr_t cid = value->GetClassId(); |
| 8522 // Free-list elements cannot be wrapped in a handle. | 8522 // Free-list elements cannot be wrapped in a handle. |
|
siva
2016/06/02 00:23:36
Update comment (Free List and Forwarding corpse) e
| |
| 8523 ASSERT(cid != kFreeListElement); | 8523 ASSERT(cid != kFreeListElement); |
| 8524 ASSERT(cid != kForwardingCorpse); | |
| 8524 if (cid >= kNumPredefinedCids) { | 8525 if (cid >= kNumPredefinedCids) { |
| 8525 cid = kInstanceCid; | 8526 cid = kInstanceCid; |
| 8526 } | 8527 } |
| 8527 set_vtable(builtin_vtables_[cid]); | 8528 set_vtable(builtin_vtables_[cid]); |
| 8528 #if defined(DEBUG) | 8529 #if defined(DEBUG) |
| 8529 if (FLAG_verify_handles) { | 8530 if (FLAG_verify_handles) { |
| 8530 Isolate* isolate = Isolate::Current(); | 8531 Isolate* isolate = Isolate::Current(); |
| 8531 Heap* isolate_heap = isolate->heap(); | 8532 Heap* isolate_heap = isolate->heap(); |
| 8532 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); | 8533 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); |
| 8533 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || | 8534 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8711 | 8712 |
| 8712 inline void TypeArguments::SetHash(intptr_t value) const { | 8713 inline void TypeArguments::SetHash(intptr_t value) const { |
| 8713 // This is only safe because we create a new Smi, which does not cause | 8714 // This is only safe because we create a new Smi, which does not cause |
| 8714 // heap allocation. | 8715 // heap allocation. |
| 8715 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8716 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
| 8716 } | 8717 } |
| 8717 | 8718 |
| 8718 } // namespace dart | 8719 } // namespace dart |
| 8719 | 8720 |
| 8720 #endif // VM_OBJECT_H_ | 8721 #endif // VM_OBJECT_H_ |
| OLD | NEW |