| 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 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3816 static intptr_t HeaderSize() { | 3816 static intptr_t HeaderSize() { |
| 3817 intptr_t alignment = OS::PreferredCodeAlignment(); | 3817 intptr_t alignment = OS::PreferredCodeAlignment(); |
| 3818 return Utils::RoundUp(sizeof(RawInstructions), alignment); | 3818 return Utils::RoundUp(sizeof(RawInstructions), alignment); |
| 3819 } | 3819 } |
| 3820 | 3820 |
| 3821 static RawInstructions* FromEntryPoint(uword entry_point) { | 3821 static RawInstructions* FromEntryPoint(uword entry_point) { |
| 3822 return reinterpret_cast<RawInstructions*>( | 3822 return reinterpret_cast<RawInstructions*>( |
| 3823 entry_point - HeaderSize() + kHeapObjectTag); | 3823 entry_point - HeaderSize() + kHeapObjectTag); |
| 3824 } | 3824 } |
| 3825 | 3825 |
| 3826 bool Equals(const Instructions& other) const { |
| 3827 if (size() != other.size()) { |
| 3828 return false; |
| 3829 } |
| 3830 NoSafepointScope no_safepoint; |
| 3831 return memcmp(raw_ptr(), other.raw_ptr(), InstanceSize(size())) == 0; |
| 3832 } |
| 3833 |
| 3826 private: | 3834 private: |
| 3827 void set_size(intptr_t size) const { | 3835 void set_size(intptr_t size) const { |
| 3828 StoreNonPointer(&raw_ptr()->size_, size); | 3836 StoreNonPointer(&raw_ptr()->size_, size); |
| 3829 } | 3837 } |
| 3830 | 3838 |
| 3831 // New is a private method as RawInstruction and RawCode objects should | 3839 // New is a private method as RawInstruction and RawCode objects should |
| 3832 // only be created using the Code::FinalizeCode method. This method creates | 3840 // only be created using the Code::FinalizeCode method. This method creates |
| 3833 // the RawInstruction and RawCode objects, sets up the pointer offsets | 3841 // the RawInstruction and RawCode objects, sets up the pointer offsets |
| 3834 // and links the two in a GC safe manner. | 3842 // and links the two in a GC safe manner. |
| 3835 static RawInstructions* New(intptr_t size); | 3843 static RawInstructions* New(intptr_t size); |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4599 // New is a private method as RawInstruction and RawCode objects should | 4607 // New is a private method as RawInstruction and RawCode objects should |
| 4600 // only be created using the Code::FinalizeCode method. This method creates | 4608 // only be created using the Code::FinalizeCode method. This method creates |
| 4601 // the RawInstruction and RawCode objects, sets up the pointer offsets | 4609 // the RawInstruction and RawCode objects, sets up the pointer offsets |
| 4602 // and links the two in a GC safe manner. | 4610 // and links the two in a GC safe manner. |
| 4603 static RawCode* New(intptr_t pointer_offsets_length); | 4611 static RawCode* New(intptr_t pointer_offsets_length); |
| 4604 | 4612 |
| 4605 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); | 4613 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); |
| 4606 friend class Class; | 4614 friend class Class; |
| 4607 friend class SnapshotWriter; | 4615 friend class SnapshotWriter; |
| 4608 friend class CodePatcher; // for set_instructions | 4616 friend class CodePatcher; // for set_instructions |
| 4617 friend class Precompiler; // for set_instructions |
| 4609 // So that the RawFunction pointer visitor can determine whether code the | 4618 // So that the RawFunction pointer visitor can determine whether code the |
| 4610 // function points to is optimized. | 4619 // function points to is optimized. |
| 4611 friend class RawFunction; | 4620 friend class RawFunction; |
| 4612 }; | 4621 }; |
| 4613 | 4622 |
| 4614 | 4623 |
| 4615 class Context : public Object { | 4624 class Context : public Object { |
| 4616 public: | 4625 public: |
| 4617 RawContext* parent() const { return raw_ptr()->parent_; } | 4626 RawContext* parent() const { return raw_ptr()->parent_; } |
| 4618 void set_parent(const Context& parent) const { | 4627 void set_parent(const Context& parent) const { |
| (...skipping 3780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8399 | 8408 |
| 8400 | 8409 |
| 8401 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8410 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 8402 intptr_t index) { | 8411 intptr_t index) { |
| 8403 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8412 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 8404 } | 8413 } |
| 8405 | 8414 |
| 8406 } // namespace dart | 8415 } // namespace dart |
| 8407 | 8416 |
| 8408 #endif // VM_OBJECT_H_ | 8417 #endif // VM_OBJECT_H_ |
| OLD | NEW |