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 3407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3418 public: | 3418 public: |
3419 StoreInstanceFieldInstr(const Field& field, | 3419 StoreInstanceFieldInstr(const Field& field, |
3420 Value* instance, | 3420 Value* instance, |
3421 Value* value, | 3421 Value* value, |
3422 StoreBarrierType emit_store_barrier, | 3422 StoreBarrierType emit_store_barrier, |
3423 intptr_t token_pos) | 3423 intptr_t token_pos) |
3424 : field_(field), | 3424 : field_(field), |
3425 offset_in_bytes_(field.Offset()), | 3425 offset_in_bytes_(field.Offset()), |
3426 emit_store_barrier_(emit_store_barrier), | 3426 emit_store_barrier_(emit_store_barrier), |
3427 token_pos_(token_pos), | 3427 token_pos_(token_pos), |
3428 is_initialization_(false) { | 3428 is_potential_unboxed_initialization_(false), |
| 3429 is_object_reference_initialization_(false) { |
3429 SetInputAt(kInstancePos, instance); | 3430 SetInputAt(kInstancePos, instance); |
3430 SetInputAt(kValuePos, value); | 3431 SetInputAt(kValuePos, value); |
3431 } | 3432 } |
3432 | 3433 |
3433 StoreInstanceFieldInstr(intptr_t offset_in_bytes, | 3434 StoreInstanceFieldInstr(intptr_t offset_in_bytes, |
3434 Value* instance, | 3435 Value* instance, |
3435 Value* value, | 3436 Value* value, |
3436 StoreBarrierType emit_store_barrier, | 3437 StoreBarrierType emit_store_barrier, |
3437 intptr_t token_pos) | 3438 intptr_t token_pos) |
3438 : field_(Field::Handle()), | 3439 : field_(Field::Handle()), |
3439 offset_in_bytes_(offset_in_bytes), | 3440 offset_in_bytes_(offset_in_bytes), |
3440 emit_store_barrier_(emit_store_barrier), | 3441 emit_store_barrier_(emit_store_barrier), |
3441 token_pos_(token_pos), | 3442 token_pos_(token_pos), |
3442 is_initialization_(false) { | 3443 is_potential_unboxed_initialization_(false), |
| 3444 is_object_reference_initialization_(false) { |
3443 SetInputAt(kInstancePos, instance); | 3445 SetInputAt(kInstancePos, instance); |
3444 SetInputAt(kValuePos, value); | 3446 SetInputAt(kValuePos, value); |
3445 } | 3447 } |
3446 | 3448 |
3447 DECLARE_INSTRUCTION(StoreInstanceField) | 3449 DECLARE_INSTRUCTION(StoreInstanceField) |
3448 | 3450 |
3449 void set_is_initialization(bool value) { is_initialization_ = value; } | 3451 void set_is_potential_unboxed_initialization(bool value) { |
| 3452 is_potential_unboxed_initialization_ = value; |
| 3453 } |
| 3454 void set_is_object_reference_initialization(bool value) { |
| 3455 is_object_reference_initialization_ = value; |
| 3456 } |
3450 | 3457 |
3451 enum { | 3458 enum { |
3452 kInstancePos = 0, | 3459 kInstancePos = 0, |
3453 kValuePos = 1 | 3460 kValuePos = 1 |
3454 }; | 3461 }; |
3455 | 3462 |
3456 Value* instance() const { return inputs_[kInstancePos]; } | 3463 Value* instance() const { return inputs_[kInstancePos]; } |
3457 Value* value() const { return inputs_[kValuePos]; } | 3464 Value* value() const { return inputs_[kValuePos]; } |
3458 bool is_initialization() const { return is_initialization_; } | 3465 bool is_potential_unboxed_initialization() const { |
| 3466 return is_potential_unboxed_initialization_; |
| 3467 } |
| 3468 bool is_object_reference_initialization() const { |
| 3469 return is_object_reference_initialization_; |
| 3470 } |
3459 virtual intptr_t token_pos() const { return token_pos_; } | 3471 virtual intptr_t token_pos() const { return token_pos_; } |
3460 | 3472 |
3461 const Field& field() const { return field_; } | 3473 const Field& field() const { return field_; } |
3462 intptr_t offset_in_bytes() const { return offset_in_bytes_; } | 3474 intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
3463 | 3475 |
3464 bool ShouldEmitStoreBarrier() const { | 3476 bool ShouldEmitStoreBarrier() const { |
3465 return value()->NeedsStoreBuffer() | 3477 return value()->NeedsStoreBuffer() |
3466 && (emit_store_barrier_ == kEmitStoreBarrier); | 3478 && (emit_store_barrier_ == kEmitStoreBarrier); |
3467 } | 3479 } |
3468 | 3480 |
(...skipping 24 matching lines...) Expand all Loading... |
3493 const intptr_t cid = value()->Type()->ToNullableCid(); | 3505 const intptr_t cid = value()->Type()->ToNullableCid(); |
3494 // Write barrier is skipped for nullable and non-nullable smis. | 3506 // Write barrier is skipped for nullable and non-nullable smis. |
3495 ASSERT(cid != kSmiCid); | 3507 ASSERT(cid != kSmiCid); |
3496 return (cid == kDynamicCid); | 3508 return (cid == kDynamicCid); |
3497 } | 3509 } |
3498 | 3510 |
3499 const Field& field_; | 3511 const Field& field_; |
3500 intptr_t offset_in_bytes_; | 3512 intptr_t offset_in_bytes_; |
3501 const StoreBarrierType emit_store_barrier_; | 3513 const StoreBarrierType emit_store_barrier_; |
3502 const intptr_t token_pos_; | 3514 const intptr_t token_pos_; |
3503 bool is_initialization_; // Marks stores in the constructor. | 3515 // This may be the first store to an unboxed field. |
| 3516 bool is_potential_unboxed_initialization_; |
| 3517 // True if this store initializes an object reference field of an object that |
| 3518 // was allocated uninitialized; see AllocateUninitializedContext. |
| 3519 bool is_object_reference_initialization_; |
3504 | 3520 |
3505 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); | 3521 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); |
3506 }; | 3522 }; |
3507 | 3523 |
3508 | 3524 |
3509 class GuardFieldInstr : public TemplateInstruction<1, NoThrow, Pure> { | 3525 class GuardFieldInstr : public TemplateInstruction<1, NoThrow, Pure> { |
3510 public: | 3526 public: |
3511 GuardFieldInstr(Value* value, | 3527 GuardFieldInstr(Value* value, |
3512 const Field& field, | 3528 const Field& field, |
3513 intptr_t deopt_id) | 3529 intptr_t deopt_id) |
(...skipping 4501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8015 Isolate* isolate, bool opt) const { \ | 8031 Isolate* isolate, bool opt) const { \ |
8016 UNIMPLEMENTED(); \ | 8032 UNIMPLEMENTED(); \ |
8017 return NULL; \ | 8033 return NULL; \ |
8018 } \ | 8034 } \ |
8019 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8035 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8020 | 8036 |
8021 | 8037 |
8022 } // namespace dart | 8038 } // namespace dart |
8023 | 8039 |
8024 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8040 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |