| 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 4884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4895 | 4895 |
| 4896 | 4896 |
| 4897 void Object::SetRaw(RawObject* value) { | 4897 void Object::SetRaw(RawObject* value) { |
| 4898 // NOTE: The assignment "raw_ = value" should be the first statement in | 4898 // NOTE: The assignment "raw_ = value" should be the first statement in |
| 4899 // this function. Also do not use 'value' in this function after the | 4899 // this function. Also do not use 'value' in this function after the |
| 4900 // assignment (use 'raw_' instead). | 4900 // assignment (use 'raw_' instead). |
| 4901 raw_ = value; | 4901 raw_ = value; |
| 4902 if ((reinterpret_cast<uword>(raw_) & kSmiTagMask) == kSmiTag) { | 4902 if ((reinterpret_cast<uword>(raw_) & kSmiTagMask) == kSmiTag) { |
| 4903 set_vtable(Smi::handle_vtable_); | 4903 set_vtable(Smi::handle_vtable_); |
| 4904 return; | 4904 return; |
| 4905 } else if (raw_ == null_) { |
| 4906 set_vtable(handle_vtable_); |
| 4907 return; |
| 4905 } | 4908 } |
| 4909 |
| 4906 #if defined(DEBUG) | 4910 #if defined(DEBUG) |
| 4907 Isolate* isolate = Isolate::Current(); | 4911 Isolate* isolate = Isolate::Current(); |
| 4908 Heap* isolate_heap = isolate->heap(); | 4912 Heap* isolate_heap = isolate->heap(); |
| 4909 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); | 4913 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); |
| 4910 ASSERT(isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr())) || | 4914 ASSERT(isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr())) || |
| 4911 vm_isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr()))); | 4915 vm_isolate_heap->Contains(reinterpret_cast<uword>(raw_->ptr()))); |
| 4912 #endif | 4916 #endif |
| 4913 if (raw_ == null_) { | 4917 intptr_t cid = raw_->GetClassId(); |
| 4914 set_vtable(handle_vtable_); | 4918 if (cid < kNumPredefinedKinds) { |
| 4919 #if defined(DEBUG) |
| 4920 ASSERT(builtin_vtables_[cid] == |
| 4921 isolate->class_table()->At(cid)->ptr()->handle_vtable_); |
| 4922 #endif |
| 4923 set_vtable(builtin_vtables_[cid]); |
| 4915 } else { | 4924 } else { |
| 4916 intptr_t cid = raw_->GetClassId(); | 4925 #if !defined(DEBUG) |
| 4917 if (cid < kNumPredefinedKinds) { | 4926 Isolate* isolate = Isolate::Current(); |
| 4918 #if defined(DEBUG) | |
| 4919 ASSERT(builtin_vtables_[cid] == | |
| 4920 isolate->class_table()->At(cid)->ptr()->handle_vtable_); | |
| 4921 #endif | 4927 #endif |
| 4922 set_vtable(builtin_vtables_[cid]); | 4928 RawClass* raw_class = isolate->class_table()->At(cid); |
| 4923 } else { | 4929 set_vtable(raw_class->ptr()->handle_vtable_); |
| 4924 #if !defined(DEBUG) | |
| 4925 Isolate* isolate = Isolate::Current(); | |
| 4926 #endif | |
| 4927 RawClass* raw_class = isolate->class_table()->At(cid); | |
| 4928 set_vtable(raw_class->ptr()->handle_vtable_); | |
| 4929 } | |
| 4930 } | 4930 } |
| 4931 } | 4931 } |
| 4932 | 4932 |
| 4933 | 4933 |
| 4934 bool Function::HasCode() const { | 4934 bool Function::HasCode() const { |
| 4935 return raw_ptr()->code_ != Code::null(); | 4935 return raw_ptr()->code_ != Code::null(); |
| 4936 } | 4936 } |
| 4937 | 4937 |
| 4938 | 4938 |
| 4939 intptr_t Field::Offset() const { | 4939 intptr_t Field::Offset() const { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4973 } | 4973 } |
| 4974 | 4974 |
| 4975 | 4975 |
| 4976 intptr_t Stackmap::SizeInBits() const { | 4976 intptr_t Stackmap::SizeInBits() const { |
| 4977 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); | 4977 return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte); |
| 4978 } | 4978 } |
| 4979 | 4979 |
| 4980 } // namespace dart | 4980 } // namespace dart |
| 4981 | 4981 |
| 4982 #endif // VM_OBJECT_H_ | 4982 #endif // VM_OBJECT_H_ |
| OLD | NEW |