| 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 8513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8524 RawClass* Object::clazz() const { | 8524 RawClass* Object::clazz() const { |
| 8525 uword raw_value = reinterpret_cast<uword>(raw_); | 8525 uword raw_value = reinterpret_cast<uword>(raw_); |
| 8526 if ((raw_value & kSmiTagMask) == kSmiTag) { | 8526 if ((raw_value & kSmiTagMask) == kSmiTag) { |
| 8527 return Smi::Class(); | 8527 return Smi::Class(); |
| 8528 } | 8528 } |
| 8529 return Isolate::Current()->class_table()->At(raw()->GetClassId()); | 8529 return Isolate::Current()->class_table()->At(raw()->GetClassId()); |
| 8530 } | 8530 } |
| 8531 | 8531 |
| 8532 | 8532 |
| 8533 DART_FORCE_INLINE void Object::SetRaw(RawObject* value) { | 8533 DART_FORCE_INLINE void Object::SetRaw(RawObject* value) { |
| 8534 // NOTE: The assignment "raw_ = value" should be the first statement in | 8534 NoSafepointScope no_safepoint_scope; |
| 8535 // this function. Also do not use 'value' in this function after the | |
| 8536 // assignment (use 'raw_' instead). | |
| 8537 raw_ = value; | 8535 raw_ = value; |
| 8538 if ((reinterpret_cast<uword>(value) & kSmiTagMask) == kSmiTag) { | 8536 if ((reinterpret_cast<uword>(value) & kSmiTagMask) == kSmiTag) { |
| 8539 set_vtable(Smi::handle_vtable_); | 8537 set_vtable(Smi::handle_vtable_); |
| 8540 return; | 8538 return; |
| 8541 } | 8539 } |
| 8542 intptr_t cid = value->GetClassId(); | 8540 intptr_t cid = value->GetClassId(); |
| 8543 // Free-list elements cannot be wrapped in a handle. | 8541 // Free-list elements cannot be wrapped in a handle. |
| 8544 ASSERT(cid != kFreeListElement); | 8542 ASSERT(cid != kFreeListElement); |
| 8545 ASSERT(cid != kForwardingCorpse); | 8543 ASSERT(cid != kForwardingCorpse); |
| 8546 if (cid >= kNumPredefinedCids) { | 8544 if (cid >= kNumPredefinedCids) { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8733 | 8731 |
| 8734 inline void TypeArguments::SetHash(intptr_t value) const { | 8732 inline void TypeArguments::SetHash(intptr_t value) const { |
| 8735 // This is only safe because we create a new Smi, which does not cause | 8733 // This is only safe because we create a new Smi, which does not cause |
| 8736 // heap allocation. | 8734 // heap allocation. |
| 8737 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8735 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
| 8738 } | 8736 } |
| 8739 | 8737 |
| 8740 } // namespace dart | 8738 } // namespace dart |
| 8741 | 8739 |
| 8742 #endif // VM_OBJECT_H_ | 8740 #endif // VM_OBJECT_H_ |
| OLD | NEW |