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 3696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3707 friend class Class; | 3707 friend class Class; |
3708 friend class Object; | 3708 friend class Object; |
3709 friend class RawObjectPool; | 3709 friend class RawObjectPool; |
3710 }; | 3710 }; |
3711 | 3711 |
3712 | 3712 |
3713 class Instructions : public Object { | 3713 class Instructions : public Object { |
3714 public: | 3714 public: |
3715 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). | 3715 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). |
3716 | 3716 |
3717 RawCode* code() const { return raw_ptr()->code_; } | |
rmacnak
2015/09/29 16:50:12
ASSERT(!Dart::IsRunningPrecompiledCode());
Cutch
2015/09/29 23:24:29
Done.
| |
3718 | |
3717 uword EntryPoint() const { | 3719 uword EntryPoint() const { |
3718 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); | 3720 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); |
3719 } | 3721 } |
3720 | 3722 |
3721 static const intptr_t kMaxElements = (kMaxInt32 - | 3723 static const intptr_t kMaxElements = (kMaxInt32 - |
3722 (sizeof(RawInstructions) + | 3724 (sizeof(RawInstructions) + |
3723 sizeof(RawObject) + | 3725 sizeof(RawObject) + |
3724 (2 * OS::kMaxPreferredCodeAlignment))); | 3726 (2 * OS::kMaxPreferredCodeAlignment))); |
3725 | 3727 |
3726 static intptr_t InstanceSize() { | 3728 static intptr_t InstanceSize() { |
(...skipping 18 matching lines...) Expand all Loading... | |
3745 static RawInstructions* FromEntryPoint(uword entry_point) { | 3747 static RawInstructions* FromEntryPoint(uword entry_point) { |
3746 return reinterpret_cast<RawInstructions*>( | 3748 return reinterpret_cast<RawInstructions*>( |
3747 entry_point - HeaderSize() + kHeapObjectTag); | 3749 entry_point - HeaderSize() + kHeapObjectTag); |
3748 } | 3750 } |
3749 | 3751 |
3750 private: | 3752 private: |
3751 void set_size(intptr_t size) const { | 3753 void set_size(intptr_t size) const { |
3752 StoreNonPointer(&raw_ptr()->size_, size); | 3754 StoreNonPointer(&raw_ptr()->size_, size); |
3753 } | 3755 } |
3754 | 3756 |
3757 void set_code(RawCode* code) const { | |
3758 StorePointer(&raw_ptr()->code_, code); | |
3759 } | |
3760 | |
3755 // New is a private method as RawInstruction and RawCode objects should | 3761 // New is a private method as RawInstruction and RawCode objects should |
3756 // only be created using the Code::FinalizeCode method. This method creates | 3762 // only be created using the Code::FinalizeCode method. This method creates |
3757 // the RawInstruction and RawCode objects, sets up the pointer offsets | 3763 // the RawInstruction and RawCode objects, sets up the pointer offsets |
3758 // and links the two in a GC safe manner. | 3764 // and links the two in a GC safe manner. |
3759 static RawInstructions* New(intptr_t size); | 3765 static RawInstructions* New(intptr_t size); |
3760 | 3766 |
3761 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); | 3767 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); |
3762 friend class Class; | 3768 friend class Class; |
3763 friend class Code; | 3769 friend class Code; |
3764 friend class InstructionsWriter; | 3770 friend class InstructionsWriter; |
(...skipping 4358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8123 | 8129 |
8124 | 8130 |
8125 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8131 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
8126 intptr_t index) { | 8132 intptr_t index) { |
8127 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8133 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
8128 } | 8134 } |
8129 | 8135 |
8130 } // namespace dart | 8136 } // namespace dart |
8131 | 8137 |
8132 #endif // VM_OBJECT_H_ | 8138 #endif // VM_OBJECT_H_ |
OLD | NEW |