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 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2963 kTokenPosEntry = 3, // Token position in source. | 2963 kTokenPosEntry = 3, // Token position in source. |
2964 kTryIndexEntry = 4, // Try block index. | 2964 kTryIndexEntry = 4, // Try block index. |
2965 // We would potentially be adding other objects here like | 2965 // We would potentially be adding other objects here like |
2966 // pointer maps for optimized functions, local variables information etc. | 2966 // pointer maps for optimized functions, local variables information etc. |
2967 kNumberOfEntries = 5, | 2967 kNumberOfEntries = 5, |
2968 }; | 2968 }; |
2969 | 2969 |
2970 public: | 2970 public: |
2971 enum Kind { | 2971 enum Kind { |
2972 kDeopt, // Deoptimization continuation point. | 2972 kDeopt, // Deoptimization continuation point. |
2973 kEntryPatch, // Location where to patch entry. | |
2974 kPatchCode, // Buffer for patching code entry. | |
2975 kLazyDeoptJump, // Lazy deoptimization trampoline. | |
2976 kIcCall, // IC call. | 2973 kIcCall, // IC call. |
2977 kOptStaticCall, // Call directly to known target, e.g. static call. | 2974 kOptStaticCall, // Call directly to known target, e.g. static call. |
2978 kUnoptStaticCall, // Call to a known target via a stub. | 2975 kUnoptStaticCall, // Call to a known target via a stub. |
2979 kClosureCall, // Closure call. | 2976 kClosureCall, // Closure call. |
2980 kRuntimeCall, // Runtime call. | 2977 kRuntimeCall, // Runtime call. |
2981 kReturn, // Return from function. | 2978 kReturn, // Return from function. |
2982 kOsrEntry, // OSR entry point in unoptimized code. | 2979 kOsrEntry, // OSR entry point in unoptimized code. |
2983 kOther | 2980 kOther |
2984 }; | 2981 }; |
2985 | 2982 |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3646 bool optimized = false); | 3643 bool optimized = false); |
3647 static RawCode* LookupCode(uword pc); | 3644 static RawCode* LookupCode(uword pc); |
3648 static RawCode* LookupCodeInVmIsolate(uword pc); | 3645 static RawCode* LookupCodeInVmIsolate(uword pc); |
3649 static RawCode* FindCode(uword pc, int64_t timestamp); | 3646 static RawCode* FindCode(uword pc, int64_t timestamp); |
3650 | 3647 |
3651 int32_t GetPointerOffsetAt(int index) const { | 3648 int32_t GetPointerOffsetAt(int index) const { |
3652 return *PointerOffsetAddrAt(index); | 3649 return *PointerOffsetAddrAt(index); |
3653 } | 3650 } |
3654 intptr_t GetTokenIndexOfPC(uword pc) const; | 3651 intptr_t GetTokenIndexOfPC(uword pc) const; |
3655 | 3652 |
3656 // Find pc, return 0 if not found. | 3653 enum { |
| 3654 kInvalidPc = -1 |
| 3655 }; |
| 3656 |
| 3657 // Returns 0 if code is not patchable |
| 3658 uword GetEntryPatchPc() const; |
3657 uword GetPatchCodePc() const; | 3659 uword GetPatchCodePc() const; |
| 3660 |
3658 uword GetLazyDeoptPc() const; | 3661 uword GetLazyDeoptPc() const; |
3659 | 3662 |
| 3663 // Find pc, return 0 if not found. |
3660 uword GetPcForDeoptId(intptr_t deopt_id, PcDescriptors::Kind kind) const; | 3664 uword GetPcForDeoptId(intptr_t deopt_id, PcDescriptors::Kind kind) const; |
3661 intptr_t GetDeoptIdForOsr(uword pc) const; | 3665 intptr_t GetDeoptIdForOsr(uword pc) const; |
3662 | 3666 |
3663 // Returns true if there is an object in the code between 'start_offset' | 3667 // Returns true if there is an object in the code between 'start_offset' |
3664 // (inclusive) and 'end_offset' (exclusive). | 3668 // (inclusive) and 'end_offset' (exclusive). |
3665 bool ObjectExistsInArea(intptr_t start_offest, intptr_t end_offset) const; | 3669 bool ObjectExistsInArea(intptr_t start_offest, intptr_t end_offset) const; |
3666 | 3670 |
3667 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. | 3671 // Each (*node_ids)[n] has a an extracted ic data array (*arrays)[n]. |
3668 // Returns the maximum id found. | 3672 // Returns the maximum id found. |
3669 intptr_t ExtractIcDataArraysAtCalls( | 3673 intptr_t ExtractIcDataArraysAtCalls( |
3670 GrowableArray<intptr_t>* node_ids, | 3674 GrowableArray<intptr_t>* node_ids, |
3671 const GrowableObjectArray& ic_data_objs) const; | 3675 const GrowableObjectArray& ic_data_objs) const; |
3672 | 3676 |
3673 // Returns an array indexed by deopt id, containing the extracted ICData. | 3677 // Returns an array indexed by deopt id, containing the extracted ICData. |
3674 RawArray* ExtractTypeFeedbackArray() const; | 3678 RawArray* ExtractTypeFeedbackArray() const; |
3675 | 3679 |
3676 RawString* Name() const; | 3680 RawString* Name() const; |
3677 RawString* PrettyName() const; | 3681 RawString* PrettyName() const; |
3678 | 3682 |
3679 int64_t compile_timestamp() const { | 3683 int64_t compile_timestamp() const { |
3680 return raw_ptr()->compile_timestamp_; | 3684 return raw_ptr()->compile_timestamp_; |
3681 } | 3685 } |
3682 | 3686 |
| 3687 intptr_t entry_patch_pc_offset() const { |
| 3688 return raw_ptr()->entry_patch_pc_offset_; |
| 3689 } |
| 3690 void set_entry_patch_pc_offset(intptr_t pc) const { |
| 3691 raw_ptr()->entry_patch_pc_offset_ = pc; |
| 3692 } |
| 3693 |
| 3694 |
| 3695 intptr_t patch_code_pc_offset() const { |
| 3696 return raw_ptr()->patch_code_pc_offset_; |
| 3697 } |
| 3698 void set_patch_code_pc_offset(intptr_t pc) const { |
| 3699 raw_ptr()->patch_code_pc_offset_ = pc; |
| 3700 } |
| 3701 |
| 3702 |
| 3703 intptr_t lazy_deopt_pc_offset() const { |
| 3704 return raw_ptr()->lazy_deopt_pc_offset_; |
| 3705 } |
| 3706 void set_lazy_deopt_pc_offset(intptr_t pc) const { |
| 3707 raw_ptr()->lazy_deopt_pc_offset_ = pc; |
| 3708 } |
| 3709 |
3683 private: | 3710 private: |
3684 void set_state_bits(intptr_t bits) const; | 3711 void set_state_bits(intptr_t bits) const; |
3685 | 3712 |
3686 friend class RawCode; | 3713 friend class RawCode; |
3687 enum { | 3714 enum { |
3688 kOptimizedBit = 0, | 3715 kOptimizedBit = 0, |
3689 kAliveBit = 1, | 3716 kAliveBit = 1, |
3690 }; | 3717 }; |
3691 | 3718 |
3692 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {}; | 3719 class OptimizedBit : public BitField<bool, kOptimizedBit, 1> {}; |
(...skipping 3386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7079 | 7106 |
7080 | 7107 |
7081 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7108 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7082 intptr_t index) { | 7109 intptr_t index) { |
7083 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7110 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7084 } | 7111 } |
7085 | 7112 |
7086 } // namespace dart | 7113 } // namespace dart |
7087 | 7114 |
7088 #endif // VM_OBJECT_H_ | 7115 #endif // VM_OBJECT_H_ |
OLD | NEW |