| Index: runtime/vm/intermediate_language.h
|
| ===================================================================
|
| --- runtime/vm/intermediate_language.h (revision 13110)
|
| +++ runtime/vm/intermediate_language.h (working copy)
|
| @@ -133,7 +133,9 @@
|
|
|
|
|
| enum Representation {
|
| - kTagged, kUnboxedDouble
|
| + kTagged,
|
| + kUnboxedDouble,
|
| + kUnboxedMint
|
| };
|
|
|
|
|
| @@ -255,6 +257,9 @@
|
| M(MathSqrt) \
|
| M(UnboxDouble) \
|
| M(BoxDouble) \
|
| + M(UnboxInteger) \
|
| + M(BoxInteger) \
|
| + M(UnboxedMintBinaryOp) \
|
| M(CheckArrayBound) \
|
| M(Constraint) \
|
|
|
| @@ -500,8 +505,10 @@
|
| friend class Definition; // Needed for InsertBefore, InsertAfter.
|
|
|
| // Classes that set deopt_id_.
|
| + friend class UnboxIntegerInstr;
|
| friend class UnboxDoubleInstr;
|
| friend class UnboxedDoubleBinaryOpInstr;
|
| + friend class UnboxedMintBinaryOpInstr;
|
| friend class MathSqrtInstr;
|
| friend class CheckClassInstr;
|
| friend class CheckSmiInstr;
|
| @@ -2308,7 +2315,9 @@
|
|
|
| virtual Representation RequiredInputRepresentation(intptr_t idx) const {
|
| ASSERT((idx == 0) || (idx == 1));
|
| - return (receiver_class_id() == kDoubleCid) ? kUnboxedDouble : kTagged;
|
| + if (receiver_class_id() == kDoubleCid) return kUnboxedDouble;
|
| + if (receiver_class_id() == kMintCid) return kUnboxedMint;
|
| + return kTagged;
|
| }
|
|
|
| private:
|
| @@ -3304,6 +3313,37 @@
|
| };
|
|
|
|
|
| +class BoxIntegerInstr : public TemplateDefinition<1> {
|
| + public:
|
| + explicit BoxIntegerInstr(Value* value) {
|
| + ASSERT(value != NULL);
|
| + inputs_[0] = value;
|
| + }
|
| +
|
| + Value* value() const { return inputs_[0]; }
|
| +
|
| + virtual bool CanDeoptimize() const { return false; }
|
| +
|
| + virtual bool HasSideEffect() const { return false; }
|
| +
|
| + virtual bool AffectedBySideEffect() const { return false; }
|
| + virtual bool AttributesEqual(Instruction* other) const { return true; }
|
| +
|
| + virtual intptr_t ResultCid() const;
|
| +
|
| + virtual Representation RequiredInputRepresentation(intptr_t idx) const {
|
| + ASSERT(idx == 0);
|
| + return kUnboxedMint;
|
| + }
|
| +
|
| + DECLARE_INSTRUCTION(BoxInteger)
|
| + virtual RawAbstractType* CompileType() const;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr);
|
| +};
|
| +
|
| +
|
| class UnboxDoubleInstr : public TemplateDefinition<1> {
|
| public:
|
| UnboxDoubleInstr(Value* value, intptr_t deopt_id) {
|
| @@ -3339,6 +3379,41 @@
|
| };
|
|
|
|
|
| +class UnboxIntegerInstr : public TemplateDefinition<1> {
|
| + public:
|
| + UnboxIntegerInstr(Value* value, intptr_t deopt_id) {
|
| + ASSERT(value != NULL);
|
| + inputs_[0] = value;
|
| + deopt_id_ = deopt_id;
|
| + }
|
| +
|
| + Value* value() const { return inputs_[0]; }
|
| +
|
| + virtual bool CanDeoptimize() const {
|
| + return (value()->ResultCid() != kMintCid)
|
| + && (value()->ResultCid() != kSmiCid);
|
| + }
|
| +
|
| + virtual bool HasSideEffect() const { return false; }
|
| +
|
| + virtual intptr_t ResultCid() const;
|
| +
|
| + virtual RawAbstractType* CompileType() const;
|
| +
|
| + virtual Representation representation() const {
|
| + return kUnboxedMint;
|
| + }
|
| +
|
| + virtual bool AffectedBySideEffect() const { return false; }
|
| + virtual bool AttributesEqual(Instruction* other) const { return true; }
|
| +
|
| + DECLARE_INSTRUCTION(UnboxInteger)
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr);
|
| +};
|
| +
|
| +
|
| class MathSqrtInstr : public TemplateDefinition<1> {
|
| public:
|
| MathSqrtInstr(Value* value, StaticCallInstr* instance_call) {
|
| @@ -3442,6 +3517,64 @@
|
| };
|
|
|
|
|
| +class UnboxedMintBinaryOpInstr : public TemplateDefinition<2> {
|
| + public:
|
| + UnboxedMintBinaryOpInstr(Token::Kind op_kind,
|
| + Value* left,
|
| + Value* right,
|
| + InstanceCallInstr* instance_call)
|
| + : op_kind_(op_kind) {
|
| + ASSERT(left != NULL);
|
| + ASSERT(right != NULL);
|
| + inputs_[0] = left;
|
| + inputs_[1] = right;
|
| + deopt_id_ = instance_call->deopt_id();
|
| + }
|
| +
|
| + Value* left() const { return inputs_[0]; }
|
| + Value* right() const { return inputs_[1]; }
|
| +
|
| + Token::Kind op_kind() const { return op_kind_; }
|
| +
|
| + virtual void PrintOperandsTo(BufferFormatter* f) const;
|
| +
|
| + virtual bool CanDeoptimize() const { return false; }
|
| +
|
| + virtual bool HasSideEffect() const { return false; }
|
| +
|
| + virtual bool AffectedBySideEffect() const { return false; }
|
| +
|
| + virtual bool AttributesEqual(Instruction* other) const {
|
| + return op_kind() == other->AsUnboxedMintBinaryOp()->op_kind();
|
| + }
|
| +
|
| + virtual intptr_t ResultCid() const;
|
| + virtual RawAbstractType* CompileType() const;
|
| +
|
| + virtual Representation representation() const {
|
| + return kUnboxedMint;
|
| + }
|
| +
|
| + virtual Representation RequiredInputRepresentation(intptr_t idx) const {
|
| + ASSERT((idx == 0) || (idx == 1));
|
| + return kUnboxedMint;
|
| + }
|
| +
|
| + virtual intptr_t DeoptimizationTarget() const {
|
| + // Direct access since this instuction cannot deoptimize, and the deopt-id
|
| + // was inherited from another instuction that could deoptimize.
|
| + return deopt_id_;
|
| + }
|
| +
|
| + DECLARE_INSTRUCTION(UnboxedMintBinaryOp)
|
| +
|
| + private:
|
| + const Token::Kind op_kind_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(UnboxedMintBinaryOpInstr);
|
| +};
|
| +
|
| +
|
| class BinarySmiOpInstr : public TemplateDefinition<2> {
|
| public:
|
| BinarySmiOpInstr(Token::Kind op_kind,
|
| @@ -3469,6 +3602,7 @@
|
| virtual void PrintOperandsTo(BufferFormatter* f) const;
|
|
|
| DECLARE_INSTRUCTION(BinarySmiOp)
|
| +
|
| virtual RawAbstractType* CompileType() const;
|
|
|
| virtual bool CanDeoptimize() const;
|
|
|