| 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 4326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4337 StorePointer(FieldAddrAtOffset(offset), value.raw()); | 4337 StorePointer(FieldAddrAtOffset(offset), value.raw()); |
| 4338 } | 4338 } |
| 4339 bool IsValidFieldOffset(intptr_t offset) const; | 4339 bool IsValidFieldOffset(intptr_t offset) const; |
| 4340 | 4340 |
| 4341 static intptr_t NextFieldOffset() { | 4341 static intptr_t NextFieldOffset() { |
| 4342 return sizeof(RawInstance); | 4342 return sizeof(RawInstance); |
| 4343 } | 4343 } |
| 4344 | 4344 |
| 4345 // TODO(iposva): Determine if this gets in the way of Smi. | 4345 // TODO(iposva): Determine if this gets in the way of Smi. |
| 4346 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); | 4346 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); |
| 4347 friend class ByteBuffer; |
| 4347 friend class Class; | 4348 friend class Class; |
| 4348 friend class Closure; | 4349 friend class Closure; |
| 4349 friend class DeferredObject; | 4350 friend class DeferredObject; |
| 4350 friend class SnapshotWriter; | 4351 friend class SnapshotWriter; |
| 4351 friend class StubCode; | 4352 friend class StubCode; |
| 4352 friend class TypedDataView; | 4353 friend class TypedDataView; |
| 4353 }; | 4354 }; |
| 4354 | 4355 |
| 4355 | 4356 |
| 4356 class LibraryPrefix : public Instance { | 4357 class LibraryPrefix : public Instance { |
| (...skipping 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6713 | 6714 |
| 6714 private: | 6715 private: |
| 6715 enum { | 6716 enum { |
| 6716 kDataOffset = 1, | 6717 kDataOffset = 1, |
| 6717 kOffsetInBytesOffset = 2, | 6718 kOffsetInBytesOffset = 2, |
| 6718 kLengthOffset = 3, | 6719 kLengthOffset = 3, |
| 6719 }; | 6720 }; |
| 6720 }; | 6721 }; |
| 6721 | 6722 |
| 6722 | 6723 |
| 6724 class ByteBuffer : public AllStatic { |
| 6725 public: |
| 6726 static RawInstance* Data(const Instance& view_obj) { |
| 6727 ASSERT(!view_obj.IsNull()); |
| 6728 return *reinterpret_cast<RawInstance**>(view_obj.raw_ptr() + kDataOffset); |
| 6729 } |
| 6730 |
| 6731 static intptr_t NumberOfFields() { |
| 6732 return kDataOffset; |
| 6733 } |
| 6734 |
| 6735 static intptr_t data_offset() { |
| 6736 return kWordSize * kDataOffset; |
| 6737 } |
| 6738 |
| 6739 private: |
| 6740 enum { |
| 6741 kDataOffset = 1, |
| 6742 }; |
| 6743 }; |
| 6744 |
| 6745 |
| 6723 class Closure : public AllStatic { | 6746 class Closure : public AllStatic { |
| 6724 public: | 6747 public: |
| 6725 static RawFunction* function(const Instance& closure) { | 6748 static RawFunction* function(const Instance& closure) { |
| 6726 return *FunctionAddr(closure); | 6749 return *FunctionAddr(closure); |
| 6727 } | 6750 } |
| 6728 static intptr_t function_offset() { | 6751 static intptr_t function_offset() { |
| 6729 return static_cast<intptr_t>(kFunctionOffset * kWordSize); | 6752 return static_cast<intptr_t>(kFunctionOffset * kWordSize); |
| 6730 } | 6753 } |
| 6731 | 6754 |
| 6732 static RawContext* context(const Instance& closure) { | 6755 static RawContext* context(const Instance& closure) { |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7217 | 7240 |
| 7218 | 7241 |
| 7219 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7242 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 7220 intptr_t index) { | 7243 intptr_t index) { |
| 7221 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7244 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 7222 } | 7245 } |
| 7223 | 7246 |
| 7224 } // namespace dart | 7247 } // namespace dart |
| 7225 | 7248 |
| 7226 #endif // VM_OBJECT_H_ | 7249 #endif // VM_OBJECT_H_ |
| OLD | NEW |