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_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 3563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3574 public: | 3574 public: |
3575 StoreInstanceFieldInstr(const Field& field, | 3575 StoreInstanceFieldInstr(const Field& field, |
3576 Value* instance, | 3576 Value* instance, |
3577 Value* value, | 3577 Value* value, |
3578 StoreBarrierType emit_store_barrier, | 3578 StoreBarrierType emit_store_barrier, |
3579 TokenPosition token_pos) | 3579 TokenPosition token_pos) |
3580 : field_(field), | 3580 : field_(field), |
3581 offset_in_bytes_(field.Offset()), | 3581 offset_in_bytes_(field.Offset()), |
3582 emit_store_barrier_(emit_store_barrier), | 3582 emit_store_barrier_(emit_store_barrier), |
3583 token_pos_(token_pos), | 3583 token_pos_(token_pos), |
3584 is_potential_unboxed_initialization_(false), | 3584 is_initialization_(false) { |
3585 is_object_reference_initialization_(false) { | |
3586 SetInputAt(kInstancePos, instance); | 3585 SetInputAt(kInstancePos, instance); |
3587 SetInputAt(kValuePos, value); | 3586 SetInputAt(kValuePos, value); |
3588 CheckField(field); | 3587 CheckField(field); |
3589 } | 3588 } |
3590 | 3589 |
3591 StoreInstanceFieldInstr(intptr_t offset_in_bytes, | 3590 StoreInstanceFieldInstr(intptr_t offset_in_bytes, |
3592 Value* instance, | 3591 Value* instance, |
3593 Value* value, | 3592 Value* value, |
3594 StoreBarrierType emit_store_barrier, | 3593 StoreBarrierType emit_store_barrier, |
3595 TokenPosition token_pos) | 3594 TokenPosition token_pos) |
3596 : field_(Field::ZoneHandle()), | 3595 : field_(Field::ZoneHandle()), |
3597 offset_in_bytes_(offset_in_bytes), | 3596 offset_in_bytes_(offset_in_bytes), |
3598 emit_store_barrier_(emit_store_barrier), | 3597 emit_store_barrier_(emit_store_barrier), |
3599 token_pos_(token_pos), | 3598 token_pos_(token_pos), |
3600 is_potential_unboxed_initialization_(false), | 3599 is_initialization_(false) { |
3601 is_object_reference_initialization_(false) { | |
3602 SetInputAt(kInstancePos, instance); | 3600 SetInputAt(kInstancePos, instance); |
3603 SetInputAt(kValuePos, value); | 3601 SetInputAt(kValuePos, value); |
3604 } | 3602 } |
3605 | 3603 |
3606 DECLARE_INSTRUCTION(StoreInstanceField) | 3604 DECLARE_INSTRUCTION(StoreInstanceField) |
3607 | 3605 |
3608 void set_is_potential_unboxed_initialization(bool value) { | 3606 void set_is_initialization(bool value) { is_initialization_ = value; } |
3609 is_potential_unboxed_initialization_ = value; | |
3610 } | |
3611 void set_is_object_reference_initialization(bool value) { | |
3612 is_object_reference_initialization_ = value; | |
3613 } | |
3614 | 3607 |
3615 enum { | 3608 enum { |
3616 kInstancePos = 0, | 3609 kInstancePos = 0, |
3617 kValuePos = 1 | 3610 kValuePos = 1 |
3618 }; | 3611 }; |
3619 | 3612 |
3620 Value* instance() const { return inputs_[kInstancePos]; } | 3613 Value* instance() const { return inputs_[kInstancePos]; } |
3621 Value* value() const { return inputs_[kValuePos]; } | 3614 Value* value() const { return inputs_[kValuePos]; } |
3622 bool is_potential_unboxed_initialization() const { | 3615 bool is_initialization() const { return is_initialization_; } |
3623 return is_potential_unboxed_initialization_; | 3616 |
3624 } | |
3625 bool is_object_reference_initialization() const { | |
3626 return is_object_reference_initialization_; | |
3627 } | |
3628 virtual TokenPosition token_pos() const { return token_pos_; } | 3617 virtual TokenPosition token_pos() const { return token_pos_; } |
3629 | 3618 |
3630 const Field& field() const { return field_; } | 3619 const Field& field() const { return field_; } |
3631 intptr_t offset_in_bytes() const { return offset_in_bytes_; } | 3620 intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
3632 | 3621 |
3633 bool ShouldEmitStoreBarrier() const { | 3622 bool ShouldEmitStoreBarrier() const { |
3634 return value()->NeedsStoreBuffer() | 3623 return value()->NeedsStoreBuffer() |
3635 && (emit_store_barrier_ == kEmitStoreBarrier); | 3624 && (emit_store_barrier_ == kEmitStoreBarrier); |
3636 } | 3625 } |
3637 | 3626 |
(...skipping 24 matching lines...) Expand all Loading... |
3662 const intptr_t cid = value()->Type()->ToNullableCid(); | 3651 const intptr_t cid = value()->Type()->ToNullableCid(); |
3663 // Write barrier is skipped for nullable and non-nullable smis. | 3652 // Write barrier is skipped for nullable and non-nullable smis. |
3664 ASSERT(cid != kSmiCid); | 3653 ASSERT(cid != kSmiCid); |
3665 return (cid == kDynamicCid); | 3654 return (cid == kDynamicCid); |
3666 } | 3655 } |
3667 | 3656 |
3668 const Field& field_; | 3657 const Field& field_; |
3669 intptr_t offset_in_bytes_; | 3658 intptr_t offset_in_bytes_; |
3670 const StoreBarrierType emit_store_barrier_; | 3659 const StoreBarrierType emit_store_barrier_; |
3671 const TokenPosition token_pos_; | 3660 const TokenPosition token_pos_; |
3672 // This may be the first store to an unboxed field. | 3661 // Marks initialiing stores. E.g. in the constructor. |
3673 bool is_potential_unboxed_initialization_; | 3662 bool is_initialization_; |
3674 // True if this store initializes an object reference field of an object that | |
3675 // was allocated uninitialized; see AllocateUninitializedContext. | |
3676 bool is_object_reference_initialization_; | |
3677 | 3663 |
3678 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); | 3664 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); |
3679 }; | 3665 }; |
3680 | 3666 |
3681 | 3667 |
3682 class GuardFieldInstr : public TemplateInstruction<1, NoThrow, Pure> { | 3668 class GuardFieldInstr : public TemplateInstruction<1, NoThrow, Pure> { |
3683 public: | 3669 public: |
3684 GuardFieldInstr(Value* value, | 3670 GuardFieldInstr(Value* value, |
3685 const Field& field, | 3671 const Field& field, |
3686 intptr_t deopt_id) | 3672 intptr_t deopt_id) |
(...skipping 4608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8295 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8281 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
8296 UNIMPLEMENTED(); \ | 8282 UNIMPLEMENTED(); \ |
8297 return NULL; \ | 8283 return NULL; \ |
8298 } \ | 8284 } \ |
8299 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8285 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8300 | 8286 |
8301 | 8287 |
8302 } // namespace dart | 8288 } // namespace dart |
8303 | 8289 |
8304 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8290 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |