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

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

Issue 21055011: First implementation of allocation elimination in Hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 7 years, 4 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/hydrogen-escape-analysis.cc ('k') | src/ia32/lithium-codegen-ia32.h » ('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 // 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 V(CallConstantFunction) \ 79 V(CallConstantFunction) \
80 V(CallFunction) \ 80 V(CallFunction) \
81 V(CallGlobal) \ 81 V(CallGlobal) \
82 V(CallKeyed) \ 82 V(CallKeyed) \
83 V(CallKnownGlobal) \ 83 V(CallKnownGlobal) \
84 V(CallNamed) \ 84 V(CallNamed) \
85 V(CallNew) \ 85 V(CallNew) \
86 V(CallNewArray) \ 86 V(CallNewArray) \
87 V(CallRuntime) \ 87 V(CallRuntime) \
88 V(CallStub) \ 88 V(CallStub) \
89 V(CapturedObject) \
89 V(Change) \ 90 V(Change) \
90 V(CheckFunction) \ 91 V(CheckFunction) \
91 V(CheckHeapObject) \ 92 V(CheckHeapObject) \
92 V(CheckInstanceType) \ 93 V(CheckInstanceType) \
93 V(CheckMaps) \ 94 V(CheckMaps) \
94 V(CheckMapValue) \ 95 V(CheckMapValue) \
95 V(CheckSmi) \ 96 V(CheckSmi) \
96 V(ClampToUint8) \ 97 V(ClampToUint8) \
97 V(ClassOfTestAndBranch) \ 98 V(ClassOfTestAndBranch) \
98 V(CompareNumericAndBranch) \ 99 V(CompareNumericAndBranch) \
(...skipping 2654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 } 2754 }
2754 2755
2755 DECLARE_CONCRETE_INSTRUCTION(IsNumberAndBranch) 2756 DECLARE_CONCRETE_INSTRUCTION(IsNumberAndBranch)
2756 }; 2757 };
2757 2758
2758 2759
2759 class HCheckHeapObject: public HUnaryOperation { 2760 class HCheckHeapObject: public HUnaryOperation {
2760 public: 2761 public:
2761 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*); 2762 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*);
2762 2763
2764 virtual bool HasEscapingOperandAt(int index) { return false; }
2763 virtual Representation RequiredInputRepresentation(int index) { 2765 virtual Representation RequiredInputRepresentation(int index) {
2764 return Representation::Tagged(); 2766 return Representation::Tagged();
2765 } 2767 }
2766 2768
2767 #ifdef DEBUG 2769 #ifdef DEBUG
2768 virtual void Verify(); 2770 virtual void Verify();
2769 #endif 2771 #endif
2770 2772
2771 virtual HValue* Canonicalize() { 2773 virtual HValue* Canonicalize() {
2772 return value()->type().IsHeapObject() ? NULL : this; 2774 return value()->type().IsHeapObject() ? NULL : this;
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
3116 int non_phi_uses_[Representation::kNumRepresentations]; 3118 int non_phi_uses_[Representation::kNumRepresentations];
3117 int indirect_uses_[Representation::kNumRepresentations]; 3119 int indirect_uses_[Representation::kNumRepresentations];
3118 int phi_id_; 3120 int phi_id_;
3119 InductionVariableData* induction_variable_data_; 3121 InductionVariableData* induction_variable_data_;
3120 3122
3121 // TODO(titzer): we can't eliminate the receiver for generating backtraces 3123 // TODO(titzer): we can't eliminate the receiver for generating backtraces
3122 virtual bool IsDeletable() const { return !IsReceiver(); } 3124 virtual bool IsDeletable() const { return !IsReceiver(); }
3123 }; 3125 };
3124 3126
3125 3127
3126 class HArgumentsObject: public HTemplateInstruction<0> { 3128 // Common base class for HArgumentsObject and HCapturedObject.
3129 class HDematerializedObject: public HTemplateInstruction<0> {
3127 public: 3130 public:
3128 static HArgumentsObject* New(Zone* zone, 3131 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {}
3129 HValue* context,
3130 int count) {
3131 return new(zone) HArgumentsObject(count, zone);
3132 }
3133
3134 const ZoneList<HValue*>* arguments_values() const { return &values_; }
3135 int arguments_count() const { return values_.length(); }
3136
3137 void AddArgument(HValue* argument, Zone* zone) {
3138 values_.Add(NULL, zone); // Resize list.
3139 SetOperandAt(values_.length() - 1, argument);
3140 }
3141 3132
3142 virtual int OperandCount() { return values_.length(); } 3133 virtual int OperandCount() { return values_.length(); }
3143 virtual HValue* OperandAt(int index) const { return values_[index]; } 3134 virtual HValue* OperandAt(int index) const { return values_[index]; }
3144 3135
3145 virtual bool HasEscapingOperandAt(int index) { return false; } 3136 virtual bool HasEscapingOperandAt(int index) { return false; }
3146 virtual Representation RequiredInputRepresentation(int index) { 3137 virtual Representation RequiredInputRepresentation(int index) {
3147 return Representation::None(); 3138 return Representation::None();
3148 } 3139 }
3149 3140
3150 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject)
3151
3152 protected: 3141 protected:
3153 virtual void InternalSetOperandAt(int index, HValue* value) { 3142 virtual void InternalSetOperandAt(int index, HValue* value) {
3154 values_[index] = value; 3143 values_[index] = value;
3155 } 3144 }
3156 3145
3146 // List of values tracked by this marker.
3147 ZoneList<HValue*> values_;
3148
3157 private: 3149 private:
3158 HArgumentsObject(int count, Zone* zone) : values_(count, zone) { 3150 virtual bool IsDeletable() const { return true; }
3151 };
3152
3153
3154 class HArgumentsObject: public HDematerializedObject {
3155 public:
3156 static HArgumentsObject* New(Zone* zone, HValue* context, int count) {
3157 return new(zone) HArgumentsObject(count, zone);
3158 }
3159
3160 // The values contain a list of all elements in the arguments object
3161 // including the receiver object, which is skipped when materializing.
3162 const ZoneList<HValue*>* arguments_values() const { return &values_; }
3163 int arguments_count() const { return values_.length(); }
3164
3165 void AddArgument(HValue* argument, Zone* zone) {
3166 values_.Add(NULL, zone); // Resize list.
3167 SetOperandAt(values_.length() - 1, argument);
3168 }
3169
3170 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject)
3171
3172 private:
3173 HArgumentsObject(int count, Zone* zone)
3174 : HDematerializedObject(count, zone) {
3159 set_representation(Representation::Tagged()); 3175 set_representation(Representation::Tagged());
3160 SetFlag(kIsArguments); 3176 SetFlag(kIsArguments);
3161 } 3177 }
3162
3163 virtual bool IsDeletable() const { return true; }
3164
3165 ZoneList<HValue*> values_;
3166 }; 3178 };
3167 3179
3168 3180
3181 class HCapturedObject: public HDematerializedObject {
3182 public:
3183 HCapturedObject(int length, Zone* zone)
3184 : HDematerializedObject(length, zone) {
3185 set_representation(Representation::Tagged());
3186 values_.AddBlock(NULL, length, zone); // Resize list.
3187 }
3188
3189 // The values contain a list of all in-object properties inside the
3190 // captured object and is index by field index. Properties in the
3191 // properties or elements backing store are not tracked here.
3192 const ZoneList<HValue*>* values() const { return &values_; }
3193 int length() const { return values_.length(); }
3194
3195 DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
3196 };
3197
3198
3169 class HConstant: public HTemplateInstruction<0> { 3199 class HConstant: public HTemplateInstruction<0> {
3170 public: 3200 public:
3171 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); 3201 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t);
3172 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); 3202 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation);
3173 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); 3203 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double);
3174 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); 3204 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>);
3175 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); 3205 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference);
3176 3206
3177 Handle<Object> handle() { 3207 Handle<Object> handle() {
3178 if (handle_.is_null()) { 3208 if (handle_.is_null()) {
(...skipping 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after
6000 StrictModeFlag strict_mode_flag_; 6030 StrictModeFlag strict_mode_flag_;
6001 }; 6031 };
6002 6032
6003 6033
6004 class HStoreKeyed 6034 class HStoreKeyed
6005 : public HTemplateInstruction<3>, public ArrayInstructionInterface { 6035 : public HTemplateInstruction<3>, public ArrayInstructionInterface {
6006 public: 6036 public:
6007 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, 6037 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*,
6008 ElementsKind); 6038 ElementsKind);
6009 6039
6010 virtual bool HasEscapingOperandAt(int index) { return index != 0; }
6011 virtual Representation RequiredInputRepresentation(int index) { 6040 virtual Representation RequiredInputRepresentation(int index) {
6012 // kind_fast: tagged[int32] = tagged 6041 // kind_fast: tagged[int32] = tagged
6013 // kind_double: tagged[int32] = double 6042 // kind_double: tagged[int32] = double
6014 // kind_smi : tagged[int32] = smi 6043 // kind_smi : tagged[int32] = smi
6015 // kind_external: external[int32] = (double | int32) 6044 // kind_external: external[int32] = (double | int32)
6016 if (index == 0) { 6045 if (index == 0) {
6017 return is_external() ? Representation::External() 6046 return is_external() ? Representation::External()
6018 : Representation::Tagged(); 6047 : Representation::Tagged();
6019 } else if (index == 1) { 6048 } else if (index == 1) {
6020 return ArrayInstructionInterface::KeyedAccessIndexRequirement( 6049 return ArrayInstructionInterface::KeyedAccessIndexRequirement(
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
6749 virtual bool IsDeletable() const { return true; } 6778 virtual bool IsDeletable() const { return true; }
6750 }; 6779 };
6751 6780
6752 6781
6753 #undef DECLARE_INSTRUCTION 6782 #undef DECLARE_INSTRUCTION
6754 #undef DECLARE_CONCRETE_INSTRUCTION 6783 #undef DECLARE_CONCRETE_INSTRUCTION
6755 6784
6756 } } // namespace v8::internal 6785 } } // namespace v8::internal
6757 6786
6758 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6787 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-escape-analysis.cc ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698