OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_COMPILER_JS_OPERATOR_H_ | 5 #ifndef V8_COMPILER_JS_OPERATOR_H_ |
6 #define V8_COMPILER_JS_OPERATOR_H_ | 6 #define V8_COMPILER_JS_OPERATOR_H_ |
7 | 7 |
8 #include "src/runtime/runtime.h" | 8 #include "src/runtime/runtime.h" |
9 #include "src/unique.h" | 9 #include "src/unique.h" |
10 | 10 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 private: | 125 private: |
126 const Handle<TypeFeedbackVector> vector_; | 126 const Handle<TypeFeedbackVector> vector_; |
127 const FeedbackVectorICSlot slot_; | 127 const FeedbackVectorICSlot slot_; |
128 }; | 128 }; |
129 | 129 |
130 | 130 |
131 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs); | 131 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs); |
132 | 132 |
133 | 133 |
134 // For (Load|Store)Named operators, the mode of the IC that needs | |
135 // to be called. This is needed because (Load|Store)Property nodes can be | |
136 // reduced to named versions, but still need to call the correct original | |
137 // IC mode because of the layout of feedback vectors. | |
138 enum PropertyICMode { NAMED, KEYED }; | |
139 | |
140 // Defines the property being loaded from an object by a named load. This is | 134 // Defines the property being loaded from an object by a named load. This is |
141 // used as a parameter by JSLoadNamed operators. | 135 // used as a parameter by JSLoadNamed operators. |
142 class LoadNamedParameters final { | 136 class LoadNamedParameters final { |
143 public: | 137 public: |
144 LoadNamedParameters(const Unique<Name>& name, const VectorSlotPair& feedback, | 138 LoadNamedParameters(const Unique<Name>& name, const VectorSlotPair& feedback, |
145 ContextualMode contextual_mode, PropertyICMode load_ic) | 139 ContextualMode contextual_mode) |
146 : name_(name), | 140 : name_(name), feedback_(feedback), contextual_mode_(contextual_mode) {} |
147 feedback_(feedback), | |
148 contextual_mode_(contextual_mode), | |
149 load_ic_(load_ic) {} | |
150 | 141 |
151 const Unique<Name>& name() const { return name_; } | 142 const Unique<Name>& name() const { return name_; } |
152 ContextualMode contextual_mode() const { return contextual_mode_; } | 143 ContextualMode contextual_mode() const { return contextual_mode_; } |
153 PropertyICMode load_ic() const { return load_ic_; } | |
154 | 144 |
155 const VectorSlotPair& feedback() const { return feedback_; } | 145 const VectorSlotPair& feedback() const { return feedback_; } |
156 | 146 |
157 private: | 147 private: |
158 const Unique<Name> name_; | 148 const Unique<Name> name_; |
159 const VectorSlotPair feedback_; | 149 const VectorSlotPair feedback_; |
160 const ContextualMode contextual_mode_; | 150 const ContextualMode contextual_mode_; |
161 const PropertyICMode load_ic_; | |
162 }; | 151 }; |
163 | 152 |
164 bool operator==(LoadNamedParameters const&, LoadNamedParameters const&); | 153 bool operator==(LoadNamedParameters const&, LoadNamedParameters const&); |
165 bool operator!=(LoadNamedParameters const&, LoadNamedParameters const&); | 154 bool operator!=(LoadNamedParameters const&, LoadNamedParameters const&); |
166 | 155 |
167 size_t hash_value(LoadNamedParameters const&); | 156 size_t hash_value(LoadNamedParameters const&); |
168 | 157 |
169 std::ostream& operator<<(std::ostream&, LoadNamedParameters const&); | 158 std::ostream& operator<<(std::ostream&, LoadNamedParameters const&); |
170 | 159 |
171 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op); | 160 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op); |
(...skipping 19 matching lines...) Expand all Loading... |
191 | 180 |
192 std::ostream& operator<<(std::ostream&, LoadPropertyParameters const&); | 181 std::ostream& operator<<(std::ostream&, LoadPropertyParameters const&); |
193 | 182 |
194 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op); | 183 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op); |
195 | 184 |
196 | 185 |
197 // Defines the property being stored to an object by a named store. This is | 186 // Defines the property being stored to an object by a named store. This is |
198 // used as a parameter by JSStoreNamed operators. | 187 // used as a parameter by JSStoreNamed operators. |
199 class StoreNamedParameters final { | 188 class StoreNamedParameters final { |
200 public: | 189 public: |
201 StoreNamedParameters(LanguageMode language_mode, const Unique<Name>& name, | 190 StoreNamedParameters(LanguageMode language_mode, const Unique<Name>& name) |
202 PropertyICMode store_ic) | 191 : language_mode_(language_mode), name_(name) {} |
203 : language_mode_(language_mode), name_(name), store_ic_(store_ic) {} | |
204 | 192 |
205 LanguageMode language_mode() const { return language_mode_; } | 193 LanguageMode language_mode() const { return language_mode_; } |
206 const Unique<Name>& name() const { return name_; } | 194 const Unique<Name>& name() const { return name_; } |
207 PropertyICMode store_ic() const { return store_ic_; } | |
208 | 195 |
209 private: | 196 private: |
210 const LanguageMode language_mode_; | 197 const LanguageMode language_mode_; |
211 const Unique<Name> name_; | 198 const Unique<Name> name_; |
212 const PropertyICMode store_ic_; | |
213 }; | 199 }; |
214 | 200 |
215 bool operator==(StoreNamedParameters const&, StoreNamedParameters const&); | 201 bool operator==(StoreNamedParameters const&, StoreNamedParameters const&); |
216 bool operator!=(StoreNamedParameters const&, StoreNamedParameters const&); | 202 bool operator!=(StoreNamedParameters const&, StoreNamedParameters const&); |
217 | 203 |
218 size_t hash_value(StoreNamedParameters const&); | 204 size_t hash_value(StoreNamedParameters const&); |
219 | 205 |
220 std::ostream& operator<<(std::ostream&, StoreNamedParameters const&); | 206 std::ostream& operator<<(std::ostream&, StoreNamedParameters const&); |
221 | 207 |
222 const StoreNamedParameters& StoreNamedParametersOf(const Operator* op); | 208 const StoreNamedParameters& StoreNamedParametersOf(const Operator* op); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 277 |
292 const Operator* CallFunction(size_t arity, CallFunctionFlags flags, | 278 const Operator* CallFunction(size_t arity, CallFunctionFlags flags, |
293 LanguageMode language_mode); | 279 LanguageMode language_mode); |
294 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); | 280 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); |
295 | 281 |
296 const Operator* CallConstruct(int arguments); | 282 const Operator* CallConstruct(int arguments); |
297 | 283 |
298 const Operator* LoadProperty(const VectorSlotPair& feedback); | 284 const Operator* LoadProperty(const VectorSlotPair& feedback); |
299 const Operator* LoadNamed(const Unique<Name>& name, | 285 const Operator* LoadNamed(const Unique<Name>& name, |
300 const VectorSlotPair& feedback, | 286 const VectorSlotPair& feedback, |
301 ContextualMode contextual_mode = NOT_CONTEXTUAL, | 287 ContextualMode contextual_mode = NOT_CONTEXTUAL); |
302 PropertyICMode load_ic = NAMED); | |
303 | 288 |
304 const Operator* StoreProperty(LanguageMode language_mode); | 289 const Operator* StoreProperty(LanguageMode language_mode); |
305 const Operator* StoreNamed(LanguageMode language_mode, | 290 const Operator* StoreNamed(LanguageMode language_mode, |
306 const Unique<Name>& name, | 291 const Unique<Name>& name); |
307 PropertyICMode store_ic = NAMED); | |
308 | 292 |
309 const Operator* DeleteProperty(LanguageMode language_mode); | 293 const Operator* DeleteProperty(LanguageMode language_mode); |
310 | 294 |
311 const Operator* HasProperty(); | 295 const Operator* HasProperty(); |
312 | 296 |
313 const Operator* LoadContext(size_t depth, size_t index, bool immutable); | 297 const Operator* LoadContext(size_t depth, size_t index, bool immutable); |
314 const Operator* StoreContext(size_t depth, size_t index); | 298 const Operator* StoreContext(size_t depth, size_t index); |
315 | 299 |
316 const Operator* TypeOf(); | 300 const Operator* TypeOf(); |
317 const Operator* InstanceOf(); | 301 const Operator* InstanceOf(); |
(...skipping 15 matching lines...) Expand all Loading... |
333 Zone* const zone_; | 317 Zone* const zone_; |
334 | 318 |
335 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 319 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
336 }; | 320 }; |
337 | 321 |
338 } // namespace compiler | 322 } // namespace compiler |
339 } // namespace internal | 323 } // namespace internal |
340 } // namespace v8 | 324 } // namespace v8 |
341 | 325 |
342 #endif // V8_COMPILER_JS_OPERATOR_H_ | 326 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |