| 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 <limits> | 8 #include <limits> |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 4307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4318 StorePointer(FieldAddrAtOffset(offset), value.raw()); | 4318 StorePointer(FieldAddrAtOffset(offset), value.raw()); |
| 4319 } | 4319 } |
| 4320 bool IsValidFieldOffset(intptr_t offset) const; | 4320 bool IsValidFieldOffset(intptr_t offset) const; |
| 4321 | 4321 |
| 4322 static intptr_t NextFieldOffset() { | 4322 static intptr_t NextFieldOffset() { |
| 4323 return sizeof(RawInstance); | 4323 return sizeof(RawInstance); |
| 4324 } | 4324 } |
| 4325 | 4325 |
| 4326 // TODO(iposva): Determine if this gets in the way of Smi. | 4326 // TODO(iposva): Determine if this gets in the way of Smi. |
| 4327 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); | 4327 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); |
| 4328 friend class ByteBuffer; |
| 4328 friend class Class; | 4329 friend class Class; |
| 4329 friend class Closure; | 4330 friend class Closure; |
| 4330 friend class DeferredObject; | 4331 friend class DeferredObject; |
| 4331 friend class SnapshotWriter; | 4332 friend class SnapshotWriter; |
| 4332 friend class StubCode; | 4333 friend class StubCode; |
| 4333 friend class TypedDataView; | 4334 friend class TypedDataView; |
| 4334 }; | 4335 }; |
| 4335 | 4336 |
| 4336 | 4337 |
| 4337 class LibraryPrefix : public Instance { | 4338 class LibraryPrefix : public Instance { |
| (...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6680 | 6681 |
| 6681 private: | 6682 private: |
| 6682 enum { | 6683 enum { |
| 6683 kDataOffset = 1, | 6684 kDataOffset = 1, |
| 6684 kOffsetInBytesOffset = 2, | 6685 kOffsetInBytesOffset = 2, |
| 6685 kLengthOffset = 3, | 6686 kLengthOffset = 3, |
| 6686 }; | 6687 }; |
| 6687 }; | 6688 }; |
| 6688 | 6689 |
| 6689 | 6690 |
| 6691 class ByteBuffer : public AllStatic { |
| 6692 public: |
| 6693 static RawInstance* Data(const Instance& view_obj) { |
| 6694 ASSERT(!view_obj.IsNull()); |
| 6695 return *reinterpret_cast<RawInstance**>(view_obj.raw_ptr() + kDataOffset); |
| 6696 } |
| 6697 |
| 6698 static intptr_t NumberOfFields() { |
| 6699 return kDataOffset; |
| 6700 } |
| 6701 |
| 6702 static intptr_t data_offset() { |
| 6703 return kWordSize * kDataOffset; |
| 6704 } |
| 6705 |
| 6706 private: |
| 6707 enum { |
| 6708 kDataOffset = 1, |
| 6709 }; |
| 6710 }; |
| 6711 |
| 6712 |
| 6690 class Closure : public AllStatic { | 6713 class Closure : public AllStatic { |
| 6691 public: | 6714 public: |
| 6692 static RawFunction* function(const Instance& closure) { | 6715 static RawFunction* function(const Instance& closure) { |
| 6693 return *FunctionAddr(closure); | 6716 return *FunctionAddr(closure); |
| 6694 } | 6717 } |
| 6695 static intptr_t function_offset() { | 6718 static intptr_t function_offset() { |
| 6696 return static_cast<intptr_t>(kFunctionOffset * kWordSize); | 6719 return static_cast<intptr_t>(kFunctionOffset * kWordSize); |
| 6697 } | 6720 } |
| 6698 | 6721 |
| 6699 static RawContext* context(const Instance& closure) { | 6722 static RawContext* context(const Instance& closure) { |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7184 | 7207 |
| 7185 | 7208 |
| 7186 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7209 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 7187 intptr_t index) { | 7210 intptr_t index) { |
| 7188 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7211 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 7189 } | 7212 } |
| 7190 | 7213 |
| 7191 } // namespace dart | 7214 } // namespace dart |
| 7192 | 7215 |
| 7193 #endif // VM_OBJECT_H_ | 7216 #endif // VM_OBJECT_H_ |
| OLD | NEW |