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

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: Change C-style comments to C++-style comments Created 6 years, 7 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/arm64/lithium-codegen-arm64.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ 6 #define V8_HYDROGEN_INSTRUCTIONS_H_
7 7
8 #include "v8.h" 8 #include "v8.h"
9 9
10 #include "allocation.h" 10 #include "allocation.h"
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 // This function must be overridden for instructions with flag kUseGVN, to 942 // This function must be overridden for instructions with flag kUseGVN, to
943 // compare the non-Operand parts of the instruction. 943 // compare the non-Operand parts of the instruction.
944 virtual bool DataEquals(HValue* other) { 944 virtual bool DataEquals(HValue* other) {
945 UNREACHABLE(); 945 UNREACHABLE();
946 return false; 946 return false;
947 } 947 }
948 948
949 virtual Representation RepresentationFromInputs() { 949 virtual Representation RepresentationFromInputs() {
950 return representation(); 950 return representation();
951 } 951 }
952 Representation RepresentationFromUses(); 952 virtual Representation RepresentationFromUses();
953 Representation RepresentationFromUseRequirements(); 953 Representation RepresentationFromUseRequirements();
954 bool HasNonSmiUse(); 954 bool HasNonSmiUse();
955 virtual void UpdateRepresentation(Representation new_rep, 955 virtual void UpdateRepresentation(Representation new_rep,
956 HInferRepresentationPhase* h_infer, 956 HInferRepresentationPhase* h_infer,
957 const char* reason); 957 const char* reason);
958 void AddDependantsToWorklist(HInferRepresentationPhase* h_infer); 958 void AddDependantsToWorklist(HInferRepresentationPhase* h_infer);
959 959
960 virtual void RepresentationChanged(Representation to) { } 960 virtual void RepresentationChanged(Representation to) { }
961 961
962 virtual Range* InferRange(Zone* zone); 962 virtual Range* InferRange(Zone* zone);
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
2631 default: 2631 default:
2632 UNREACHABLE(); 2632 UNREACHABLE();
2633 return Representation::None(); 2633 return Representation::None();
2634 } 2634 }
2635 } 2635 }
2636 } 2636 }
2637 2637
2638 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 2638 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
2639 2639
2640 virtual HValue* Canonicalize() V8_OVERRIDE; 2640 virtual HValue* Canonicalize() V8_OVERRIDE;
2641 virtual Representation RepresentationFromUses() V8_OVERRIDE;
2641 virtual Representation RepresentationFromInputs() V8_OVERRIDE; 2642 virtual Representation RepresentationFromInputs() V8_OVERRIDE;
2642 2643
2643 BuiltinFunctionId op() const { return op_; } 2644 BuiltinFunctionId op() const { return op_; }
2644 const char* OpName() const; 2645 const char* OpName() const;
2645 2646
2646 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) 2647 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation)
2647 2648
2648 protected: 2649 protected:
2649 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2650 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
2650 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); 2651 HUnaryMathOperation* b = HUnaryMathOperation::cast(other);
2651 return op_ == b->op(); 2652 return op_ == b->op();
2652 } 2653 }
2653 2654
2654 private: 2655 private:
2656 // Indicates if we support a double (and int32) output for Math.floor and
2657 // Math.round.
2658 bool SupportsFlexibleFloorAndRound() const {
2659 #ifdef V8_TARGET_ARCH_ARM64
2660 return true;
2661 #else
2662 return false;
2663 #endif
2664 }
2655 HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op) 2665 HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op)
2656 : HTemplateInstruction<2>(HType::TaggedNumber()), op_(op) { 2666 : HTemplateInstruction<2>(HType::TaggedNumber()), op_(op) {
2657 SetOperandAt(0, context); 2667 SetOperandAt(0, context);
2658 SetOperandAt(1, value); 2668 SetOperandAt(1, value);
2659 switch (op) { 2669 switch (op) {
2660 case kMathFloor: 2670 case kMathFloor:
2661 case kMathRound: 2671 case kMathRound:
2672 if (SupportsFlexibleFloorAndRound()) {
2673 SetFlag(kFlexibleRepresentation);
2674 } else {
2675 set_representation(Representation::Integer32());
2676 }
2677 break;
2662 case kMathClz32: 2678 case kMathClz32:
2663 set_representation(Representation::Integer32()); 2679 set_representation(Representation::Integer32());
2664 break; 2680 break;
2665 case kMathAbs: 2681 case kMathAbs:
2666 // Not setting representation here: it is None intentionally. 2682 // Not setting representation here: it is None intentionally.
2667 SetFlag(kFlexibleRepresentation); 2683 SetFlag(kFlexibleRepresentation);
2668 // TODO(svenpanne) This flag is actually only needed if representation() 2684 // TODO(svenpanne) This flag is actually only needed if representation()
2669 // is tagged, and not when it is an unboxed double or unboxed integer. 2685 // is tagged, and not when it is an unboxed double or unboxed integer.
2670 SetChangesFlag(kNewSpacePromotion); 2686 SetChangesFlag(kNewSpacePromotion);
2671 break; 2687 break;
(...skipping 4876 matching lines...) Expand 10 before | Expand all | Expand 10 after
7548 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7564 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7549 }; 7565 };
7550 7566
7551 7567
7552 #undef DECLARE_INSTRUCTION 7568 #undef DECLARE_INSTRUCTION
7553 #undef DECLARE_CONCRETE_INSTRUCTION 7569 #undef DECLARE_CONCRETE_INSTRUCTION
7554 7570
7555 } } // namespace v8::internal 7571 } } // namespace v8::internal
7556 7572
7557 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7573 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698