| 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 4200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4211 // in the specified Growable Object Array. This is done by first truncating | 4211 // in the specified Growable Object Array. This is done by first truncating |
| 4212 // the Growable Object Array's backing array to the currently used size and | 4212 // the Growable Object Array's backing array to the currently used size and |
| 4213 // returning the truncated backing array. | 4213 // returning the truncated backing array. |
| 4214 // The remaining unused part of the backing array is marked as an Array | 4214 // The remaining unused part of the backing array is marked as an Array |
| 4215 // object or a regular Object so that it can be traversed during garbage | 4215 // object or a regular Object so that it can be traversed during garbage |
| 4216 // collection. The backing array of the original Growable Object Array is | 4216 // collection. The backing array of the original Growable Object Array is |
| 4217 // set to an empty array. | 4217 // set to an empty array. |
| 4218 static RawArray* MakeArray(const GrowableObjectArray& growable_array); | 4218 static RawArray* MakeArray(const GrowableObjectArray& growable_array); |
| 4219 | 4219 |
| 4220 protected: | 4220 protected: |
| 4221 static RawArray* New(const Class& cls, | 4221 static RawArray* New(intptr_t class_id, |
| 4222 intptr_t len, | 4222 intptr_t len, |
| 4223 Heap::Space space = Heap::kNew); | 4223 Heap::Space space = Heap::kNew); |
| 4224 | 4224 |
| 4225 private: | 4225 private: |
| 4226 RawObject** ObjectAddr(intptr_t index) const { | 4226 RawObject** ObjectAddr(intptr_t index) const { |
| 4227 // TODO(iposva): Determine if we should throw an exception here. | 4227 // TODO(iposva): Determine if we should throw an exception here. |
| 4228 ASSERT((index >= 0) && (index < Length())); | 4228 ASSERT((index >= 0) && (index < Length())); |
| 4229 return &raw_ptr()->data()[index]; | 4229 return &raw_ptr()->data()[index]; |
| 4230 } | 4230 } |
| 4231 | 4231 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4367 static void Copy(const ByteArray& dst, | 4367 static void Copy(const ByteArray& dst, |
| 4368 intptr_t dst_offset, | 4368 intptr_t dst_offset, |
| 4369 const ByteArray& src, | 4369 const ByteArray& src, |
| 4370 intptr_t src_offset, | 4370 intptr_t src_offset, |
| 4371 intptr_t length); | 4371 intptr_t length); |
| 4372 | 4372 |
| 4373 protected: | 4373 protected: |
| 4374 virtual uint8_t* ByteAddr(intptr_t byte_offset) const; | 4374 virtual uint8_t* ByteAddr(intptr_t byte_offset) const; |
| 4375 | 4375 |
| 4376 template<typename HandleT, typename RawT> | 4376 template<typename HandleT, typename RawT> |
| 4377 static RawT* NewImpl(const Class& cls, | 4377 static RawT* NewImpl(intptr_t class_id, |
| 4378 intptr_t len, | 4378 intptr_t len, |
| 4379 Heap::Space space); | 4379 Heap::Space space); |
| 4380 | 4380 |
| 4381 template<typename HandleT, typename RawT, typename ElementT> | 4381 template<typename HandleT, typename RawT, typename ElementT> |
| 4382 static RawT* NewImpl(const Class& cls, | 4382 static RawT* NewImpl(intptr_t class_id, |
| 4383 const ElementT* data, | 4383 const ElementT* data, |
| 4384 intptr_t len, | 4384 intptr_t len, |
| 4385 Heap::Space space); | 4385 Heap::Space space); |
| 4386 | 4386 |
| 4387 template<typename HandleT, typename RawT, typename ElementT> | 4387 template<typename HandleT, typename RawT, typename ElementT> |
| 4388 static RawT* NewExternalImpl(const Class& cls, | 4388 static RawT* NewExternalImpl(intptr_t class_id, |
| 4389 ElementT* data, | 4389 ElementT* data, |
| 4390 intptr_t len, | 4390 intptr_t len, |
| 4391 void* peer, | 4391 void* peer, |
| 4392 Dart_PeerFinalizer callback, | 4392 Dart_PeerFinalizer callback, |
| 4393 Heap::Space space); | 4393 Heap::Space space); |
| 4394 | 4394 |
| 4395 template<typename HandleT, typename RawT, typename ElementT> | 4395 template<typename HandleT, typename RawT, typename ElementT> |
| 4396 static RawT* ReadFromImpl(SnapshotReader* reader, | 4396 static RawT* ReadFromImpl(SnapshotReader* reader, |
| 4397 intptr_t object_id, | 4397 intptr_t object_id, |
| 4398 intptr_t tags, | 4398 intptr_t tags, |
| (...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5789 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5789 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5790 return false; | 5790 return false; |
| 5791 } | 5791 } |
| 5792 } | 5792 } |
| 5793 return true; | 5793 return true; |
| 5794 } | 5794 } |
| 5795 | 5795 |
| 5796 } // namespace dart | 5796 } // namespace dart |
| 5797 | 5797 |
| 5798 #endif // VM_OBJECT_H_ | 5798 #endif // VM_OBJECT_H_ |
| OLD | NEW |