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

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
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 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 return Representation::Double(); 1924 return Representation::Double();
1924 case kMathAbs: 1925 case kMathAbs:
1925 return representation(); 1926 return representation();
1926 default: 1927 default:
1927 UNREACHABLE(); 1928 UNREACHABLE();
1928 return Representation::None(); 1929 return Representation::None();
1929 } 1930 }
1930 } 1931 }
1931 } 1932 }
1932 1933
1933 virtual HValue* Canonicalize() { 1934 virtual HValue* Canonicalize();
1934 // If the input is integer32 then we replace the floor instruction
1935 // with its inputs. This happens before the representation changes are
1936 // introduced.
1937 if (op() == kMathFloor) {
1938 if (value()->representation().IsInteger32()) return value();
1939 }
1940 return this;
1941 }
1942 1935
1943 BuiltinFunctionId op() const { return op_; } 1936 BuiltinFunctionId op() const { return op_; }
1944 const char* OpName() const; 1937 const char* OpName() const;
1945 1938
1946 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) 1939 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation)
1947 1940
1948 protected: 1941 protected:
1949 virtual bool DataEquals(HValue* other) { 1942 virtual bool DataEquals(HValue* other) {
1950 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); 1943 HUnaryMathOperation* b = HUnaryMathOperation::cast(other);
1951 return op_ == b->op(); 1944 return op_ == b->op();
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 SetFlag(kUseGVN); 2678 SetFlag(kUseGVN);
2686 } 2679 }
2687 } 2680 }
2688 2681
2689 virtual HType CalculateInferredType(); 2682 virtual HType CalculateInferredType();
2690 2683
2691 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) 2684 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation)
2692 }; 2685 };
2693 2686
2694 2687
2688 class HMathFloorOfDiv: public HBinaryOperation {
2689 public:
2690 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right)
2691 : HBinaryOperation(context, left, right) {
2692 set_representation(Representation::Integer32());
2693 SetFlag(kUseGVN);
2694 }
2695
2696 virtual Representation RequiredInputRepresentation(int index) {
2697 return Representation::Integer32();
2698 }
2699
2700 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv)
2701
2702 protected:
2703 virtual bool DataEquals(HValue* other) { return true; }
2704 };
2705
2706
2695 class HArithmeticBinaryOperation: public HBinaryOperation { 2707 class HArithmeticBinaryOperation: public HBinaryOperation {
2696 public: 2708 public:
2697 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) 2709 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right)
2698 : HBinaryOperation(context, left, right) { 2710 : HBinaryOperation(context, left, right) {
2699 set_representation(Representation::Tagged()); 2711 set_representation(Representation::Tagged());
2700 SetFlag(kFlexibleRepresentation); 2712 SetFlag(kFlexibleRepresentation);
2701 SetAllSideEffects(); 2713 SetAllSideEffects();
2702 } 2714 }
2703 2715
2704 virtual void RepresentationChanged(Representation to) { 2716 virtual void RepresentationChanged(Representation to) {
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4849 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); 4861 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex);
4850 }; 4862 };
4851 4863
4852 4864
4853 #undef DECLARE_INSTRUCTION 4865 #undef DECLARE_INSTRUCTION
4854 #undef DECLARE_CONCRETE_INSTRUCTION 4866 #undef DECLARE_CONCRETE_INSTRUCTION
4855 4867
4856 } } // namespace v8::internal 4868 } } // namespace v8::internal
4857 4869
4858 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4870 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698