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 and JSLoadGlobal operators. | 236 // used as a parameter by JSLoadNamed and JSLoadGlobal 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, TypeofMode typeof_mode) |
241 ContextualMode contextual_mode) | |
242 : name_(name), | 241 : name_(name), |
243 feedback_(feedback), | 242 feedback_(feedback), |
244 language_mode_(language_mode), | 243 language_mode_(language_mode), |
245 contextual_mode_(contextual_mode) {} | 244 typeof_mode_(typeof_mode) {} |
246 | 245 |
247 const Unique<Name>& name() const { return name_; } | 246 const Unique<Name>& name() const { return name_; } |
248 LanguageMode language_mode() const { return language_mode_; } | 247 LanguageMode language_mode() const { return language_mode_; } |
249 ContextualMode contextual_mode() const { return contextual_mode_; } | 248 TypeofMode typeof_mode() const { return typeof_mode_; } |
250 | 249 |
251 const VectorSlotPair& feedback() const { return feedback_; } | 250 const VectorSlotPair& feedback() const { return feedback_; } |
252 | 251 |
253 private: | 252 private: |
254 const Unique<Name> name_; | 253 const Unique<Name> name_; |
255 const VectorSlotPair feedback_; | 254 const VectorSlotPair feedback_; |
256 const LanguageMode language_mode_; | 255 const LanguageMode language_mode_; |
257 const ContextualMode contextual_mode_; | 256 const TypeofMode typeof_mode_; |
258 }; | 257 }; |
259 | 258 |
260 bool operator==(LoadNamedParameters const&, LoadNamedParameters const&); | 259 bool operator==(LoadNamedParameters const&, LoadNamedParameters const&); |
261 bool operator!=(LoadNamedParameters const&, LoadNamedParameters const&); | 260 bool operator!=(LoadNamedParameters const&, LoadNamedParameters const&); |
262 | 261 |
263 size_t hash_value(LoadNamedParameters const&); | 262 size_t hash_value(LoadNamedParameters const&); |
264 | 263 |
265 std::ostream& operator<<(std::ostream&, LoadNamedParameters const&); | 264 std::ostream& operator<<(std::ostream&, LoadNamedParameters const&); |
266 | 265 |
267 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op); | 266 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 const Operator* StoreNamed(LanguageMode language_mode, | 437 const Operator* StoreNamed(LanguageMode language_mode, |
439 const Unique<Name>& name, | 438 const Unique<Name>& name, |
440 const VectorSlotPair& feedback); | 439 const VectorSlotPair& feedback); |
441 | 440 |
442 const Operator* DeleteProperty(LanguageMode language_mode); | 441 const Operator* DeleteProperty(LanguageMode language_mode); |
443 | 442 |
444 const Operator* HasProperty(); | 443 const Operator* HasProperty(); |
445 | 444 |
446 const Operator* LoadGlobal(const Unique<Name>& name, | 445 const Operator* LoadGlobal(const Unique<Name>& name, |
447 const VectorSlotPair& feedback, | 446 const VectorSlotPair& feedback, |
448 ContextualMode contextual_mode = NOT_CONTEXTUAL); | 447 TypeofMode typeof_mode = INSIDE_TYPEOF); |
449 const Operator* StoreGlobal(LanguageMode language_mode, | 448 const Operator* StoreGlobal(LanguageMode language_mode, |
450 const Unique<Name>& name, | 449 const Unique<Name>& name, |
451 const VectorSlotPair& feedback); | 450 const VectorSlotPair& feedback); |
452 | 451 |
453 const Operator* LoadContext(size_t depth, size_t index, bool immutable); | 452 const Operator* LoadContext(size_t depth, size_t index, bool immutable); |
454 const Operator* StoreContext(size_t depth, size_t index); | 453 const Operator* StoreContext(size_t depth, size_t index); |
455 | 454 |
456 const Operator* LoadDynamicGlobal(const Handle<String>& name, | 455 const Operator* LoadDynamicGlobal(const Handle<String>& name, |
457 uint32_t check_bitset, | 456 uint32_t check_bitset, |
458 const VectorSlotPair& feedback, | 457 const VectorSlotPair& feedback, |
459 ContextualMode mode); | 458 TypeofMode typeof_mode); |
460 const Operator* LoadDynamicContext(const Handle<String>& name, | 459 const Operator* LoadDynamicContext(const Handle<String>& name, |
461 uint32_t check_bitset, size_t depth, | 460 uint32_t check_bitset, size_t depth, |
462 size_t index); | 461 size_t index); |
463 | 462 |
464 const Operator* TypeOf(); | 463 const Operator* TypeOf(); |
465 const Operator* InstanceOf(); | 464 const Operator* InstanceOf(); |
466 | 465 |
467 const Operator* ForInDone(); | 466 const Operator* ForInDone(); |
468 const Operator* ForInNext(); | 467 const Operator* ForInNext(); |
469 const Operator* ForInPrepare(); | 468 const Operator* ForInPrepare(); |
(...skipping 16 matching lines...) Expand all Loading... |
486 Zone* const zone_; | 485 Zone* const zone_; |
487 | 486 |
488 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 487 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
489 }; | 488 }; |
490 | 489 |
491 } // namespace compiler | 490 } // namespace compiler |
492 } // namespace internal | 491 } // namespace internal |
493 } // namespace v8 | 492 } // namespace v8 |
494 | 493 |
495 #endif // V8_COMPILER_JS_OPERATOR_H_ | 494 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |