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

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

Issue 10735020: Optimize Smi keys for KeyedLoads (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge with latest Created 8 years, 5 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 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) 1866 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength)
1867 1867
1868 protected: 1868 protected:
1869 virtual bool DataEquals(HValue* other_raw) { return true; } 1869 virtual bool DataEquals(HValue* other_raw) { return true; }
1870 }; 1870 };
1871 1871
1872 1872
1873 class HFixedArrayBaseLength: public HUnaryOperation { 1873 class HFixedArrayBaseLength: public HUnaryOperation {
1874 public: 1874 public:
1875 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { 1875 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) {
1876 set_type(HType::Smi());
1876 set_representation(Representation::Tagged()); 1877 set_representation(Representation::Tagged());
1877 SetFlag(kUseGVN); 1878 SetFlag(kUseGVN);
1878 SetGVNFlag(kDependsOnArrayLengths); 1879 SetGVNFlag(kDependsOnArrayLengths);
1879 } 1880 }
1880 1881
1881 virtual Representation RequiredInputRepresentation(int index) { 1882 virtual Representation RequiredInputRepresentation(int index) {
1882 return Representation::Tagged(); 1883 return Representation::Tagged();
1883 } 1884 }
1884 1885
1885 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength) 1886 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength)
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 HValue* arguments() { return OperandAt(0); } 2736 HValue* arguments() { return OperandAt(0); }
2736 HValue* length() { return OperandAt(1); } 2737 HValue* length() { return OperandAt(1); }
2737 HValue* index() { return OperandAt(2); } 2738 HValue* index() { return OperandAt(2); }
2738 2739
2739 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) 2740 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt)
2740 2741
2741 virtual bool DataEquals(HValue* other) { return true; } 2742 virtual bool DataEquals(HValue* other) { return true; }
2742 }; 2743 };
2743 2744
2744 2745
2746 enum BoundsCheckKeyMode {
2747 DONT_ALLOW_SMI_KEY,
2748 ALLOW_SMI_KEY
2749 };
2750
2751
2745 class HBoundsCheck: public HTemplateInstruction<2> { 2752 class HBoundsCheck: public HTemplateInstruction<2> {
2746 public: 2753 public:
2747 HBoundsCheck(HValue* index, HValue* length) { 2754 HBoundsCheck(HValue* index, HValue* length,
2755 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY)
2756 : key_mode_(key_mode) {
2748 SetOperandAt(0, index); 2757 SetOperandAt(0, index);
2749 SetOperandAt(1, length); 2758 SetOperandAt(1, length);
2750 set_representation(Representation::Integer32()); 2759 set_representation(Representation::Integer32());
2751 SetFlag(kUseGVN); 2760 SetFlag(kUseGVN);
2752 } 2761 }
2753 2762
2754 virtual Representation RequiredInputRepresentation(int index) { 2763 virtual Representation RequiredInputRepresentation(int arg_index) {
2755 return Representation::Integer32(); 2764 if (index()->representation().IsTagged() &&
2765 !index()->IsConstant() &&
2766 key_mode_ == ALLOW_SMI_KEY) {
2767 return Representation::Tagged();
2768 } else {
2769 return Representation::Integer32();
2770 }
2756 } 2771 }
2757 2772
2758 virtual void PrintDataTo(StringStream* stream); 2773 virtual void PrintDataTo(StringStream* stream);
2759 2774
2760 HValue* index() { return OperandAt(0); } 2775 HValue* index() { return OperandAt(0); }
2761 HValue* length() { return OperandAt(1); } 2776 HValue* length() { return OperandAt(1); }
2762 2777
2763 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) 2778 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck)
2764 2779
2765 protected: 2780 protected:
2766 virtual bool DataEquals(HValue* other) { return true; } 2781 virtual bool DataEquals(HValue* other) { return true; }
2782 BoundsCheckKeyMode key_mode_;
2767 }; 2783 };
2768 2784
2769 2785
2770 class HBitwiseBinaryOperation: public HBinaryOperation { 2786 class HBitwiseBinaryOperation: public HBinaryOperation {
2771 public: 2787 public:
2772 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right) 2788 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right)
2773 : HBinaryOperation(context, left, right) { 2789 : HBinaryOperation(context, left, right) {
2774 set_representation(Representation::Tagged()); 2790 set_representation(Representation::Tagged());
2775 SetFlag(kFlexibleRepresentation); 2791 SetFlag(kFlexibleRepresentation);
2776 SetAllSideEffects(); 2792 SetAllSideEffects();
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after
5145 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); 5161 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex);
5146 }; 5162 };
5147 5163
5148 5164
5149 #undef DECLARE_INSTRUCTION 5165 #undef DECLARE_INSTRUCTION
5150 #undef DECLARE_CONCRETE_INSTRUCTION 5166 #undef DECLARE_CONCRETE_INSTRUCTION
5151 5167
5152 } } // namespace v8::internal 5168 } } // namespace v8::internal
5153 5169
5154 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 5170 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698