| 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/code_generator.h" | |
| 11 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| 12 #include "vm/object.h" | 11 #include "vm/object.h" |
| 13 | 12 |
| 14 namespace dart { | 13 namespace dart { |
| 15 | 14 |
| 16 class Location; | 15 class Location; |
| 17 class Value; | 16 class Value; |
| 18 | 17 |
| 19 // Holds all data relevant for execution of deoptimization instructions. | 18 // Holds all data relevant for execution of deoptimization instructions. |
| 20 class DeoptimizationContext : public ValueObject { | 19 class DeoptimizationContext : public ValueObject { |
| 21 public: | 20 public: |
| 22 // 'to_frame_start' points to the return address just below the frame's | 21 // 'to_frame_start' points to the return address just below the frame's |
| 23 // stack pointer. 'num_args' is 0 if there are no arguments or if there | 22 // stack pointer. 'num_args' is 0 if there are no arguments or if there |
| 24 // are optional arguments. | 23 // are optional arguments. |
| 25 DeoptimizationContext(intptr_t* to_frame_start, | 24 DeoptimizationContext(intptr_t* to_frame_start, |
| 26 intptr_t to_frame_size, | 25 intptr_t to_frame_size, |
| 27 const Array& object_table, | 26 const Array& object_table, |
| 28 intptr_t num_args, | 27 intptr_t num_args); |
| 29 DeoptReasonId deopt_reason); | |
| 30 | 28 |
| 31 intptr_t* GetFromFrameAddressAt(intptr_t index) const { | 29 intptr_t* GetFromFrameAddressAt(intptr_t index) const { |
| 32 ASSERT((0 <= index) && (index < from_frame_size_)); | 30 ASSERT((0 <= index) && (index < from_frame_size_)); |
| 33 return &from_frame_[index]; | 31 return &from_frame_[index]; |
| 34 } | 32 } |
| 35 | 33 |
| 36 intptr_t* GetToFrameAddressAt(intptr_t index) const { | 34 intptr_t* GetToFrameAddressAt(intptr_t index) const { |
| 37 ASSERT((0 <= index) && (index < to_frame_size_)); | 35 ASSERT((0 <= index) && (index < to_frame_size_)); |
| 38 return &to_frame_[index]; | 36 return &to_frame_[index]; |
| 39 } | 37 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 57 } | 55 } |
| 58 | 56 |
| 59 int64_t XmmRegisterValueAsInt64(XmmRegister reg) const { | 57 int64_t XmmRegisterValueAsInt64(XmmRegister reg) const { |
| 60 return (reinterpret_cast<int64_t*>(xmm_registers_copy_))[reg]; | 58 return (reinterpret_cast<int64_t*>(xmm_registers_copy_))[reg]; |
| 61 } | 59 } |
| 62 | 60 |
| 63 Isolate* isolate() const { return isolate_; } | 61 Isolate* isolate() const { return isolate_; } |
| 64 | 62 |
| 65 intptr_t from_frame_size() const { return from_frame_size_; } | 63 intptr_t from_frame_size() const { return from_frame_size_; } |
| 66 | 64 |
| 67 DeoptReasonId deopt_reason() const { return deopt_reason_; } | |
| 68 | |
| 69 private: | 65 private: |
| 70 const Array& object_table_; | 66 const Array& object_table_; |
| 71 intptr_t* to_frame_; | 67 intptr_t* to_frame_; |
| 72 const intptr_t to_frame_size_; | 68 const intptr_t to_frame_size_; |
| 73 intptr_t* from_frame_; | 69 intptr_t* from_frame_; |
| 74 intptr_t from_frame_size_; | 70 intptr_t from_frame_size_; |
| 75 intptr_t* registers_copy_; | 71 intptr_t* registers_copy_; |
| 76 double* xmm_registers_copy_; | 72 double* xmm_registers_copy_; |
| 77 const intptr_t num_args_; | 73 const intptr_t num_args_; |
| 78 const DeoptReasonId deopt_reason_; | |
| 79 intptr_t caller_fp_; | 74 intptr_t caller_fp_; |
| 80 Isolate* isolate_; | 75 Isolate* isolate_; |
| 81 | 76 |
| 82 DISALLOW_COPY_AND_ASSIGN(DeoptimizationContext); | 77 DISALLOW_COPY_AND_ASSIGN(DeoptimizationContext); |
| 83 }; | 78 }; |
| 84 | 79 |
| 85 | 80 |
| 86 | 81 |
| 87 // Represents one deopt instruction, e.g, setup return address, store object, | 82 // Represents one deopt instruction, e.g, setup return address, store object, |
| 88 // store register, etc. The target is defined by instruction's position in | 83 // store register, etc. The target is defined by instruction's position in |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 DeoptInfo* info, | 206 DeoptInfo* info, |
| 212 Smi* reason); | 207 Smi* reason); |
| 213 | 208 |
| 214 private: | 209 private: |
| 215 static const intptr_t kEntrySize = 3; | 210 static const intptr_t kEntrySize = 3; |
| 216 }; | 211 }; |
| 217 | 212 |
| 218 } // namespace dart | 213 } // namespace dart |
| 219 | 214 |
| 220 #endif // VM_DEOPT_INSTRUCTIONS_H_ | 215 #endif // VM_DEOPT_INSTRUCTIONS_H_ |
| OLD | NEW |