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 3610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3621 ASSERT(0 <= len && len <= kMaxElements); | 3621 ASSERT(0 <= len && len <= kMaxElements); |
3622 return RoundedAllocationSize( | 3622 return RoundedAllocationSize( |
3623 sizeof(RawObjectPool) + (len * kBytesPerElement)); | 3623 sizeof(RawObjectPool) + (len * kBytesPerElement)); |
3624 } | 3624 } |
3625 | 3625 |
3626 static RawObjectPool* New(intptr_t len); | 3626 static RawObjectPool* New(intptr_t len); |
3627 | 3627 |
3628 // Returns the pool index from the offset relative to a tagged RawObjectPool*, | 3628 // Returns the pool index from the offset relative to a tagged RawObjectPool*, |
3629 // adjusting for the tag-bit. | 3629 // adjusting for the tag-bit. |
3630 static intptr_t IndexFromOffset(intptr_t offset) { | 3630 static intptr_t IndexFromOffset(intptr_t offset) { |
| 3631 ASSERT(Utils::IsAligned(offset + kHeapObjectTag, kWordSize)); |
3631 return (offset + kHeapObjectTag - data_offset()) / kBytesPerElement; | 3632 return (offset + kHeapObjectTag - data_offset()) / kBytesPerElement; |
3632 } | 3633 } |
3633 | 3634 |
3634 static intptr_t OffsetFromIndex(intptr_t index) { | 3635 static intptr_t OffsetFromIndex(intptr_t index) { |
3635 return element_offset(index) - kHeapObjectTag; | 3636 return element_offset(index) - kHeapObjectTag; |
3636 } | 3637 } |
3637 | 3638 |
3638 void DebugPrint() const; | 3639 void DebugPrint() const; |
3639 | 3640 |
3640 private: | 3641 private: |
(...skipping 4403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8044 | 8045 |
8045 | 8046 |
8046 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8047 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8047 intptr_t index) { | 8048 intptr_t index) { |
8048 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8049 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8049 } | 8050 } |
8050 | 8051 |
8051 } // namespace dart | 8052 } // namespace dart |
8052 | 8053 |
8053 #endif // VM_OBJECT_H_ | 8054 #endif // VM_OBJECT_H_ |
OLD | NEW |