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_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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 M(CheckSmi) \ | 252 M(CheckSmi) \ |
253 M(Constant) \ | 253 M(Constant) \ |
254 M(CheckEitherNonSmi) \ | 254 M(CheckEitherNonSmi) \ |
255 M(BinaryDoubleOp) \ | 255 M(BinaryDoubleOp) \ |
256 M(MathSqrt) \ | 256 M(MathSqrt) \ |
257 M(UnboxDouble) \ | 257 M(UnboxDouble) \ |
258 M(BoxDouble) \ | 258 M(BoxDouble) \ |
259 M(UnboxInteger) \ | 259 M(UnboxInteger) \ |
260 M(BoxInteger) \ | 260 M(BoxInteger) \ |
261 M(BinaryMintOp) \ | 261 M(BinaryMintOp) \ |
| 262 M(ShiftMintOp) \ |
262 M(UnaryMintOp) \ | 263 M(UnaryMintOp) \ |
263 M(CheckArrayBound) \ | 264 M(CheckArrayBound) \ |
264 M(Constraint) \ | 265 M(Constraint) \ |
265 | 266 |
266 | 267 |
267 #define FORWARD_DECLARATION(type) class type##Instr; | 268 #define FORWARD_DECLARATION(type) class type##Instr; |
268 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) | 269 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) |
269 #undef FORWARD_DECLARATION | 270 #undef FORWARD_DECLARATION |
270 | 271 |
271 | 272 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 } | 510 } |
510 | 511 |
511 private: | 512 private: |
512 friend class Definition; // Needed for InsertBefore, InsertAfter. | 513 friend class Definition; // Needed for InsertBefore, InsertAfter. |
513 | 514 |
514 // Classes that set deopt_id_. | 515 // Classes that set deopt_id_. |
515 friend class UnboxIntegerInstr; | 516 friend class UnboxIntegerInstr; |
516 friend class UnboxDoubleInstr; | 517 friend class UnboxDoubleInstr; |
517 friend class BinaryDoubleOpInstr; | 518 friend class BinaryDoubleOpInstr; |
518 friend class BinaryMintOpInstr; | 519 friend class BinaryMintOpInstr; |
| 520 friend class ShiftMintOpInstr; |
519 friend class UnaryMintOpInstr; | 521 friend class UnaryMintOpInstr; |
520 friend class MathSqrtInstr; | 522 friend class MathSqrtInstr; |
521 friend class CheckClassInstr; | 523 friend class CheckClassInstr; |
522 friend class CheckSmiInstr; | 524 friend class CheckSmiInstr; |
523 friend class CheckArrayBoundInstr; | 525 friend class CheckArrayBoundInstr; |
524 friend class CheckEitherNonSmiInstr; | 526 friend class CheckEitherNonSmiInstr; |
525 friend class LICM; | 527 friend class LICM; |
526 | 528 |
527 intptr_t deopt_id_; | 529 intptr_t deopt_id_; |
528 intptr_t lifetime_position_; // Position used by register allocator. | 530 intptr_t lifetime_position_; // Position used by register allocator. |
(...skipping 3048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3577 | 3579 |
3578 DECLARE_INSTRUCTION(BinaryMintOp) | 3580 DECLARE_INSTRUCTION(BinaryMintOp) |
3579 | 3581 |
3580 private: | 3582 private: |
3581 const Token::Kind op_kind_; | 3583 const Token::Kind op_kind_; |
3582 | 3584 |
3583 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpInstr); | 3585 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpInstr); |
3584 }; | 3586 }; |
3585 | 3587 |
3586 | 3588 |
| 3589 class ShiftMintOpInstr : public TemplateDefinition<2> { |
| 3590 public: |
| 3591 ShiftMintOpInstr(Token::Kind op_kind, |
| 3592 Value* left, |
| 3593 Value* right, |
| 3594 InstanceCallInstr* instance_call) |
| 3595 : op_kind_(op_kind) { |
| 3596 ASSERT(left != NULL); |
| 3597 ASSERT(right != NULL); |
| 3598 ASSERT(op_kind == Token::kSHR); |
| 3599 inputs_[0] = left; |
| 3600 inputs_[1] = right; |
| 3601 deopt_id_ = instance_call->deopt_id(); |
| 3602 } |
| 3603 |
| 3604 Value* left() const { return inputs_[0]; } |
| 3605 Value* right() const { return inputs_[1]; } |
| 3606 |
| 3607 Token::Kind op_kind() const { return op_kind_; } |
| 3608 |
| 3609 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3610 |
| 3611 virtual bool CanDeoptimize() const { return true; } |
| 3612 |
| 3613 virtual bool HasSideEffect() const { return false; } |
| 3614 |
| 3615 virtual bool AffectedBySideEffect() const { return false; } |
| 3616 |
| 3617 virtual bool AttributesEqual(Instruction* other) const { |
| 3618 return op_kind() == other->AsShiftMintOp()->op_kind(); |
| 3619 } |
| 3620 |
| 3621 virtual intptr_t ResultCid() const; |
| 3622 virtual RawAbstractType* CompileType() const; |
| 3623 |
| 3624 virtual Representation representation() const { |
| 3625 return kUnboxedMint; |
| 3626 } |
| 3627 |
| 3628 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3629 ASSERT((idx == 0) || (idx == 1)); |
| 3630 return (idx == 0) ? kUnboxedMint : kTagged; |
| 3631 } |
| 3632 |
| 3633 virtual intptr_t DeoptimizationTarget() const { |
| 3634 // Direct access since this instuction cannot deoptimize, and the deopt-id |
| 3635 // was inherited from another instuction that could deoptimize. |
| 3636 return deopt_id_; |
| 3637 } |
| 3638 |
| 3639 DECLARE_INSTRUCTION(ShiftMintOp) |
| 3640 |
| 3641 private: |
| 3642 const Token::Kind op_kind_; |
| 3643 |
| 3644 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); |
| 3645 }; |
| 3646 |
| 3647 |
3587 class UnaryMintOpInstr : public TemplateDefinition<1> { | 3648 class UnaryMintOpInstr : public TemplateDefinition<1> { |
3588 public: | 3649 public: |
3589 UnaryMintOpInstr(Token::Kind op_kind, | 3650 UnaryMintOpInstr(Token::Kind op_kind, |
3590 Value* value, | 3651 Value* value, |
3591 InstanceCallInstr* instance_call) | 3652 InstanceCallInstr* instance_call) |
3592 : op_kind_(op_kind) { | 3653 : op_kind_(op_kind) { |
3593 ASSERT(value != NULL); | 3654 ASSERT(value != NULL); |
3594 ASSERT(op_kind == Token::kBIT_NOT); | 3655 ASSERT(op_kind == Token::kBIT_NOT); |
3595 inputs_[0] = value; | 3656 inputs_[0] = value; |
3596 deopt_id_ = instance_call->deopt_id(); | 3657 deopt_id_ = instance_call->deopt_id(); |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4123 ForwardInstructionIterator* current_iterator_; | 4184 ForwardInstructionIterator* current_iterator_; |
4124 | 4185 |
4125 private: | 4186 private: |
4126 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4187 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
4127 }; | 4188 }; |
4128 | 4189 |
4129 | 4190 |
4130 } // namespace dart | 4191 } // namespace dart |
4131 | 4192 |
4132 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4193 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |