| 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_DEOPT_INSTRUCTIONS_H_ | 5 #ifndef VM_DEOPT_INSTRUCTIONS_H_ |
| 6 #define VM_DEOPT_INSTRUCTIONS_H_ | 6 #define VM_DEOPT_INSTRUCTIONS_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 DeoptInstr() {} | 81 DeoptInstr() {} |
| 82 virtual ~DeoptInstr() {} | 82 virtual ~DeoptInstr() {} |
| 83 | 83 |
| 84 virtual const char* ToCString() const = 0; | 84 virtual const char* ToCString() const = 0; |
| 85 | 85 |
| 86 virtual void Execute(DeoptimizationContext* deopt_context, | 86 virtual void Execute(DeoptimizationContext* deopt_context, |
| 87 intptr_t to_index) = 0; | 87 intptr_t to_index) = 0; |
| 88 | 88 |
| 89 protected: | 89 protected: |
| 90 enum Kind { | 90 enum Kind { |
| 91 kSetRetAddress, | 91 kSetRetAfterAddress, |
| 92 kSetRetBeforeAddress, |
| 92 kCopyConstant, | 93 kCopyConstant, |
| 93 kCopyRegister, | 94 kCopyRegister, |
| 94 kCopyXmmRegister, | 95 kCopyXmmRegister, |
| 95 kCopyStackSlot, | 96 kCopyStackSlot, |
| 96 kCopyDoubleStackSlot, | 97 kCopyDoubleStackSlot, |
| 97 kSetPcMarker, | 98 kSetPcMarker, |
| 98 kSetCallerFp, | 99 kSetCallerFp, |
| 99 kSetCallerPc, | 100 kSetCallerPc, |
| 100 }; | 101 }; |
| 101 | 102 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 116 class DeoptInfoBuilder : public ValueObject { | 117 class DeoptInfoBuilder : public ValueObject { |
| 117 public: | 118 public: |
| 118 // 'object_table' holds all objects referred to by DeoptInstr in | 119 // 'object_table' holds all objects referred to by DeoptInstr in |
| 119 // all DeoptInfo instances for a single Code object. | 120 // all DeoptInfo instances for a single Code object. |
| 120 DeoptInfoBuilder(const GrowableObjectArray& object_table, | 121 DeoptInfoBuilder(const GrowableObjectArray& object_table, |
| 121 const intptr_t num_args) | 122 const intptr_t num_args) |
| 122 : instructions_(), | 123 : instructions_(), |
| 123 object_table_(object_table), | 124 object_table_(object_table), |
| 124 num_args_(num_args) {} | 125 num_args_(num_args) {} |
| 125 | 126 |
| 126 // Will be neeeded for inlined functions, currently trivial. | 127 // Return address before instruction. |
| 127 void AddReturnAddress(const Function& function, | 128 void AddReturnAddressBefore(const Function& function, |
| 128 intptr_t deopt_id, | 129 intptr_t deopt_id, |
| 129 intptr_t to_index); | 130 intptr_t to_index); |
| 131 |
| 132 // Return address after instruction. |
| 133 void AddReturnAddressAfter(const Function& function, |
| 134 intptr_t deopt_id, |
| 135 intptr_t to_index); |
| 136 |
| 130 // Copy from optimized frame to unoptimized. | 137 // Copy from optimized frame to unoptimized. |
| 131 void AddCopy(const Location& from_loc, | 138 void AddCopy(const Location& from_loc, |
| 132 const Value& from_value, | 139 const Value& from_value, |
| 133 intptr_t to_index); | 140 intptr_t to_index); |
| 134 void AddPcMarker(const Function& function, intptr_t to_index); | 141 void AddPcMarker(const Function& function, intptr_t to_index); |
| 135 void AddCallerFp(intptr_t to_index); | 142 void AddCallerFp(intptr_t to_index); |
| 136 void AddCallerPc(intptr_t to_index); | 143 void AddCallerPc(intptr_t to_index); |
| 137 | 144 |
| 138 RawDeoptInfo* CreateDeoptInfo() const; | 145 RawDeoptInfo* CreateDeoptInfo() const; |
| 139 | 146 |
| 140 private: | 147 private: |
| 141 intptr_t FindOrAddObjectInTable(const Object& obj) const; | 148 intptr_t FindOrAddObjectInTable(const Object& obj) const; |
| 142 | 149 |
| 143 GrowableArray<DeoptInstr*> instructions_; | 150 GrowableArray<DeoptInstr*> instructions_; |
| 144 const GrowableObjectArray& object_table_; | 151 const GrowableObjectArray& object_table_; |
| 145 const intptr_t num_args_; | 152 const intptr_t num_args_; |
| 146 | 153 |
| 147 DISALLOW_COPY_AND_ASSIGN(DeoptInfoBuilder); | 154 DISALLOW_COPY_AND_ASSIGN(DeoptInfoBuilder); |
| 148 }; | 155 }; |
| 149 | 156 |
| 150 } // namespace dart | 157 } // namespace dart |
| 151 | 158 |
| 152 #endif // VM_DEOPT_INSTRUCTIONS_H_ | 159 #endif // VM_DEOPT_INSTRUCTIONS_H_ |
| OLD | NEW |