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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 // Provides non-const access to non-pointer fields within the object. Such | 677 // Provides non-const access to non-pointer fields within the object. Such |
678 // access does not need a write barrier, but it is *not* GC-safe, since the | 678 // access does not need a write barrier, but it is *not* GC-safe, since the |
679 // object might move, hence must be fully contained within a NoSafepointScope. | 679 // object might move, hence must be fully contained within a NoSafepointScope. |
680 template<typename FieldType> | 680 template<typename FieldType> |
681 FieldType* UnsafeMutableNonPointer(const FieldType* addr) const { | 681 FieldType* UnsafeMutableNonPointer(const FieldType* addr) const { |
682 // Allow pointers at the end of variable-length data, and disallow pointers | 682 // Allow pointers at the end of variable-length data, and disallow pointers |
683 // within the header word. | 683 // within the header word. |
684 ASSERT(Contains(reinterpret_cast<uword>(addr) - 1) && | 684 ASSERT(Contains(reinterpret_cast<uword>(addr) - 1) && |
685 Contains(reinterpret_cast<uword>(addr) - kWordSize)); | 685 Contains(reinterpret_cast<uword>(addr) - kWordSize)); |
686 // At least check that there is a NoSafepointScope and hope it's big enough. | 686 // At least check that there is a NoSafepointScope and hope it's big enough. |
687 ASSERT(Isolate::Current()->no_safepoint_scope_depth() > 0); | 687 ASSERT(Thread::Current()->no_safepoint_scope_depth() > 0); |
688 return const_cast<FieldType*>(addr); | 688 return const_cast<FieldType*>(addr); |
689 } | 689 } |
690 | 690 |
691 // Fail at link time if StoreNonPointer or UnsafeMutableNonPointer is | 691 // Fail at link time if StoreNonPointer or UnsafeMutableNonPointer is |
692 // instantiated with an object pointer type. | 692 // instantiated with an object pointer type. |
693 #define STORE_NON_POINTER_ILLEGAL_TYPE(type) \ | 693 #define STORE_NON_POINTER_ILLEGAL_TYPE(type) \ |
694 template<typename ValueType> \ | 694 template<typename ValueType> \ |
695 void StoreNonPointer(Raw##type* const* addr, ValueType value) const { \ | 695 void StoreNonPointer(Raw##type* const* addr, ValueType value) const { \ |
696 UnimplementedMethod(); \ | 696 UnimplementedMethod(); \ |
697 } \ | 697 } \ |
(...skipping 7308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8006 | 8006 |
8007 | 8007 |
8008 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8008 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8009 intptr_t index) { | 8009 intptr_t index) { |
8010 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8010 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8011 } | 8011 } |
8012 | 8012 |
8013 } // namespace dart | 8013 } // namespace dart |
8014 | 8014 |
8015 #endif // VM_OBJECT_H_ | 8015 #endif // VM_OBJECT_H_ |
OLD | NEW |