OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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" | 10 #include "vm/code_generator.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 RawObject* ObjectAt(intptr_t index) const { | 47 RawObject* ObjectAt(intptr_t index) const { |
48 return object_table_.At(index); | 48 return object_table_.At(index); |
49 } | 49 } |
50 | 50 |
51 intptr_t RegisterValue(Register reg) const { | 51 intptr_t RegisterValue(Register reg) const { |
52 return registers_copy_[reg]; | 52 return registers_copy_[reg]; |
53 } | 53 } |
54 | 54 |
55 double FpuRegisterValue(FpuRegister reg) const { | 55 double FpuRegisterValue(FpuRegister reg) const { |
56 return fpu_registers_copy_[reg]; | 56 return *reinterpret_cast<double*>(&fpu_registers_copy_[reg]); |
57 } | 57 } |
58 | 58 |
59 int64_t FpuRegisterValueAsInt64(FpuRegister reg) const { | 59 int64_t FpuRegisterValueAsInt64(FpuRegister reg) const { |
60 return (reinterpret_cast<int64_t*>(fpu_registers_copy_))[reg]; | 60 return *reinterpret_cast<int64_t*>(&fpu_registers_copy_[reg]); |
| 61 } |
| 62 |
| 63 simd128_value_t FpuRegisterValueAsSimd128(FpuRegister reg) const { |
| 64 const float* address = reinterpret_cast<float*>(&fpu_registers_copy_[reg]); |
| 65 return simd128_value_t().readFrom(address); |
61 } | 66 } |
62 | 67 |
63 Isolate* isolate() const { return isolate_; } | 68 Isolate* isolate() const { return isolate_; } |
64 | 69 |
65 intptr_t from_frame_size() const { return from_frame_size_; } | 70 intptr_t from_frame_size() const { return from_frame_size_; } |
66 | 71 |
67 DeoptReasonId deopt_reason() const { return deopt_reason_; } | 72 DeoptReasonId deopt_reason() const { return deopt_reason_; } |
68 | 73 |
69 private: | 74 private: |
70 const Array& object_table_; | 75 const Array& object_table_; |
71 intptr_t* to_frame_; | 76 intptr_t* to_frame_; |
72 const intptr_t to_frame_size_; | 77 const intptr_t to_frame_size_; |
73 intptr_t* from_frame_; | 78 intptr_t* from_frame_; |
74 intptr_t from_frame_size_; | 79 intptr_t from_frame_size_; |
75 intptr_t* registers_copy_; | 80 intptr_t* registers_copy_; |
76 double* fpu_registers_copy_; | 81 fpu_register_t* fpu_registers_copy_; |
77 const intptr_t num_args_; | 82 const intptr_t num_args_; |
78 const DeoptReasonId deopt_reason_; | 83 const DeoptReasonId deopt_reason_; |
79 intptr_t caller_fp_; | 84 intptr_t caller_fp_; |
80 Isolate* isolate_; | 85 Isolate* isolate_; |
81 | 86 |
82 DISALLOW_COPY_AND_ASSIGN(DeoptimizationContext); | 87 DISALLOW_COPY_AND_ASSIGN(DeoptimizationContext); |
83 }; | 88 }; |
84 | 89 |
85 | 90 |
86 | 91 |
87 // Represents one deopt instruction, e.g, setup return address, store object, | 92 // Represents one deopt instruction, e.g, setup return address, store object, |
88 // store register, etc. The target is defined by instruction's position in | 93 // store register, etc. The target is defined by instruction's position in |
89 // the deopt-info array. | 94 // the deopt-info array. |
90 class DeoptInstr : public ZoneAllocated { | 95 class DeoptInstr : public ZoneAllocated { |
91 public: | 96 public: |
92 enum Kind { | 97 enum Kind { |
93 kRetAfterAddress, | 98 kRetAfterAddress, |
94 kRetBeforeAddress, | 99 kRetBeforeAddress, |
95 kConstant, | 100 kConstant, |
96 kRegister, | 101 kRegister, |
97 kFpuRegister, | 102 kFpuRegister, |
98 kInt64FpuRegister, | 103 kInt64FpuRegister, |
| 104 kFloat32x4FpuRegister, |
| 105 kUint32x4FpuRegister, |
99 kStackSlot, | 106 kStackSlot, |
100 kDoubleStackSlot, | 107 kDoubleStackSlot, |
101 kInt64StackSlot, | 108 kInt64StackSlot, |
| 109 kFloat32x4StackSlot, |
| 110 kUint32x4StackSlot, |
102 kPcMarker, | 111 kPcMarker, |
103 kCallerFp, | 112 kCallerFp, |
104 kCallerPc, | 113 kCallerPc, |
105 kSuffix, | 114 kSuffix, |
106 }; | 115 }; |
107 | 116 |
108 static DeoptInstr* Create(intptr_t kind_as_int, intptr_t from_index); | 117 static DeoptInstr* Create(intptr_t kind_as_int, intptr_t from_index); |
109 | 118 |
110 DeoptInstr() {} | 119 DeoptInstr() {} |
111 virtual ~DeoptInstr() {} | 120 virtual ~DeoptInstr() {} |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 DeoptInfo* info, | 225 DeoptInfo* info, |
217 Smi* reason); | 226 Smi* reason); |
218 | 227 |
219 private: | 228 private: |
220 static const intptr_t kEntrySize = 3; | 229 static const intptr_t kEntrySize = 3; |
221 }; | 230 }; |
222 | 231 |
223 } // namespace dart | 232 } // namespace dart |
224 | 233 |
225 #endif // VM_DEOPT_INSTRUCTIONS_H_ | 234 #endif // VM_DEOPT_INSTRUCTIONS_H_ |
OLD | NEW |