Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 22266005: Inline fsin/fcos. Huge speedup on Box2D. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 V(_OneByteString, _setAt, OneByteStringSetAt, 1038132016) \ 73 V(_OneByteString, _setAt, OneByteStringSetAt, 1038132016) \
74 V(_IntegerImplementation, toDouble, IntegerToDouble, 1331752138) \ 74 V(_IntegerImplementation, toDouble, IntegerToDouble, 1331752138) \
75 V(_Double, toInt, DoubleToInteger, 630286253) \ 75 V(_Double, toInt, DoubleToInteger, 630286253) \
76 V(_Double, truncateToDouble, DoubleTruncate, 1804056693) \ 76 V(_Double, truncateToDouble, DoubleTruncate, 1804056693) \
77 V(_Double, roundToDouble, DoubleRound, 1804056693) \ 77 V(_Double, roundToDouble, DoubleRound, 1804056693) \
78 V(_Double, floorToDouble, DoubleFloor, 1804056693) \ 78 V(_Double, floorToDouble, DoubleFloor, 1804056693) \
79 V(_Double, ceilToDouble, DoubleCeil, 1804056693) \ 79 V(_Double, ceilToDouble, DoubleCeil, 1804056693) \
80 V(_Double, pow, DoublePow, 102305574) \ 80 V(_Double, pow, DoublePow, 102305574) \
81 V(_Double, _modulo, DoubleMod, 663439671) \ 81 V(_Double, _modulo, DoubleMod, 663439671) \
82 V(::, sqrt, MathSqrt, 1662640002) \ 82 V(::, sqrt, MathSqrt, 1662640002) \
83 V(::, sin, MathSin, 1273932041) \
84 V(::, cos, MathCos, 1749547468) \
83 V(::, min, MathMin, 269896129) \ 85 V(::, min, MathMin, 269896129) \
84 V(::, max, MathMax, 1286442186) \ 86 V(::, max, MathMax, 1286442186) \
85 V(Float32x4, Float32x4., Float32x4Constructor, 1492157358) \ 87 V(Float32x4, Float32x4., Float32x4Constructor, 1492157358) \
86 V(Float32x4, Float32x4.zero, Float32x4Zero, 444339161) \ 88 V(Float32x4, Float32x4.zero, Float32x4Zero, 444339161) \
87 V(Float32x4, Float32x4.splat, Float32x4Splat, 1843231403) \ 89 V(Float32x4, Float32x4.splat, Float32x4Splat, 1843231403) \
88 V(_Float32x4, _shuffle, Float32x4Shuffle, 1618450134) \ 90 V(_Float32x4, _shuffle, Float32x4Shuffle, 1618450134) \
89 V(_Float32x4, get:x, Float32x4ShuffleX, 211144022) \ 91 V(_Float32x4, get:x, Float32x4ShuffleX, 211144022) \
90 V(_Float32x4, get:y, Float32x4ShuffleY, 211144022) \ 92 V(_Float32x4, get:y, Float32x4ShuffleY, 211144022) \
91 V(_Float32x4, get:z, Float32x4ShuffleZ, 211144022) \ 93 V(_Float32x4, get:z, Float32x4ShuffleZ, 211144022) \
92 V(_Float32x4, get:w, Float32x4ShuffleW, 211144022) \ 94 V(_Float32x4, get:w, Float32x4ShuffleW, 211144022) \
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 M(CheckStackOverflow) \ 583 M(CheckStackOverflow) \
582 M(SmiToDouble) \ 584 M(SmiToDouble) \
583 M(DoubleToInteger) \ 585 M(DoubleToInteger) \
584 M(DoubleToSmi) \ 586 M(DoubleToSmi) \
585 M(DoubleToDouble) \ 587 M(DoubleToDouble) \
586 M(CheckClass) \ 588 M(CheckClass) \
587 M(CheckSmi) \ 589 M(CheckSmi) \
588 M(Constant) \ 590 M(Constant) \
589 M(CheckEitherNonSmi) \ 591 M(CheckEitherNonSmi) \
590 M(BinaryDoubleOp) \ 592 M(BinaryDoubleOp) \
591 M(MathSqrt) \ 593 M(MathUnary) \
592 M(MathMinMax) \ 594 M(MathMinMax) \
593 M(UnboxDouble) \ 595 M(UnboxDouble) \
594 M(BoxDouble) \ 596 M(BoxDouble) \
595 M(BoxFloat32x4) \ 597 M(BoxFloat32x4) \
596 M(UnboxFloat32x4) \ 598 M(UnboxFloat32x4) \
597 M(BoxUint32x4) \ 599 M(BoxUint32x4) \
598 M(UnboxUint32x4) \ 600 M(UnboxUint32x4) \
599 M(UnboxInteger) \ 601 M(UnboxInteger) \
600 M(BoxInteger) \ 602 M(BoxInteger) \
601 M(BinaryMintOp) \ 603 M(BinaryMintOp) \
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 friend class Uint32x4GetFlagInstr; 914 friend class Uint32x4GetFlagInstr;
913 friend class Uint32x4SetFlagInstr; 915 friend class Uint32x4SetFlagInstr;
914 friend class Uint32x4SelectInstr; 916 friend class Uint32x4SelectInstr;
915 friend class Uint32x4ToFloat32x4Instr; 917 friend class Uint32x4ToFloat32x4Instr;
916 friend class BinaryUint32x4OpInstr; 918 friend class BinaryUint32x4OpInstr;
917 friend class BinaryMintOpInstr; 919 friend class BinaryMintOpInstr;
918 friend class BinarySmiOpInstr; 920 friend class BinarySmiOpInstr;
919 friend class UnarySmiOpInstr; 921 friend class UnarySmiOpInstr;
920 friend class ShiftMintOpInstr; 922 friend class ShiftMintOpInstr;
921 friend class UnaryMintOpInstr; 923 friend class UnaryMintOpInstr;
922 friend class MathSqrtInstr; 924 friend class MathUnaryInstr;
923 friend class MathMinMaxInstr; 925 friend class MathMinMaxInstr;
924 friend class CheckClassInstr; 926 friend class CheckClassInstr;
925 friend class GuardFieldInstr; 927 friend class GuardFieldInstr;
926 friend class CheckSmiInstr; 928 friend class CheckSmiInstr;
927 friend class CheckArrayBoundInstr; 929 friend class CheckArrayBoundInstr;
928 friend class CheckEitherNonSmiInstr; 930 friend class CheckEitherNonSmiInstr;
929 friend class LICM; 931 friend class LICM;
930 friend class DoubleToSmiInstr; 932 friend class DoubleToSmiInstr;
931 friend class DoubleToDoubleInstr; 933 friend class DoubleToDoubleInstr;
932 friend class InvokeMathCFunctionInstr; 934 friend class InvokeMathCFunctionInstr;
(...skipping 3667 matching lines...) Expand 10 before | Expand all | Expand 10 after
4600 virtual EffectSet Dependencies() const { return EffectSet::None(); } 4602 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4601 virtual bool AttributesEqual(Instruction* other) const { return true; } 4603 virtual bool AttributesEqual(Instruction* other) const { return true; }
4602 4604
4603 virtual bool MayThrow() const { return false; } 4605 virtual bool MayThrow() const { return false; }
4604 4606
4605 private: 4607 private:
4606 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr); 4608 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr);
4607 }; 4609 };
4608 4610
4609 4611
4610 class MathSqrtInstr : public TemplateDefinition<1> { 4612 class MathUnaryInstr : public TemplateDefinition<1> {
4611 public: 4613 public:
4612 MathSqrtInstr(Value* value, intptr_t deopt_id) { 4614 MathUnaryInstr(MethodRecognizer::Kind kind, Value* value, intptr_t deopt_id)
4615 : kind_(kind) {
4613 SetInputAt(0, value); 4616 SetInputAt(0, value);
4614 deopt_id_ = deopt_id; 4617 deopt_id_ = deopt_id;
4615 } 4618 }
4616 4619
4617 Value* value() const { return inputs_[0]; } 4620 Value* value() const { return inputs_[0]; }
4618 4621
4622 MethodRecognizer::Kind kind() const { return kind_; }
4623
4619 virtual bool CanDeoptimize() const { return false; } 4624 virtual bool CanDeoptimize() const { return false; }
4620 4625
4621 virtual Representation representation() const { 4626 virtual Representation representation() const {
4622 return kUnboxedDouble; 4627 return kUnboxedDouble;
4623 } 4628 }
4624 4629
4625 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 4630 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4626 ASSERT(idx == 0); 4631 ASSERT(idx == 0);
4627 return kUnboxedDouble; 4632 return kUnboxedDouble;
4628 } 4633 }
4629 4634
4630 virtual intptr_t DeoptimizationTarget() const { 4635 virtual intptr_t DeoptimizationTarget() const {
4631 // Direct access since this instruction cannot deoptimize, and the deopt-id 4636 // Direct access since this instruction cannot deoptimize, and the deopt-id
4632 // was inherited from another instruction that could deoptimize. 4637 // was inherited from another instruction that could deoptimize.
4633 return deopt_id_; 4638 return deopt_id_;
4634 } 4639 }
4635 4640
4636 DECLARE_INSTRUCTION(MathSqrt) 4641 DECLARE_INSTRUCTION(MathUnary)
4637 virtual CompileType ComputeType() const; 4642 virtual CompileType ComputeType() const;
4638 4643
4639 virtual bool AllowsCSE() const { return true; } 4644 virtual bool AllowsCSE() const { return true; }
4640 virtual EffectSet Effects() const { return EffectSet::None(); } 4645 virtual EffectSet Effects() const { return EffectSet::None(); }
4641 virtual EffectSet Dependencies() const { return EffectSet::None(); } 4646 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4642 virtual bool AttributesEqual(Instruction* other) const { return true; } 4647 virtual bool AttributesEqual(Instruction* other) const { return true; }
4643 4648
4644 virtual bool MayThrow() const { return false; } 4649 virtual bool MayThrow() const { return false; }
4645 4650
4646 private: 4651 private:
4647 DISALLOW_COPY_AND_ASSIGN(MathSqrtInstr); 4652 const MethodRecognizer::Kind kind_;
4653
4654 DISALLOW_COPY_AND_ASSIGN(MathUnaryInstr);
4648 }; 4655 };
4649 4656
4650 4657
4651 // Represents Math's static min and max functions. 4658 // Represents Math's static min and max functions.
4652 class MathMinMaxInstr : public TemplateDefinition<2> { 4659 class MathMinMaxInstr : public TemplateDefinition<2> {
4653 public: 4660 public:
4654 MathMinMaxInstr(MethodRecognizer::Kind op_kind, 4661 MathMinMaxInstr(MethodRecognizer::Kind op_kind,
4655 Value* left_value, 4662 Value* left_value,
4656 Value* right_value, 4663 Value* right_value,
4657 intptr_t deopt_id, 4664 intptr_t deopt_id,
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after
6631 ForwardInstructionIterator* current_iterator_; 6638 ForwardInstructionIterator* current_iterator_;
6632 6639
6633 private: 6640 private:
6634 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6641 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6635 }; 6642 };
6636 6643
6637 6644
6638 } // namespace dart 6645 } // namespace dart
6639 6646
6640 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6647 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698