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

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

Issue 79653002: Merge TRUNCDIV and MOD into one instruction. Icorporated feedback from CL https://codereview.chromi… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 M(UnboxInteger) \ 665 M(UnboxInteger) \
666 M(BoxInteger) \ 666 M(BoxInteger) \
667 M(BinaryMintOp) \ 667 M(BinaryMintOp) \
668 M(ShiftMintOp) \ 668 M(ShiftMintOp) \
669 M(UnaryMintOp) \ 669 M(UnaryMintOp) \
670 M(CheckArrayBound) \ 670 M(CheckArrayBound) \
671 M(Constraint) \ 671 M(Constraint) \
672 M(StringFromCharCode) \ 672 M(StringFromCharCode) \
673 M(StringInterpolate) \ 673 M(StringInterpolate) \
674 M(InvokeMathCFunction) \ 674 M(InvokeMathCFunction) \
675 M(MergedMath) \
675 M(GuardField) \ 676 M(GuardField) \
676 M(IfThenElse) \ 677 M(IfThenElse) \
677 M(BinaryFloat32x4Op) \ 678 M(BinaryFloat32x4Op) \
678 M(Simd32x4Shuffle) \ 679 M(Simd32x4Shuffle) \
679 M(Simd32x4ShuffleMix) \ 680 M(Simd32x4ShuffleMix) \
680 M(Simd32x4GetSignMask) \ 681 M(Simd32x4GetSignMask) \
681 M(Float32x4Constructor) \ 682 M(Float32x4Constructor) \
682 M(Float32x4Zero) \ 683 M(Float32x4Zero) \
683 M(Float32x4Splat) \ 684 M(Float32x4Splat) \
684 M(Float32x4Comparison) \ 685 M(Float32x4Comparison) \
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 friend class MathMinMaxInstr; 992 friend class MathMinMaxInstr;
992 friend class CheckClassInstr; 993 friend class CheckClassInstr;
993 friend class GuardFieldInstr; 994 friend class GuardFieldInstr;
994 friend class CheckSmiInstr; 995 friend class CheckSmiInstr;
995 friend class CheckArrayBoundInstr; 996 friend class CheckArrayBoundInstr;
996 friend class CheckEitherNonSmiInstr; 997 friend class CheckEitherNonSmiInstr;
997 friend class LICM; 998 friend class LICM;
998 friend class DoubleToSmiInstr; 999 friend class DoubleToSmiInstr;
999 friend class DoubleToDoubleInstr; 1000 friend class DoubleToDoubleInstr;
1000 friend class InvokeMathCFunctionInstr; 1001 friend class InvokeMathCFunctionInstr;
1002 friend class MergedMathInstr;
1001 friend class FlowGraphOptimizer; 1003 friend class FlowGraphOptimizer;
1002 friend class LoadIndexedInstr; 1004 friend class LoadIndexedInstr;
1003 friend class StoreIndexedInstr; 1005 friend class StoreIndexedInstr;
1004 friend class StoreInstanceFieldInstr; 1006 friend class StoreInstanceFieldInstr;
1005 friend class ComparisonInstr; 1007 friend class ComparisonInstr;
1006 friend class TargetEntryInstr; 1008 friend class TargetEntryInstr;
1007 friend class JoinEntryInstr; 1009 friend class JoinEntryInstr;
1008 friend class InstanceOfInstr; 1010 friend class InstanceOfInstr;
1009 friend class PolymorphicInstanceCallInstr; 1011 friend class PolymorphicInstanceCallInstr;
1010 friend class SmiToDoubleInstr; 1012 friend class SmiToDoubleInstr;
(...skipping 5548 matching lines...) Expand 10 before | Expand all | Expand 10 after
6559 ZoneGrowableArray<Value*>* inputs_; 6561 ZoneGrowableArray<Value*>* inputs_;
6560 6562
6561 LocationSummary* locs_; 6563 LocationSummary* locs_;
6562 6564
6563 const MethodRecognizer::Kind recognized_kind_; 6565 const MethodRecognizer::Kind recognized_kind_;
6564 6566
6565 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); 6567 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr);
6566 }; 6568 };
6567 6569
6568 6570
6571 class MergedMathInstr : public Definition {
6572 public:
6573 enum Kind {
6574 kTruncDivMod,
6575 kTruncDivRem,
6576 kSinCos,
6577 };
6578
6579 MergedMathInstr(ZoneGrowableArray<Value*>* inputs,
6580 intptr_t original_deopt_id,
6581 MergedMathInstr::Kind kind);
6582
6583 static intptr_t ArgumentCountFor(MergedMathInstr::Kind kind) {
Florian Schneider 2013/11/21 11:15:41 We ususally use ArgumentCount for #arguments to a
srdjan 2013/11/21 17:32:44 Done.
6584 if (kind == kTruncDivMod) {
6585 return 2;
6586 } else {
6587 UNIMPLEMENTED();
6588 return -1;
6589 }
6590 }
6591
6592 MergedMathInstr::Kind kind() const { return kind_; }
6593
6594 virtual intptr_t InputCount() const { return inputs_->length(); }
6595
6596 virtual Value* InputAt(intptr_t i) const {
6597 return (*inputs_)[i];
6598 }
6599
6600 virtual CompileType ComputeType() const;
6601 virtual void PrintOperandsTo(BufferFormatter* f) const;
6602
6603 virtual bool CanDeoptimize() const {
6604 if (kind_ == kTruncDivMod) {
6605 return true;
6606 } else {
6607 UNIMPLEMENTED();
6608 return false;
6609 }
6610 }
6611
6612 virtual Representation representation() const {
6613 if (kind_ == kTruncDivMod) {
6614 return kTagged;
6615 } else {
6616 UNIMPLEMENTED();
6617 return kTagged;
6618 }
6619 }
6620
6621 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6622 if (kind_ == kTruncDivMod) {
6623 ASSERT((0 <= idx) && (idx < InputCount()));
6624 return kTagged;
6625 } else {
6626 UNIMPLEMENTED();
6627 return kTagged;
6628 }
6629 }
6630
6631 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
6632
6633 DECLARE_INSTRUCTION(MergedMath)
6634
6635 // Returns a structure describing the location constraints required
6636 // to emit native code for this definition.
6637 LocationSummary* locs() {
6638 if (locs_ == NULL) {
6639 locs_ = MakeLocationSummary();
6640 }
6641 return locs_;
6642 }
6643
6644 virtual bool AllowsCSE() const { return true; }
6645 virtual EffectSet Effects() const { return EffectSet::None(); }
6646 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6647 virtual bool AttributesEqual(Instruction* other) const {
6648 MergedMathInstr* other_invoke = other->AsMergedMath();
6649 return other_invoke->kind() == kind();
6650 }
6651
6652 virtual bool MayThrow() const { return false; }
6653
6654 static const char* KindToCString(MergedMathInstr::Kind kind) {
6655 if (kind == kTruncDivMod) return "TruncDivMod";
6656 UNIMPLEMENTED();
6657 return "";
6658 }
6659
6660 private:
6661 virtual void RawSetInputAt(intptr_t i, Value* value) {
6662 (*inputs_)[i] = value;
6663 }
6664
6665 ZoneGrowableArray<Value*>* inputs_;
6666 LocationSummary* locs_;
6667 MergedMathInstr::Kind kind_;
6668
6669 DISALLOW_COPY_AND_ASSIGN(MergedMathInstr);
6670 };
6671
6672
6569 class CheckClassInstr : public TemplateInstruction<1> { 6673 class CheckClassInstr : public TemplateInstruction<1> {
6570 public: 6674 public:
6571 CheckClassInstr(Value* value, 6675 CheckClassInstr(Value* value,
6572 intptr_t deopt_id, 6676 intptr_t deopt_id,
6573 const ICData& unary_checks); 6677 const ICData& unary_checks);
6574 6678
6575 DECLARE_INSTRUCTION(CheckClass) 6679 DECLARE_INSTRUCTION(CheckClass)
6576 6680
6577 virtual intptr_t ArgumentCount() const { return 0; } 6681 virtual intptr_t ArgumentCount() const { return 0; }
6578 6682
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
6895 ForwardInstructionIterator* current_iterator_; 6999 ForwardInstructionIterator* current_iterator_;
6896 7000
6897 private: 7001 private:
6898 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 7002 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6899 }; 7003 };
6900 7004
6901 7005
6902 } // namespace dart 7006 } // namespace dart
6903 7007
6904 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 7008 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698