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

Side by Side Diff: src/hydrogen-instructions.h

Issue 9638018: [v8-dev] Optimise Math.floor(x/y) to use integer division for specific divisor.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 8 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
« no previous file with comments | « src/frames.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 V(LoadFunctionPrototype) \ 133 V(LoadFunctionPrototype) \
134 V(LoadGlobalCell) \ 134 V(LoadGlobalCell) \
135 V(LoadGlobalGeneric) \ 135 V(LoadGlobalGeneric) \
136 V(LoadKeyedFastDoubleElement) \ 136 V(LoadKeyedFastDoubleElement) \
137 V(LoadKeyedFastElement) \ 137 V(LoadKeyedFastElement) \
138 V(LoadKeyedGeneric) \ 138 V(LoadKeyedGeneric) \
139 V(LoadKeyedSpecializedArrayElement) \ 139 V(LoadKeyedSpecializedArrayElement) \
140 V(LoadNamedField) \ 140 V(LoadNamedField) \
141 V(LoadNamedFieldPolymorphic) \ 141 V(LoadNamedFieldPolymorphic) \
142 V(LoadNamedGeneric) \ 142 V(LoadNamedGeneric) \
143 V(MathFloorOfDiv) \
143 V(Mod) \ 144 V(Mod) \
144 V(Mul) \ 145 V(Mul) \
145 V(ObjectLiteral) \ 146 V(ObjectLiteral) \
146 V(OsrEntry) \ 147 V(OsrEntry) \
147 V(OuterContext) \ 148 V(OuterContext) \
148 V(Parameter) \ 149 V(Parameter) \
149 V(Power) \ 150 V(Power) \
150 V(PushArgument) \ 151 V(PushArgument) \
151 V(Random) \ 152 V(Random) \
152 V(RegExpLiteral) \ 153 V(RegExpLiteral) \
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 return Representation::Double(); 1986 return Representation::Double();
1986 case kMathAbs: 1987 case kMathAbs:
1987 return representation(); 1988 return representation();
1988 default: 1989 default:
1989 UNREACHABLE(); 1990 UNREACHABLE();
1990 return Representation::None(); 1991 return Representation::None();
1991 } 1992 }
1992 } 1993 }
1993 } 1994 }
1994 1995
1995 virtual HValue* Canonicalize() { 1996 virtual HValue* Canonicalize();
1996 // If the input is integer32 then we replace the floor instruction
1997 // with its inputs. This happens before the representation changes are
1998 // introduced.
1999 if (op() == kMathFloor) {
2000 if (value()->representation().IsInteger32()) return value();
2001 }
2002 return this;
2003 }
2004 1997
2005 BuiltinFunctionId op() const { return op_; } 1998 BuiltinFunctionId op() const { return op_; }
2006 const char* OpName() const; 1999 const char* OpName() const;
2007 2000
2008 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) 2001 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation)
2009 2002
2010 protected: 2003 protected:
2011 virtual bool DataEquals(HValue* other) { 2004 virtual bool DataEquals(HValue* other) {
2012 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); 2005 HUnaryMathOperation* b = HUnaryMathOperation::cast(other);
2013 return op_ == b->op(); 2006 return op_ == b->op();
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2751 SetFlag(kUseGVN); 2744 SetFlag(kUseGVN);
2752 } 2745 }
2753 } 2746 }
2754 2747
2755 virtual HType CalculateInferredType(); 2748 virtual HType CalculateInferredType();
2756 2749
2757 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) 2750 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation)
2758 }; 2751 };
2759 2752
2760 2753
2754 class HMathFloorOfDiv: public HBinaryOperation {
2755 public:
2756 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right)
2757 : HBinaryOperation(context, left, right) {
2758 set_representation(Representation::Integer32());
2759 SetFlag(kUseGVN);
2760 }
2761
2762 virtual Representation RequiredInputRepresentation(int index) {
2763 return Representation::Integer32();
2764 }
2765
2766 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv)
2767
2768 protected:
2769 virtual bool DataEquals(HValue* other) { return true; }
2770 };
2771
2772
2761 class HArithmeticBinaryOperation: public HBinaryOperation { 2773 class HArithmeticBinaryOperation: public HBinaryOperation {
2762 public: 2774 public:
2763 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) 2775 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right)
2764 : HBinaryOperation(context, left, right) { 2776 : HBinaryOperation(context, left, right) {
2765 set_representation(Representation::Tagged()); 2777 set_representation(Representation::Tagged());
2766 SetFlag(kFlexibleRepresentation); 2778 SetFlag(kFlexibleRepresentation);
2767 SetAllSideEffects(); 2779 SetAllSideEffects();
2768 } 2780 }
2769 2781
2770 virtual void RepresentationChanged(Representation to) { 2782 virtual void RepresentationChanged(Representation to) {
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after
4947 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); 4959 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex);
4948 }; 4960 };
4949 4961
4950 4962
4951 #undef DECLARE_INSTRUCTION 4963 #undef DECLARE_INSTRUCTION
4952 #undef DECLARE_CONCRETE_INSTRUCTION 4964 #undef DECLARE_CONCRETE_INSTRUCTION
4953 4965
4954 } } // namespace v8::internal 4966 } } // namespace v8::internal
4955 4967
4956 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4968 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/frames.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698