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

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

Issue 8373029: [hydrogen] optimize switch with string clauses (Closed) Base URL: gh:v8/v8@master
Patch Set: fix lint errors, improved test Created 9 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
« no previous file with comments | « src/hydrogen.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 V(Goto) \ 111 V(Goto) \
112 V(HasCachedArrayIndexAndBranch) \ 112 V(HasCachedArrayIndexAndBranch) \
113 V(HasInstanceTypeAndBranch) \ 113 V(HasInstanceTypeAndBranch) \
114 V(In) \ 114 V(In) \
115 V(InstanceOf) \ 115 V(InstanceOf) \
116 V(InstanceOfKnownGlobal) \ 116 V(InstanceOfKnownGlobal) \
117 V(InvokeFunction) \ 117 V(InvokeFunction) \
118 V(IsConstructCallAndBranch) \ 118 V(IsConstructCallAndBranch) \
119 V(IsNilAndBranch) \ 119 V(IsNilAndBranch) \
120 V(IsObjectAndBranch) \ 120 V(IsObjectAndBranch) \
121 V(IsStringAndBranch) \
121 V(IsSmiAndBranch) \ 122 V(IsSmiAndBranch) \
122 V(IsUndetectableAndBranch) \ 123 V(IsUndetectableAndBranch) \
124 V(StringCompareAndBranch) \
123 V(JSArrayLength) \ 125 V(JSArrayLength) \
124 V(LeaveInlined) \ 126 V(LeaveInlined) \
125 V(LoadContextSlot) \ 127 V(LoadContextSlot) \
126 V(LoadElements) \ 128 V(LoadElements) \
127 V(LoadExternalArrayPointer) \ 129 V(LoadExternalArrayPointer) \
128 V(LoadFunctionPrototype) \ 130 V(LoadFunctionPrototype) \
129 V(LoadGlobalCell) \ 131 V(LoadGlobalCell) \
130 V(LoadGlobalGeneric) \ 132 V(LoadGlobalGeneric) \
131 V(LoadKeyedFastDoubleElement) \ 133 V(LoadKeyedFastDoubleElement) \
132 V(LoadKeyedFastElement) \ 134 V(LoadKeyedFastElement) \
(...skipping 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 explicit HIsObjectAndBranch(HValue* value) 2711 explicit HIsObjectAndBranch(HValue* value)
2710 : HUnaryControlInstruction(value, NULL, NULL) { } 2712 : HUnaryControlInstruction(value, NULL, NULL) { }
2711 2713
2712 virtual Representation RequiredInputRepresentation(int index) { 2714 virtual Representation RequiredInputRepresentation(int index) {
2713 return Representation::Tagged(); 2715 return Representation::Tagged();
2714 } 2716 }
2715 2717
2716 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) 2718 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch)
2717 }; 2719 };
2718 2720
2721 class HIsStringAndBranch: public HUnaryControlInstruction {
2722 public:
2723 explicit HIsStringAndBranch(HValue* value)
2724 : HUnaryControlInstruction(value, NULL, NULL) { }
2725
2726 virtual Representation RequiredInputRepresentation(int index) {
2727 return Representation::Tagged();
2728 }
2729
2730 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch)
2731 };
2732
2719 2733
2720 class HIsSmiAndBranch: public HUnaryControlInstruction { 2734 class HIsSmiAndBranch: public HUnaryControlInstruction {
2721 public: 2735 public:
2722 explicit HIsSmiAndBranch(HValue* value) 2736 explicit HIsSmiAndBranch(HValue* value)
2723 : HUnaryControlInstruction(value, NULL, NULL) { } 2737 : HUnaryControlInstruction(value, NULL, NULL) { }
2724 2738
2725 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) 2739 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch)
2726 2740
2727 virtual Representation RequiredInputRepresentation(int index) { 2741 virtual Representation RequiredInputRepresentation(int index) {
2728 return Representation::Tagged(); 2742 return Representation::Tagged();
(...skipping 10 matching lines...) Expand all
2739 : HUnaryControlInstruction(value, NULL, NULL) { } 2753 : HUnaryControlInstruction(value, NULL, NULL) { }
2740 2754
2741 virtual Representation RequiredInputRepresentation(int index) { 2755 virtual Representation RequiredInputRepresentation(int index) {
2742 return Representation::Tagged(); 2756 return Representation::Tagged();
2743 } 2757 }
2744 2758
2745 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) 2759 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch)
2746 }; 2760 };
2747 2761
2748 2762
2763 class HStringCompareAndBranch: public HTemplateControlInstruction<2, 3> {
2764 public:
2765 HStringCompareAndBranch(HValue* context,
2766 HValue* left,
2767 HValue* right,
2768 Token::Value token)
2769 : token_(token) {
2770 ASSERT(Token::IsCompareOp(token));
2771 SetOperandAt(0, context);
2772 SetOperandAt(1, left);
2773 SetOperandAt(2, right);
2774 set_representation(Representation::Tagged());
2775 }
2776
2777 HValue* context() { return OperandAt(0); }
2778 HValue* left() { return OperandAt(1); }
2779 HValue* right() { return OperandAt(2); }
2780 Token::Value token() const { return token_; }
2781
2782 virtual void PrintDataTo(StringStream* stream);
2783
2784 virtual Representation RequiredInputRepresentation(int index) {
2785 return Representation::Tagged();
2786 }
2787
2788 Representation GetInputRepresentation() const {
2789 return Representation::Tagged();
2790 }
2791
2792 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch)
2793
2794 private:
2795 Token::Value token_;
2796 };
2797
2798
2749 class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> { 2799 class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> {
2750 public: 2800 public:
2751 virtual Representation RequiredInputRepresentation(int index) { 2801 virtual Representation RequiredInputRepresentation(int index) {
2752 return Representation::None(); 2802 return Representation::None();
2753 } 2803 }
2754 2804
2755 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) 2805 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch)
2756 }; 2806 };
2757 2807
2758 2808
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
4287 4337
4288 DECLARE_CONCRETE_INSTRUCTION(In) 4338 DECLARE_CONCRETE_INSTRUCTION(In)
4289 }; 4339 };
4290 4340
4291 #undef DECLARE_INSTRUCTION 4341 #undef DECLARE_INSTRUCTION
4292 #undef DECLARE_CONCRETE_INSTRUCTION 4342 #undef DECLARE_CONCRETE_INSTRUCTION
4293 4343
4294 } } // namespace v8::internal 4344 } } // namespace v8::internal
4295 4345
4296 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4346 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698