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 4006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4017 } | 4017 } |
4018 RawObject** FieldAddr(const Field& field) const { | 4018 RawObject** FieldAddr(const Field& field) const { |
4019 return FieldAddrAtOffset(field.Offset()); | 4019 return FieldAddrAtOffset(field.Offset()); |
4020 } | 4020 } |
4021 RawObject** NativeFieldsAddr() const { | 4021 RawObject** NativeFieldsAddr() const { |
4022 return FieldAddrAtOffset(sizeof(RawObject)); | 4022 return FieldAddrAtOffset(sizeof(RawObject)); |
4023 } | 4023 } |
4024 void SetFieldAtOffset(intptr_t offset, const Object& value) const { | 4024 void SetFieldAtOffset(intptr_t offset, const Object& value) const { |
4025 StorePointer(FieldAddrAtOffset(offset), value.raw()); | 4025 StorePointer(FieldAddrAtOffset(offset), value.raw()); |
4026 } | 4026 } |
4027 bool IsValidFieldOffset(int offset) const; | 4027 bool IsValidFieldOffset(intptr_t offset) const; |
4028 | 4028 |
4029 static intptr_t NextFieldOffset() { | 4029 static intptr_t NextFieldOffset() { |
4030 return sizeof(RawInstance); | 4030 return sizeof(RawInstance); |
4031 } | 4031 } |
4032 | 4032 |
4033 // TODO(iposva): Determine if this gets in the way of Smi. | 4033 // TODO(iposva): Determine if this gets in the way of Smi. |
4034 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); | 4034 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); |
4035 friend class Class; | 4035 friend class Class; |
4036 friend class Closure; | 4036 friend class Closure; |
4037 friend class SnapshotWriter; | 4037 friend class SnapshotWriter; |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5627 // Make the array immutable to Dart code by switching the class pointer | 5627 // Make the array immutable to Dart code by switching the class pointer |
5628 // to ImmutableArray. | 5628 // to ImmutableArray. |
5629 void MakeImmutable() const; | 5629 void MakeImmutable() const; |
5630 | 5630 |
5631 static RawArray* New(intptr_t len, Heap::Space space = Heap::kNew); | 5631 static RawArray* New(intptr_t len, Heap::Space space = Heap::kNew); |
5632 | 5632 |
5633 // Creates and returns a new array with 'new_length'. Copies all elements from | 5633 // Creates and returns a new array with 'new_length'. Copies all elements from |
5634 // 'source' to the new array. 'new_length' must be greater than or equal to | 5634 // 'source' to the new array. 'new_length' must be greater than or equal to |
5635 // 'source.Length()'. 'source' can be null. | 5635 // 'source.Length()'. 'source' can be null. |
5636 static RawArray* Grow(const Array& source, | 5636 static RawArray* Grow(const Array& source, |
5637 int new_length, | 5637 intptr_t new_length, |
5638 Heap::Space space = Heap::kNew); | 5638 Heap::Space space = Heap::kNew); |
5639 | 5639 |
5640 // Return an Array object that contains all the elements currently present | 5640 // Return an Array object that contains all the elements currently present |
5641 // in the specified Growable Object Array. This is done by first truncating | 5641 // in the specified Growable Object Array. This is done by first truncating |
5642 // the Growable Object Array's backing array to the currently used size and | 5642 // the Growable Object Array's backing array to the currently used size and |
5643 // returning the truncated backing array. | 5643 // returning the truncated backing array. |
5644 // The remaining unused part of the backing array is marked as an Array | 5644 // The remaining unused part of the backing array is marked as an Array |
5645 // object or a regular Object so that it can be traversed during garbage | 5645 // object or a regular Object so that it can be traversed during garbage |
5646 // collection. The backing array of the original Growable Object Array is | 5646 // collection. The backing array of the original Growable Object Array is |
5647 // set to an empty array. | 5647 // set to an empty array. |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6616 | 6616 |
6617 | 6617 |
6618 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6618 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6619 intptr_t index) { | 6619 intptr_t index) { |
6620 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6620 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6621 } | 6621 } |
6622 | 6622 |
6623 } // namespace dart | 6623 } // namespace dart |
6624 | 6624 |
6625 #endif // VM_OBJECT_H_ | 6625 #endif // VM_OBJECT_H_ |
OLD | NEW |