| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 ASSERT(reg < kNumberOfFpuRegisters); | 78 ASSERT(reg < kNumberOfFpuRegisters); |
| 79 const float* address = reinterpret_cast<float*>(&fpu_registers_[reg]); | 79 const float* address = reinterpret_cast<float*>(&fpu_registers_[reg]); |
| 80 return simd128_value_t().readFrom(address); | 80 return simd128_value_t().readFrom(address); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void set_dest_frame(intptr_t* dest_frame) { | 83 void set_dest_frame(intptr_t* dest_frame) { |
| 84 ASSERT(dest_frame != NULL && dest_frame_ == NULL); | 84 ASSERT(dest_frame != NULL && dest_frame_ == NULL); |
| 85 dest_frame_ = dest_frame; | 85 dest_frame_ = dest_frame; |
| 86 } | 86 } |
| 87 | 87 |
| 88 Thread* thread() const { return thread_; } |
| 88 Zone* zone() const { return thread_->zone(); } | 89 Zone* zone() const { return thread_->zone(); } |
| 89 | 90 |
| 90 intptr_t source_frame_size() const { return source_frame_size_; } | 91 intptr_t source_frame_size() const { return source_frame_size_; } |
| 91 intptr_t dest_frame_size() const { return dest_frame_size_; } | 92 intptr_t dest_frame_size() const { return dest_frame_size_; } |
| 92 | 93 |
| 93 RawCode* code() const { return code_; } | 94 RawCode* code() const { return code_; } |
| 94 | 95 |
| 95 ICData::DeoptReasonId deopt_reason() const { return deopt_reason_; } | 96 ICData::DeoptReasonId deopt_reason() const { return deopt_reason_; } |
| 96 bool HasDeoptFlag(ICData::DeoptFlags flag) { | 97 bool HasDeoptFlag(ICData::DeoptFlags flag) { |
| 97 return (deopt_flags_ & flag) != 0; | 98 return (deopt_flags_ & flag) != 0; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 deferred_slots_); | 147 deferred_slots_); |
| 147 } | 148 } |
| 148 | 149 |
| 149 void DeferMaterialization(simd128_value_t value, RawInt32x4** slot) { | 150 void DeferMaterialization(simd128_value_t value, RawInt32x4** slot) { |
| 150 deferred_slots_ = new DeferredInt32x4( | 151 deferred_slots_ = new DeferredInt32x4( |
| 151 value, | 152 value, |
| 152 reinterpret_cast<RawObject**>(slot), | 153 reinterpret_cast<RawObject**>(slot), |
| 153 deferred_slots_); | 154 deferred_slots_); |
| 154 } | 155 } |
| 155 | 156 |
| 157 void DeferRetAddrMaterialization(intptr_t index, |
| 158 intptr_t deopt_id, |
| 159 intptr_t* slot) { |
| 160 deferred_slots_ = new DeferredRetAddr( |
| 161 index, |
| 162 deopt_id, |
| 163 reinterpret_cast<RawObject**>(slot), |
| 164 deferred_slots_); |
| 165 } |
| 166 |
| 167 void DeferPcMarkerMaterialization(intptr_t index, intptr_t* slot) { |
| 168 deferred_slots_ = new DeferredPcMarker( |
| 169 index, |
| 170 reinterpret_cast<RawObject**>(slot), |
| 171 deferred_slots_); |
| 172 } |
| 173 |
| 174 void DeferPpMaterialization(intptr_t index, RawObject** slot) { |
| 175 deferred_slots_ = new DeferredPp(index, slot, deferred_slots_); |
| 176 } |
| 177 |
| 156 DeferredObject* GetDeferredObject(intptr_t idx) const { | 178 DeferredObject* GetDeferredObject(intptr_t idx) const { |
| 157 return deferred_objects_[idx]; | 179 return deferred_objects_[idx]; |
| 158 } | 180 } |
| 159 | 181 |
| 160 private: | 182 private: |
| 161 intptr_t* GetDestFrameAddressAt(intptr_t index) const { | 183 intptr_t* GetDestFrameAddressAt(intptr_t index) const { |
| 162 ASSERT(dest_frame_ != NULL); | 184 ASSERT(dest_frame_ != NULL); |
| 163 ASSERT((0 <= index) && (index < dest_frame_size_)); | 185 ASSERT((0 <= index) && (index < dest_frame_size_)); |
| 164 return &dest_frame_[index]; | 186 return &dest_frame_[index]; |
| 165 } | 187 } |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 // the heap and reset the builder's internal state for the next DeoptInfo. | 424 // the heap and reset the builder's internal state for the next DeoptInfo. |
| 403 class DeoptInfoBuilder : public ValueObject { | 425 class DeoptInfoBuilder : public ValueObject { |
| 404 public: | 426 public: |
| 405 DeoptInfoBuilder(Zone* zone, const intptr_t num_args); | 427 DeoptInfoBuilder(Zone* zone, const intptr_t num_args); |
| 406 | 428 |
| 407 // 'object_table' holds all objects referred to by DeoptInstr in | 429 // 'object_table' holds all objects referred to by DeoptInstr in |
| 408 // all DeoptInfo instances for a single Code object. | 430 // all DeoptInfo instances for a single Code object. |
| 409 const GrowableObjectArray& object_table() { return object_table_; } | 431 const GrowableObjectArray& object_table() { return object_table_; } |
| 410 | 432 |
| 411 // Return address before instruction. | 433 // Return address before instruction. |
| 412 void AddReturnAddress(const Code& code, | 434 void AddReturnAddress(const Function& function, |
| 413 intptr_t deopt_id, | 435 intptr_t deopt_id, |
| 414 intptr_t dest_index); | 436 intptr_t dest_index); |
| 415 | 437 |
| 416 // Copy from optimized frame to unoptimized. | 438 // Copy from optimized frame to unoptimized. |
| 417 void AddCopy(Value* value, const Location& source_loc, intptr_t dest_index); | 439 void AddCopy(Value* value, const Location& source_loc, intptr_t dest_index); |
| 418 void AddPcMarker(const Code& code, intptr_t dest_index); | 440 void AddPcMarker(const Function& function, intptr_t dest_index); |
| 419 void AddPp(const Code& code, intptr_t dest_index); | 441 void AddPp(const Function& function, intptr_t dest_index); |
| 420 void AddCallerFp(intptr_t dest_index); | 442 void AddCallerFp(intptr_t dest_index); |
| 421 void AddCallerPp(intptr_t dest_index); | 443 void AddCallerPp(intptr_t dest_index); |
| 422 void AddCallerPc(intptr_t dest_index); | 444 void AddCallerPc(intptr_t dest_index); |
| 423 | 445 |
| 424 // Add object to be materialized. Emit kMaterializeObject instruction. | 446 // Add object to be materialized. Emit kMaterializeObject instruction. |
| 425 void AddMaterialization(MaterializeObjectInstr* mat); | 447 void AddMaterialization(MaterializeObjectInstr* mat); |
| 426 | 448 |
| 427 // For every materialized object emit instructions describing data required | 449 // For every materialized object emit instructions describing data required |
| 428 // for materialization: class of the instance to allocate and field-value | 450 // for materialization: class of the instance to allocate and field-value |
| 429 // pairs for initialization. | 451 // pairs for initialization. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 class ReasonField : public BitField<ICData::DeoptReasonId, 0, 8> { }; | 540 class ReasonField : public BitField<ICData::DeoptReasonId, 0, 8> { }; |
| 519 class FlagsField : public BitField<uint32_t, 8, 8> { }; | 541 class FlagsField : public BitField<uint32_t, 8, 8> { }; |
| 520 | 542 |
| 521 private: | 543 private: |
| 522 static const intptr_t kEntrySize = 3; | 544 static const intptr_t kEntrySize = 3; |
| 523 }; | 545 }; |
| 524 | 546 |
| 525 } // namespace dart | 547 } // namespace dart |
| 526 | 548 |
| 527 #endif // VM_DEOPT_INSTRUCTIONS_H_ | 549 #endif // VM_DEOPT_INSTRUCTIONS_H_ |
| OLD | NEW |