| 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(UnboxedDoubleBinaryOp) \ | 255 M(UnboxedDoubleBinaryOp) \ |
| 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(UnboxedMintBinaryOp) \ | 261 M(UnboxedMintBinaryOp) \ |
| 262 M(UnboxedMintUnaryOp) \ |
| 262 M(CheckArrayBound) \ | 263 M(CheckArrayBound) \ |
| 263 M(Constraint) \ | 264 M(Constraint) \ |
| 264 | 265 |
| 265 | 266 |
| 266 #define FORWARD_DECLARATION(type) class type##Instr; | 267 #define FORWARD_DECLARATION(type) class type##Instr; |
| 267 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) | 268 FOR_EACH_INSTRUCTION(FORWARD_DECLARATION) |
| 268 #undef FORWARD_DECLARATION | 269 #undef FORWARD_DECLARATION |
| 269 | 270 |
| 270 | 271 |
| 271 // Functions required in all concrete instruction classes. | 272 // Functions required in all concrete instruction classes. |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 } | 509 } |
| 509 | 510 |
| 510 private: | 511 private: |
| 511 friend class Definition; // Needed for InsertBefore, InsertAfter. | 512 friend class Definition; // Needed for InsertBefore, InsertAfter. |
| 512 | 513 |
| 513 // Classes that set deopt_id_. | 514 // Classes that set deopt_id_. |
| 514 friend class UnboxIntegerInstr; | 515 friend class UnboxIntegerInstr; |
| 515 friend class UnboxDoubleInstr; | 516 friend class UnboxDoubleInstr; |
| 516 friend class UnboxedDoubleBinaryOpInstr; | 517 friend class UnboxedDoubleBinaryOpInstr; |
| 517 friend class UnboxedMintBinaryOpInstr; | 518 friend class UnboxedMintBinaryOpInstr; |
| 519 friend class UnboxedMintUnaryOpInstr; |
| 518 friend class MathSqrtInstr; | 520 friend class MathSqrtInstr; |
| 519 friend class CheckClassInstr; | 521 friend class CheckClassInstr; |
| 520 friend class CheckSmiInstr; | 522 friend class CheckSmiInstr; |
| 521 friend class CheckArrayBoundInstr; | 523 friend class CheckArrayBoundInstr; |
| 522 friend class CheckEitherNonSmiInstr; | 524 friend class CheckEitherNonSmiInstr; |
| 523 friend class LICM; | 525 friend class LICM; |
| 524 | 526 |
| 525 intptr_t deopt_id_; | 527 intptr_t deopt_id_; |
| 526 intptr_t lifetime_position_; // Position used by register allocator. | 528 intptr_t lifetime_position_; // Position used by register allocator. |
| 527 Instruction* previous_; | 529 Instruction* previous_; |
| (...skipping 3048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3576 | 3578 |
| 3577 DECLARE_INSTRUCTION(UnboxedMintBinaryOp) | 3579 DECLARE_INSTRUCTION(UnboxedMintBinaryOp) |
| 3578 | 3580 |
| 3579 private: | 3581 private: |
| 3580 const Token::Kind op_kind_; | 3582 const Token::Kind op_kind_; |
| 3581 | 3583 |
| 3582 DISALLOW_COPY_AND_ASSIGN(UnboxedMintBinaryOpInstr); | 3584 DISALLOW_COPY_AND_ASSIGN(UnboxedMintBinaryOpInstr); |
| 3583 }; | 3585 }; |
| 3584 | 3586 |
| 3585 | 3587 |
| 3588 class UnboxedMintUnaryOpInstr : public TemplateDefinition<1> { |
| 3589 public: |
| 3590 UnboxedMintUnaryOpInstr(Token::Kind op_kind, |
| 3591 Value* value, |
| 3592 InstanceCallInstr* instance_call) |
| 3593 : op_kind_(op_kind) { |
| 3594 ASSERT(value != NULL); |
| 3595 ASSERT(op_kind == Token::kBIT_NOT); |
| 3596 inputs_[0] = value; |
| 3597 deopt_id_ = instance_call->deopt_id(); |
| 3598 } |
| 3599 |
| 3600 Value* value() const { return inputs_[0]; } |
| 3601 |
| 3602 Token::Kind op_kind() const { return op_kind_; } |
| 3603 |
| 3604 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 3605 |
| 3606 virtual bool CanDeoptimize() const { return false; } |
| 3607 |
| 3608 virtual bool HasSideEffect() const { return false; } |
| 3609 |
| 3610 virtual bool AffectedBySideEffect() const { return false; } |
| 3611 |
| 3612 virtual bool AttributesEqual(Instruction* other) const { |
| 3613 return op_kind() == other->AsUnboxedMintUnaryOp()->op_kind(); |
| 3614 } |
| 3615 |
| 3616 virtual intptr_t ResultCid() const; |
| 3617 virtual RawAbstractType* CompileType() const; |
| 3618 |
| 3619 virtual Representation representation() const { |
| 3620 return kUnboxedMint; |
| 3621 } |
| 3622 |
| 3623 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 3624 ASSERT(idx == 0); |
| 3625 return kUnboxedMint; |
| 3626 } |
| 3627 |
| 3628 virtual intptr_t DeoptimizationTarget() const { |
| 3629 // Direct access since this instuction cannot deoptimize, and the deopt-id |
| 3630 // was inherited from another instuction that could deoptimize. |
| 3631 return deopt_id_; |
| 3632 } |
| 3633 |
| 3634 DECLARE_INSTRUCTION(UnboxedMintUnaryOp) |
| 3635 |
| 3636 private: |
| 3637 const Token::Kind op_kind_; |
| 3638 |
| 3639 DISALLOW_COPY_AND_ASSIGN(UnboxedMintUnaryOpInstr); |
| 3640 }; |
| 3641 |
| 3642 |
| 3586 class BinarySmiOpInstr : public TemplateDefinition<2> { | 3643 class BinarySmiOpInstr : public TemplateDefinition<2> { |
| 3587 public: | 3644 public: |
| 3588 BinarySmiOpInstr(Token::Kind op_kind, | 3645 BinarySmiOpInstr(Token::Kind op_kind, |
| 3589 InstanceCallInstr* instance_call, | 3646 InstanceCallInstr* instance_call, |
| 3590 Value* left, | 3647 Value* left, |
| 3591 Value* right) | 3648 Value* right) |
| 3592 : op_kind_(op_kind), | 3649 : op_kind_(op_kind), |
| 3593 instance_call_(instance_call), | 3650 instance_call_(instance_call), |
| 3594 overflow_(true) { | 3651 overflow_(true) { |
| 3595 ASSERT(left != NULL); | 3652 ASSERT(left != NULL); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4067 ForwardInstructionIterator* current_iterator_; | 4124 ForwardInstructionIterator* current_iterator_; |
| 4068 | 4125 |
| 4069 private: | 4126 private: |
| 4070 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4127 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4071 }; | 4128 }; |
| 4072 | 4129 |
| 4073 | 4130 |
| 4074 } // namespace dart | 4131 } // namespace dart |
| 4075 | 4132 |
| 4076 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4133 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |