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 3997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4008 Error* bound_error) const; | 4008 Error* bound_error) const; |
4009 | 4009 |
4010 // Check whether this instance is identical to the argument according to the | 4010 // Check whether this instance is identical to the argument according to the |
4011 // specification of dare:core's identical(). | 4011 // specification of dare:core's identical(). |
4012 bool IsIdenticalTo(const Instance& other) const; | 4012 bool IsIdenticalTo(const Instance& other) const; |
4013 | 4013 |
4014 bool IsValidNativeIndex(int index) const { | 4014 bool IsValidNativeIndex(int index) const { |
4015 return ((index >= 0) && (index < clazz()->ptr()->num_native_fields_)); | 4015 return ((index >= 0) && (index < clazz()->ptr()->num_native_fields_)); |
4016 } | 4016 } |
4017 | 4017 |
| 4018 intptr_t* NativeFieldsDataAddr() const; |
4018 inline intptr_t GetNativeField(int index) const; | 4019 inline intptr_t GetNativeField(int index) const; |
4019 inline void GetNativeFields(uint16_t num_fields, | 4020 inline void GetNativeFields(uint16_t num_fields, |
4020 intptr_t* field_values) const; | 4021 intptr_t* field_values) const; |
4021 | 4022 |
4022 uint16_t NumNativeFields() const { | 4023 uint16_t NumNativeFields() const { |
4023 return clazz()->ptr()->num_native_fields_; | 4024 return clazz()->ptr()->num_native_fields_; |
4024 } | 4025 } |
4025 | 4026 |
4026 void SetNativeField(int index, intptr_t value) const; | 4027 void SetNativeField(int index, intptr_t value) const; |
4027 | 4028 |
(...skipping 24 matching lines...) Expand all Loading... |
4052 RawObject** FieldAddrAtOffset(intptr_t offset) const { | 4053 RawObject** FieldAddrAtOffset(intptr_t offset) const { |
4053 ASSERT(IsValidFieldOffset(offset)); | 4054 ASSERT(IsValidFieldOffset(offset)); |
4054 return reinterpret_cast<RawObject**>(raw_value() - kHeapObjectTag + offset); | 4055 return reinterpret_cast<RawObject**>(raw_value() - kHeapObjectTag + offset); |
4055 } | 4056 } |
4056 RawObject** FieldAddr(const Field& field) const { | 4057 RawObject** FieldAddr(const Field& field) const { |
4057 return FieldAddrAtOffset(field.Offset()); | 4058 return FieldAddrAtOffset(field.Offset()); |
4058 } | 4059 } |
4059 RawObject** NativeFieldsAddr() const { | 4060 RawObject** NativeFieldsAddr() const { |
4060 return FieldAddrAtOffset(sizeof(RawObject)); | 4061 return FieldAddrAtOffset(sizeof(RawObject)); |
4061 } | 4062 } |
| 4063 |
4062 void SetFieldAtOffset(intptr_t offset, const Object& value) const { | 4064 void SetFieldAtOffset(intptr_t offset, const Object& value) const { |
4063 StorePointer(FieldAddrAtOffset(offset), value.raw()); | 4065 StorePointer(FieldAddrAtOffset(offset), value.raw()); |
4064 } | 4066 } |
4065 bool IsValidFieldOffset(intptr_t offset) const; | 4067 bool IsValidFieldOffset(intptr_t offset) const; |
4066 | 4068 |
4067 static intptr_t NextFieldOffset() { | 4069 static intptr_t NextFieldOffset() { |
4068 return sizeof(RawInstance); | 4070 return sizeof(RawInstance); |
4069 } | 4071 } |
4070 | 4072 |
4071 // TODO(iposva): Determine if this gets in the way of Smi. | 4073 // TODO(iposva): Determine if this gets in the way of Smi. |
(...skipping 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6775 | 6777 |
6776 | 6778 |
6777 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6779 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6778 intptr_t index) { | 6780 intptr_t index) { |
6779 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6781 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6780 } | 6782 } |
6781 | 6783 |
6782 } // namespace dart | 6784 } // namespace dart |
6783 | 6785 |
6784 #endif // VM_OBJECT_H_ | 6786 #endif // VM_OBJECT_H_ |
OLD | NEW |