| 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 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 bool operator==(ContextAccess const&, ContextAccess const&); | 165 bool operator==(ContextAccess const&, ContextAccess const&); |
| 166 bool operator!=(ContextAccess const&, ContextAccess const&); | 166 bool operator!=(ContextAccess const&, ContextAccess const&); |
| 167 | 167 |
| 168 size_t hash_value(ContextAccess const&); | 168 size_t hash_value(ContextAccess const&); |
| 169 | 169 |
| 170 std::ostream& operator<<(std::ostream&, ContextAccess const&); | 170 std::ostream& operator<<(std::ostream&, ContextAccess const&); |
| 171 | 171 |
| 172 ContextAccess const& ContextAccessOf(Operator const*); | 172 ContextAccess const& ContextAccessOf(Operator const*); |
| 173 | 173 |
| 174 | 174 |
| 175 // Defines the name for a dynamic variable lookup. The {check_bitset} allows to | 175 // Defines the name for a dynamic variable lookup. This is used as a parameter |
| 176 // inline checks whether the lookup yields in a global variable. This is used as | 176 // by JSLoadDynamic and JSStoreDynamic operators. |
| 177 // a parameter by JSLoadDynamicGlobal and JSStoreDynamicGlobal operators. | 177 class DynamicAccess final { |
| 178 class DynamicGlobalAccess final { | |
| 179 public: | 178 public: |
| 180 DynamicGlobalAccess(const Handle<String>& name, uint32_t check_bitset, | 179 DynamicAccess(const Handle<String>& name, TypeofMode typeof_mode); |
| 181 const VectorSlotPair& feedback, TypeofMode typeof_mode); | |
| 182 | 180 |
| 183 const Handle<String>& name() const { return name_; } | 181 const Handle<String>& name() const { return name_; } |
| 184 uint32_t check_bitset() const { return check_bitset_; } | |
| 185 const VectorSlotPair& feedback() const { return feedback_; } | |
| 186 TypeofMode typeof_mode() const { return typeof_mode_; } | 182 TypeofMode typeof_mode() const { return typeof_mode_; } |
| 187 | 183 |
| 188 // Indicates that an inline check is disabled. | |
| 189 bool RequiresFullCheck() const { | |
| 190 return check_bitset() == kFullCheckRequired; | |
| 191 } | |
| 192 | |
| 193 // Limit of context chain length to which inline check is possible. | |
| 194 static const int kMaxCheckDepth = 30; | |
| 195 | |
| 196 // Sentinel for {check_bitset} disabling inline checks. | |
| 197 static const uint32_t kFullCheckRequired = -1; | |
| 198 | |
| 199 private: | 184 private: |
| 200 const Handle<String> name_; | 185 const Handle<String> name_; |
| 201 const uint32_t check_bitset_; | |
| 202 const VectorSlotPair feedback_; | |
| 203 const TypeofMode typeof_mode_; | 186 const TypeofMode typeof_mode_; |
| 204 }; | 187 }; |
| 205 | 188 |
| 206 size_t hash_value(DynamicGlobalAccess const&); | 189 size_t hash_value(DynamicAccess const&); |
| 207 | 190 |
| 208 bool operator==(DynamicGlobalAccess const&, DynamicGlobalAccess const&); | 191 bool operator==(DynamicAccess const&, DynamicAccess const&); |
| 209 bool operator!=(DynamicGlobalAccess const&, DynamicGlobalAccess const&); | 192 bool operator!=(DynamicAccess const&, DynamicAccess const&); |
| 210 | 193 |
| 211 std::ostream& operator<<(std::ostream&, DynamicGlobalAccess const&); | 194 std::ostream& operator<<(std::ostream&, DynamicAccess const&); |
| 212 | 195 |
| 213 DynamicGlobalAccess const& DynamicGlobalAccessOf(Operator const*); | 196 DynamicAccess const& DynamicAccessOf(Operator const*); |
| 214 | |
| 215 | |
| 216 // Defines the name for a dynamic variable lookup. The {check_bitset} allows to | |
| 217 // inline checks whether the lookup yields in a context variable. This is used | |
| 218 // as a parameter by JSLoadDynamicContext and JSStoreDynamicContext operators. | |
| 219 class DynamicContextAccess final { | |
| 220 public: | |
| 221 DynamicContextAccess(const Handle<String>& name, uint32_t check_bitset, | |
| 222 const ContextAccess& context_access); | |
| 223 | |
| 224 const Handle<String>& name() const { return name_; } | |
| 225 uint32_t check_bitset() const { return check_bitset_; } | |
| 226 const ContextAccess& context_access() const { return context_access_; } | |
| 227 | |
| 228 // Indicates that an inline check is disabled. | |
| 229 bool RequiresFullCheck() const { | |
| 230 return check_bitset() == kFullCheckRequired; | |
| 231 } | |
| 232 | |
| 233 // Limit of context chain length to which inline check is possible. | |
| 234 static const int kMaxCheckDepth = 30; | |
| 235 | |
| 236 // Sentinel for {check_bitset} disabling inline checks. | |
| 237 static const uint32_t kFullCheckRequired = -1; | |
| 238 | |
| 239 private: | |
| 240 const Handle<String> name_; | |
| 241 const uint32_t check_bitset_; | |
| 242 const ContextAccess context_access_; | |
| 243 }; | |
| 244 | |
| 245 size_t hash_value(DynamicContextAccess const&); | |
| 246 | |
| 247 bool operator==(DynamicContextAccess const&, DynamicContextAccess const&); | |
| 248 bool operator!=(DynamicContextAccess const&, DynamicContextAccess const&); | |
| 249 | |
| 250 std::ostream& operator<<(std::ostream&, DynamicContextAccess const&); | |
| 251 | |
| 252 DynamicContextAccess const& DynamicContextAccessOf(Operator const*); | |
| 253 | 197 |
| 254 | 198 |
| 255 // Defines the property of an object for a named access. This is | 199 // Defines the property of an object for a named access. This is |
| 256 // used as a parameter by the JSLoadNamed and JSStoreNamed operators. | 200 // used as a parameter by the JSLoadNamed and JSStoreNamed operators. |
| 257 class NamedAccess final { | 201 class NamedAccess final { |
| 258 public: | 202 public: |
| 259 NamedAccess(LanguageMode language_mode, Handle<Name> name, | 203 NamedAccess(LanguageMode language_mode, Handle<Name> name, |
| 260 VectorSlotPair const& feedback) | 204 VectorSlotPair const& feedback) |
| 261 : name_(name), feedback_(feedback), language_mode_(language_mode) {} | 205 : name_(name), feedback_(feedback), language_mode_(language_mode) {} |
| 262 | 206 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 const Operator* LoadGlobal(const Handle<Name>& name, | 432 const Operator* LoadGlobal(const Handle<Name>& name, |
| 489 const VectorSlotPair& feedback, | 433 const VectorSlotPair& feedback, |
| 490 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); | 434 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF); |
| 491 const Operator* StoreGlobal(LanguageMode language_mode, | 435 const Operator* StoreGlobal(LanguageMode language_mode, |
| 492 const Handle<Name>& name, | 436 const Handle<Name>& name, |
| 493 const VectorSlotPair& feedback); | 437 const VectorSlotPair& feedback); |
| 494 | 438 |
| 495 const Operator* LoadContext(size_t depth, size_t index, bool immutable); | 439 const Operator* LoadContext(size_t depth, size_t index, bool immutable); |
| 496 const Operator* StoreContext(size_t depth, size_t index); | 440 const Operator* StoreContext(size_t depth, size_t index); |
| 497 | 441 |
| 498 const Operator* LoadDynamicGlobal(const Handle<String>& name, | 442 const Operator* LoadDynamic(const Handle<String>& name, |
| 499 uint32_t check_bitset, | 443 TypeofMode typeof_mode); |
| 500 const VectorSlotPair& feedback, | |
| 501 TypeofMode typeof_mode); | |
| 502 const Operator* LoadDynamicContext(const Handle<String>& name, | |
| 503 uint32_t check_bitset, size_t depth, | |
| 504 size_t index); | |
| 505 | 444 |
| 506 const Operator* TypeOf(); | 445 const Operator* TypeOf(); |
| 507 const Operator* InstanceOf(); | 446 const Operator* InstanceOf(); |
| 508 | 447 |
| 509 const Operator* ForInDone(); | 448 const Operator* ForInDone(); |
| 510 const Operator* ForInNext(); | 449 const Operator* ForInNext(); |
| 511 const Operator* ForInPrepare(); | 450 const Operator* ForInPrepare(); |
| 512 const Operator* ForInStep(); | 451 const Operator* ForInStep(); |
| 513 | 452 |
| 514 const Operator* StackCheck(); | 453 const Operator* StackCheck(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 527 Zone* const zone_; | 466 Zone* const zone_; |
| 528 | 467 |
| 529 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 468 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
| 530 }; | 469 }; |
| 531 | 470 |
| 532 } // namespace compiler | 471 } // namespace compiler |
| 533 } // namespace internal | 472 } // namespace internal |
| 534 } // namespace v8 | 473 } // namespace v8 |
| 535 | 474 |
| 536 #endif // V8_COMPILER_JS_OPERATOR_H_ | 475 #endif // V8_COMPILER_JS_OPERATOR_H_ |
| OLD | NEW |