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

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: use type feedback to bailout switches with known beforehand string(non-symbol) comparison 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
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(CompareGenericAndBranch) \
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 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after
2708 explicit HIsObjectAndBranch(HValue* value) 2710 explicit HIsObjectAndBranch(HValue* value)
2709 : HUnaryControlInstruction(value, NULL, NULL) { } 2711 : HUnaryControlInstruction(value, NULL, NULL) { }
2710 2712
2711 virtual Representation RequiredInputRepresentation(int index) { 2713 virtual Representation RequiredInputRepresentation(int index) {
2712 return Representation::Tagged(); 2714 return Representation::Tagged();
2713 } 2715 }
2714 2716
2715 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) 2717 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch)
2716 }; 2718 };
2717 2719
2720 class HIsStringAndBranch: public HUnaryControlInstruction {
2721 public:
2722 explicit HIsStringAndBranch(HValue* value)
2723 : HUnaryControlInstruction(value, NULL, NULL) { }
2724
2725 virtual Representation RequiredInputRepresentation(int index) {
2726 return Representation::Tagged();
2727 }
2728
2729 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch)
2730 };
2731
2718 2732
2719 class HIsSmiAndBranch: public HUnaryControlInstruction { 2733 class HIsSmiAndBranch: public HUnaryControlInstruction {
2720 public: 2734 public:
2721 explicit HIsSmiAndBranch(HValue* value) 2735 explicit HIsSmiAndBranch(HValue* value)
2722 : HUnaryControlInstruction(value, NULL, NULL) { } 2736 : HUnaryControlInstruction(value, NULL, NULL) { }
2723 2737
2724 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) 2738 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch)
2725 2739
2726 virtual Representation RequiredInputRepresentation(int index) { 2740 virtual Representation RequiredInputRepresentation(int index) {
2727 return Representation::Tagged(); 2741 return Representation::Tagged();
(...skipping 10 matching lines...) Expand all
2738 : HUnaryControlInstruction(value, NULL, NULL) { } 2752 : HUnaryControlInstruction(value, NULL, NULL) { }
2739 2753
2740 virtual Representation RequiredInputRepresentation(int index) { 2754 virtual Representation RequiredInputRepresentation(int index) {
2741 return Representation::Tagged(); 2755 return Representation::Tagged();
2742 } 2756 }
2743 2757
2744 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) 2758 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch)
2745 }; 2759 };
2746 2760
2747 2761
2762 class HCompareGenericAndBranch: public HTemplateControlInstruction<2, 3> {
fschneider 2011/11/07 08:27:18 This should rather be HStringCompareAndBranch. It
2763 public:
2764 HCompareGenericAndBranch(HValue* context,
2765 HValue* left,
2766 HValue* right,
2767 Token::Value token)
2768 : token_(token) {
2769 ASSERT(Token::IsCompareOp(token));
2770 SetOperandAt(0, context);
2771 SetOperandAt(1, left);
2772 SetOperandAt(2, right);
2773 set_representation(Representation::Tagged());
2774 }
2775
2776 HValue* context() { return OperandAt(0); }
2777 HValue* left() { return OperandAt(1); }
2778 HValue* right() { return OperandAt(2); }
2779 Token::Value token() const { return token_; }
2780
2781 virtual void PrintDataTo(StringStream* stream);
2782
2783 virtual Representation RequiredInputRepresentation(int index) {
2784 return Representation::Tagged();
2785 }
2786
2787 Representation GetInputRepresentation() const {
2788 return Representation::Tagged();
2789 }
2790
2791 DECLARE_CONCRETE_INSTRUCTION(CompareGenericAndBranch)
2792
2793 private:
2794 Token::Value token_;
2795 };
2796
2797
2748 class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> { 2798 class HIsConstructCallAndBranch: public HTemplateControlInstruction<2, 0> {
2749 public: 2799 public:
2750 virtual Representation RequiredInputRepresentation(int index) { 2800 virtual Representation RequiredInputRepresentation(int index) {
2751 return Representation::None(); 2801 return Representation::None();
2752 } 2802 }
2753 2803
2754 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) 2804 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch)
2755 }; 2805 };
2756 2806
2757 2807
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
4285 4335
4286 DECLARE_CONCRETE_INSTRUCTION(In) 4336 DECLARE_CONCRETE_INSTRUCTION(In)
4287 }; 4337 };
4288 4338
4289 #undef DECLARE_INSTRUCTION 4339 #undef DECLARE_INSTRUCTION
4290 #undef DECLARE_CONCRETE_INSTRUCTION 4340 #undef DECLARE_CONCRETE_INSTRUCTION
4291 4341
4292 } } // namespace v8::internal 4342 } } // namespace v8::internal
4293 4343
4294 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4344 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698