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

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

Issue 258793002: ARM64: Generate optimized code for Math.floor and Math.round with double outputs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 // This function must be overridden for instructions with flag kUseGVN, to 965 // This function must be overridden for instructions with flag kUseGVN, to
966 // compare the non-Operand parts of the instruction. 966 // compare the non-Operand parts of the instruction.
967 virtual bool DataEquals(HValue* other) { 967 virtual bool DataEquals(HValue* other) {
968 UNREACHABLE(); 968 UNREACHABLE();
969 return false; 969 return false;
970 } 970 }
971 971
972 virtual Representation RepresentationFromInputs() { 972 virtual Representation RepresentationFromInputs() {
973 return representation(); 973 return representation();
974 } 974 }
975 Representation RepresentationFromUses(); 975 virtual Representation RepresentationFromUses();
976 Representation RepresentationFromUseRequirements(); 976 Representation RepresentationFromUseRequirements();
977 bool HasNonSmiUse(); 977 bool HasNonSmiUse();
978 virtual void UpdateRepresentation(Representation new_rep, 978 virtual void UpdateRepresentation(Representation new_rep,
979 HInferRepresentationPhase* h_infer, 979 HInferRepresentationPhase* h_infer,
980 const char* reason); 980 const char* reason);
981 void AddDependantsToWorklist(HInferRepresentationPhase* h_infer); 981 void AddDependantsToWorklist(HInferRepresentationPhase* h_infer);
982 982
983 virtual void RepresentationChanged(Representation to) { } 983 virtual void RepresentationChanged(Representation to) { }
984 984
985 virtual Range* InferRange(Zone* zone); 985 virtual Range* InferRange(Zone* zone);
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
2649 default: 2649 default:
2650 UNREACHABLE(); 2650 UNREACHABLE();
2651 return Representation::None(); 2651 return Representation::None();
2652 } 2652 }
2653 } 2653 }
2654 } 2654 }
2655 2655
2656 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 2656 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
2657 2657
2658 virtual HValue* Canonicalize() V8_OVERRIDE; 2658 virtual HValue* Canonicalize() V8_OVERRIDE;
2659 virtual Representation RepresentationFromUses() V8_OVERRIDE;
2659 virtual Representation RepresentationFromInputs() V8_OVERRIDE; 2660 virtual Representation RepresentationFromInputs() V8_OVERRIDE;
2660 2661
2661 BuiltinFunctionId op() const { return op_; } 2662 BuiltinFunctionId op() const { return op_; }
2662 const char* OpName() const; 2663 const char* OpName() const;
2663 2664
2664 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) 2665 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation)
2665 2666
2666 protected: 2667 protected:
2667 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2668 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
2668 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); 2669 HUnaryMathOperation* b = HUnaryMathOperation::cast(other);
2669 return op_ == b->op(); 2670 return op_ == b->op();
2670 } 2671 }
2671 2672
2672 private: 2673 private:
2674 // Indicates if we support a double (and int32) output for Math.floor and
2675 // Math.round.
2676 bool SupportsFlexibleFloorAndRound() const {
2677 #ifdef V8_TARGET_ARCH_ARM64
2678 return true;
2679 #else
2680 return false;
2681 #endif
2682 }
2673 HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op) 2683 HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op)
2674 : HTemplateInstruction<2>(HType::TaggedNumber()), op_(op) { 2684 : HTemplateInstruction<2>(HType::TaggedNumber()), op_(op) {
2675 SetOperandAt(0, context); 2685 SetOperandAt(0, context);
2676 SetOperandAt(1, value); 2686 SetOperandAt(1, value);
2677 switch (op) { 2687 switch (op) {
2678 case kMathFloor: 2688 case kMathFloor:
2679 case kMathRound: 2689 case kMathRound:
2690 if (SupportsFlexibleFloorAndRound()) {
2691 SetFlag(kFlexibleRepresentation);
2692 } else {
2693 set_representation(Representation::Integer32());
2694 }
2695 break;
2680 case kMathClz32: 2696 case kMathClz32:
2681 set_representation(Representation::Integer32()); 2697 set_representation(Representation::Integer32());
2682 break; 2698 break;
2683 case kMathAbs: 2699 case kMathAbs:
2684 // Not setting representation here: it is None intentionally. 2700 // Not setting representation here: it is None intentionally.
2685 SetFlag(kFlexibleRepresentation); 2701 SetFlag(kFlexibleRepresentation);
2686 // TODO(svenpanne) This flag is actually only needed if representation() 2702 // TODO(svenpanne) This flag is actually only needed if representation()
2687 // is tagged, and not when it is an unboxed double or unboxed integer. 2703 // is tagged, and not when it is an unboxed double or unboxed integer.
2688 SetChangesFlag(kNewSpacePromotion); 2704 SetChangesFlag(kNewSpacePromotion);
2689 break; 2705 break;
(...skipping 4876 matching lines...) Expand 10 before | Expand all | Expand 10 after
7566 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7582 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7567 }; 7583 };
7568 7584
7569 7585
7570 #undef DECLARE_INSTRUCTION 7586 #undef DECLARE_INSTRUCTION
7571 #undef DECLARE_CONCRETE_INSTRUCTION 7587 #undef DECLARE_CONCRETE_INSTRUCTION
7572 7588
7573 } } // namespace v8::internal 7589 } } // namespace v8::internal
7574 7590
7575 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7591 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698