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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 ContextAccess const& ContextAccessOf(Operator const*); | 152 ContextAccess const& ContextAccessOf(Operator const*); |
153 | 153 |
154 | 154 |
155 // Defines the name for a dynamic variable lookup. The {check_bitset} allows to | 155 // Defines the name for a dynamic variable lookup. The {check_bitset} allows to |
156 // inline checks whether the lookup yields in a global variable. This is used as | 156 // inline checks whether the lookup yields in a global variable. This is used as |
157 // a parameter by JSLoadDynamicGlobal and JSStoreDynamicGlobal operators. | 157 // a parameter by JSLoadDynamicGlobal and JSStoreDynamicGlobal operators. |
158 class DynamicGlobalAccess final { | 158 class DynamicGlobalAccess final { |
159 public: | 159 public: |
160 DynamicGlobalAccess(const Handle<String>& name, uint32_t check_bitset, | 160 DynamicGlobalAccess(const Handle<String>& name, uint32_t check_bitset, |
161 const VectorSlotPair& feedback, ContextualMode mode); | 161 const VectorSlotPair& feedback, TypeofMode typeof_mode); |
162 | 162 |
163 const Handle<String>& name() const { return name_; } | 163 const Handle<String>& name() const { return name_; } |
164 uint32_t check_bitset() const { return check_bitset_; } | 164 uint32_t check_bitset() const { return check_bitset_; } |
165 const VectorSlotPair& feedback() const { return feedback_; } | 165 const VectorSlotPair& feedback() const { return feedback_; } |
166 ContextualMode mode() const { return mode_; } | 166 TypeofMode typeof_mode() const { return typeof_mode_; } |
167 | 167 |
168 // Indicates that an inline check is disabled. | 168 // Indicates that an inline check is disabled. |
169 bool RequiresFullCheck() const { | 169 bool RequiresFullCheck() const { |
170 return check_bitset() == kFullCheckRequired; | 170 return check_bitset() == kFullCheckRequired; |
171 } | 171 } |
172 | 172 |
173 // Limit of context chain length to which inline check is possible. | 173 // Limit of context chain length to which inline check is possible. |
174 static const int kMaxCheckDepth = 30; | 174 static const int kMaxCheckDepth = 30; |
175 | 175 |
176 // Sentinel for {check_bitset} disabling inline checks. | 176 // Sentinel for {check_bitset} disabling inline checks. |
177 static const uint32_t kFullCheckRequired = -1; | 177 static const uint32_t kFullCheckRequired = -1; |
178 | 178 |
179 private: | 179 private: |
180 const Handle<String> name_; | 180 const Handle<String> name_; |
181 const uint32_t check_bitset_; | 181 const uint32_t check_bitset_; |
182 const VectorSlotPair feedback_; | 182 const VectorSlotPair feedback_; |
183 const ContextualMode mode_; | 183 const TypeofMode typeof_mode_; |
184 }; | 184 }; |
185 | 185 |
186 size_t hash_value(DynamicGlobalAccess const&); | 186 size_t hash_value(DynamicGlobalAccess const&); |
187 | 187 |
188 bool operator==(DynamicGlobalAccess const&, DynamicGlobalAccess const&); | 188 bool operator==(DynamicGlobalAccess const&, DynamicGlobalAccess const&); |
189 bool operator!=(DynamicGlobalAccess const&, DynamicGlobalAccess const&); | 189 bool operator!=(DynamicGlobalAccess const&, DynamicGlobalAccess const&); |
190 | 190 |
191 std::ostream& operator<<(std::ostream&, DynamicGlobalAccess const&); | 191 std::ostream& operator<<(std::ostream&, DynamicGlobalAccess const&); |
192 | 192 |
193 DynamicGlobalAccess const& DynamicGlobalAccessOf(Operator const*); | 193 DynamicGlobalAccess const& DynamicGlobalAccessOf(Operator const*); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 std::ostream& operator<<(std::ostream&, DynamicContextAccess const&); | 230 std::ostream& operator<<(std::ostream&, DynamicContextAccess const&); |
231 | 231 |
232 DynamicContextAccess const& DynamicContextAccessOf(Operator const*); | 232 DynamicContextAccess const& DynamicContextAccessOf(Operator const*); |
233 | 233 |
234 | 234 |
235 // Defines the property being loaded from an object by a named load. This is | 235 // Defines the property being loaded from an object by a named load. This is |
236 // used as a parameter by JSLoadNamed operators. | 236 // used as a parameter by JSLoadNamed operators. |
237 class LoadNamedParameters final { | 237 class LoadNamedParameters final { |
238 public: | 238 public: |
239 LoadNamedParameters(const Unique<Name>& name, const VectorSlotPair& feedback, | 239 LoadNamedParameters(const Unique<Name>& name, const VectorSlotPair& feedback, |
240 LanguageMode language_mode, | 240 LanguageMode language_mode) |
241 ContextualMode contextual_mode) | 241 : name_(name), feedback_(feedback), language_mode_(language_mode) {} |
242 : name_(name), | |
243 feedback_(feedback), | |
244 language_mode_(language_mode), | |
245 contextual_mode_(contextual_mode) {} | |
246 | 242 |
247 const Unique<Name>& name() const { return name_; } | 243 const Unique<Name>& name() const { return name_; } |
248 LanguageMode language_mode() const { return language_mode_; } | 244 LanguageMode language_mode() const { return language_mode_; } |
249 ContextualMode contextual_mode() const { return contextual_mode_; } | |
250 | 245 |
251 const VectorSlotPair& feedback() const { return feedback_; } | 246 const VectorSlotPair& feedback() const { return feedback_; } |
252 | 247 |
253 private: | 248 private: |
254 const Unique<Name> name_; | 249 const Unique<Name> name_; |
255 const VectorSlotPair feedback_; | 250 const VectorSlotPair feedback_; |
256 const LanguageMode language_mode_; | 251 const LanguageMode language_mode_; |
257 const ContextualMode contextual_mode_; | |
258 }; | 252 }; |
259 | 253 |
260 bool operator==(LoadNamedParameters const&, LoadNamedParameters const&); | 254 bool operator==(LoadNamedParameters const&, LoadNamedParameters const&); |
261 bool operator!=(LoadNamedParameters const&, LoadNamedParameters const&); | 255 bool operator!=(LoadNamedParameters const&, LoadNamedParameters const&); |
262 | 256 |
263 size_t hash_value(LoadNamedParameters const&); | 257 size_t hash_value(LoadNamedParameters const&); |
264 | 258 |
265 std::ostream& operator<<(std::ostream&, LoadNamedParameters const&); | 259 std::ostream& operator<<(std::ostream&, LoadNamedParameters const&); |
266 | 260 |
267 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op); | 261 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op); |
268 | 262 |
269 | 263 |
270 // Defines the property being loaded from an object by a named load. This is | 264 // Defines the property being loaded from an object by a named load. This is |
271 // used as a parameter by JSLoadGlobal operator. | 265 // used as a parameter by JSLoadGlobal operator. |
272 class LoadGlobalParameters final { | 266 class LoadGlobalParameters final { |
273 public: | 267 public: |
274 LoadGlobalParameters(const Unique<Name>& name, const VectorSlotPair& feedback, | 268 LoadGlobalParameters(const Unique<Name>& name, const VectorSlotPair& feedback, |
275 ContextualMode contextual_mode, int slot_index) | 269 TypeofMode typeof_mode, int slot_index) |
276 : name_(name), | 270 : name_(name), |
277 feedback_(feedback), | 271 feedback_(feedback), |
278 contextual_mode_(contextual_mode), | 272 typeof_mode_(typeof_mode), |
279 slot_index_(slot_index) {} | 273 slot_index_(slot_index) {} |
280 | 274 |
281 const Unique<Name>& name() const { return name_; } | 275 const Unique<Name>& name() const { return name_; } |
282 ContextualMode contextual_mode() const { return contextual_mode_; } | 276 TypeofMode typeof_mode() const { return typeof_mode_; } |
283 | 277 |
284 const VectorSlotPair& feedback() const { return feedback_; } | 278 const VectorSlotPair& feedback() const { return feedback_; } |
285 | 279 |
286 const int slot_index() const { return slot_index_; } | 280 const int slot_index() const { return slot_index_; } |
287 | 281 |
288 private: | 282 private: |
289 const Unique<Name> name_; | 283 const Unique<Name> name_; |
290 const VectorSlotPair feedback_; | 284 const VectorSlotPair feedback_; |
291 const ContextualMode contextual_mode_; | 285 const TypeofMode typeof_mode_; |
292 const int slot_index_; | 286 const int slot_index_; |
293 }; | 287 }; |
294 | 288 |
295 bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&); | 289 bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&); |
296 bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&); | 290 bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&); |
297 | 291 |
298 size_t hash_value(LoadGlobalParameters const&); | 292 size_t hash_value(LoadGlobalParameters const&); |
299 | 293 |
300 std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&); | 294 std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&); |
301 | 295 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 const Operator* StoreNamed(LanguageMode language_mode, | 497 const Operator* StoreNamed(LanguageMode language_mode, |
504 const Unique<Name>& name, | 498 const Unique<Name>& name, |
505 const VectorSlotPair& feedback); | 499 const VectorSlotPair& feedback); |
506 | 500 |
507 const Operator* DeleteProperty(LanguageMode language_mode); | 501 const Operator* DeleteProperty(LanguageMode language_mode); |
508 | 502 |
509 const Operator* HasProperty(); | 503 const Operator* HasProperty(); |
510 | 504 |
511 const Operator* LoadGlobal(const Unique<Name>& name, | 505 const Operator* LoadGlobal(const Unique<Name>& name, |
512 const VectorSlotPair& feedback, | 506 const VectorSlotPair& feedback, |
513 ContextualMode contextual_mode = NOT_CONTEXTUAL, | 507 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF, |
514 int slot_index = -1); | 508 int slot_index = -1); |
515 const Operator* StoreGlobal(LanguageMode language_mode, | 509 const Operator* StoreGlobal(LanguageMode language_mode, |
516 const Unique<Name>& name, | 510 const Unique<Name>& name, |
517 const VectorSlotPair& feedback, | 511 const VectorSlotPair& feedback, |
518 int slot_index = -1); | 512 int slot_index = -1); |
519 | 513 |
520 const Operator* LoadContext(size_t depth, size_t index, bool immutable); | 514 const Operator* LoadContext(size_t depth, size_t index, bool immutable); |
521 const Operator* StoreContext(size_t depth, size_t index); | 515 const Operator* StoreContext(size_t depth, size_t index); |
522 | 516 |
523 const Operator* LoadDynamicGlobal(const Handle<String>& name, | 517 const Operator* LoadDynamicGlobal(const Handle<String>& name, |
524 uint32_t check_bitset, | 518 uint32_t check_bitset, |
525 const VectorSlotPair& feedback, | 519 const VectorSlotPair& feedback, |
526 ContextualMode mode); | 520 TypeofMode typeof_mode); |
527 const Operator* LoadDynamicContext(const Handle<String>& name, | 521 const Operator* LoadDynamicContext(const Handle<String>& name, |
528 uint32_t check_bitset, size_t depth, | 522 uint32_t check_bitset, size_t depth, |
529 size_t index); | 523 size_t index); |
530 | 524 |
531 const Operator* TypeOf(); | 525 const Operator* TypeOf(); |
532 const Operator* InstanceOf(); | 526 const Operator* InstanceOf(); |
533 | 527 |
534 const Operator* ForInDone(); | 528 const Operator* ForInDone(); |
535 const Operator* ForInNext(); | 529 const Operator* ForInNext(); |
536 const Operator* ForInPrepare(); | 530 const Operator* ForInPrepare(); |
(...skipping 16 matching lines...) Expand all Loading... |
553 Zone* const zone_; | 547 Zone* const zone_; |
554 | 548 |
555 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 549 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
556 }; | 550 }; |
557 | 551 |
558 } // namespace compiler | 552 } // namespace compiler |
559 } // namespace internal | 553 } // namespace internal |
560 } // namespace v8 | 554 } // namespace v8 |
561 | 555 |
562 #endif // V8_COMPILER_JS_OPERATOR_H_ | 556 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |