| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 bool operator==(ContextAccess const&, ContextAccess const&); | 105 bool operator==(ContextAccess const&, ContextAccess const&); |
| 106 bool operator!=(ContextAccess const&, ContextAccess const&); | 106 bool operator!=(ContextAccess const&, ContextAccess const&); |
| 107 | 107 |
| 108 size_t hash_value(ContextAccess const&); | 108 size_t hash_value(ContextAccess const&); |
| 109 | 109 |
| 110 std::ostream& operator<<(std::ostream&, ContextAccess const&); | 110 std::ostream& operator<<(std::ostream&, ContextAccess const&); |
| 111 | 111 |
| 112 ContextAccess const& ContextAccessOf(Operator const*); | 112 ContextAccess const& ContextAccessOf(Operator const*); |
| 113 | 113 |
| 114 | 114 |
| 115 // Defines the name for a dynamic variable lookup. The {check_bitset} allows to |
| 116 // inline checks whether the lookup yields in a global variable. This is used as |
| 117 // a parameter by JSLoadDynamicGlobal and JSStoreDynamicGlobal operators. |
| 118 class DynamicGlobalAccess final { |
| 119 public: |
| 120 DynamicGlobalAccess(const Handle<String>& name, uint32_t check_bitset, |
| 121 ContextualMode mode); |
| 122 |
| 123 const Handle<String>& name() const { return name_; } |
| 124 uint32_t check_bitset() const { return check_bitset_; } |
| 125 ContextualMode mode() const { return mode_; } |
| 126 |
| 127 // Indicates that an inline check is disabled. |
| 128 bool RequiresFullCheck() const { |
| 129 return check_bitset() == kFullCheckRequired; |
| 130 } |
| 131 |
| 132 // Limit of context chain length to which inline check is possible. |
| 133 static const int kMaxCheckDepth = 30; |
| 134 |
| 135 // Sentinel for {check_bitset} disabling inline checks. |
| 136 static const uint32_t kFullCheckRequired = -1; |
| 137 |
| 138 private: |
| 139 const Handle<String> name_; |
| 140 const uint32_t check_bitset_; |
| 141 const ContextualMode mode_; |
| 142 }; |
| 143 |
| 144 size_t hash_value(DynamicGlobalAccess const&); |
| 145 |
| 146 bool operator==(DynamicGlobalAccess const&, DynamicGlobalAccess const&); |
| 147 bool operator!=(DynamicGlobalAccess const&, DynamicGlobalAccess const&); |
| 148 |
| 149 std::ostream& operator<<(std::ostream&, DynamicGlobalAccess const&); |
| 150 |
| 151 DynamicGlobalAccess const& DynamicGlobalAccessOf(Operator const*); |
| 152 |
| 153 |
| 154 // Defines the name for a dynamic variable lookup. The {check_bitset} allows to |
| 155 // inline checks whether the lookup yields in a context variable. This is used |
| 156 // as a parameter by JSLoadDynamicContext and JSStoreDynamicContext operators. |
| 157 class DynamicContextAccess final { |
| 158 public: |
| 159 DynamicContextAccess(const Handle<String>& name, uint32_t check_bitset, |
| 160 const ContextAccess& context_access); |
| 161 |
| 162 const Handle<String>& name() const { return name_; } |
| 163 uint32_t check_bitset() const { return check_bitset_; } |
| 164 const ContextAccess& context_access() const { return context_access_; } |
| 165 |
| 166 // Indicates that an inline check is disabled. |
| 167 bool RequiresFullCheck() const { |
| 168 return check_bitset() == kFullCheckRequired; |
| 169 } |
| 170 |
| 171 // Limit of context chain length to which inline check is possible. |
| 172 static const int kMaxCheckDepth = 30; |
| 173 |
| 174 // Sentinel for {check_bitset} disabling inline checks. |
| 175 static const uint32_t kFullCheckRequired = -1; |
| 176 |
| 177 private: |
| 178 const Handle<String> name_; |
| 179 const uint32_t check_bitset_; |
| 180 const ContextAccess context_access_; |
| 181 }; |
| 182 |
| 183 size_t hash_value(DynamicContextAccess const&); |
| 184 |
| 185 bool operator==(DynamicContextAccess const&, DynamicContextAccess const&); |
| 186 bool operator!=(DynamicContextAccess const&, DynamicContextAccess const&); |
| 187 |
| 188 std::ostream& operator<<(std::ostream&, DynamicContextAccess const&); |
| 189 |
| 190 DynamicContextAccess const& DynamicContextAccessOf(Operator const*); |
| 191 |
| 192 |
| 115 class VectorSlotPair { | 193 class VectorSlotPair { |
| 116 public: | 194 public: |
| 117 VectorSlotPair(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) | 195 VectorSlotPair(Handle<TypeFeedbackVector> vector, FeedbackVectorICSlot slot) |
| 118 : vector_(vector), slot_(slot) {} | 196 : vector_(vector), slot_(slot) {} |
| 119 | 197 |
| 120 Handle<TypeFeedbackVector> vector() const { return vector_; } | 198 Handle<TypeFeedbackVector> vector() const { return vector_; } |
| 121 FeedbackVectorICSlot slot() const { return slot_; } | 199 FeedbackVectorICSlot slot() const { return slot_; } |
| 122 | 200 |
| 123 int index() const { return vector_->GetIndex(slot_); } | 201 int index() const { return vector_->GetIndex(slot_); } |
| 124 | 202 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 const Operator* StoreNamed(LanguageMode language_mode, | 368 const Operator* StoreNamed(LanguageMode language_mode, |
| 291 const Unique<Name>& name); | 369 const Unique<Name>& name); |
| 292 | 370 |
| 293 const Operator* DeleteProperty(LanguageMode language_mode); | 371 const Operator* DeleteProperty(LanguageMode language_mode); |
| 294 | 372 |
| 295 const Operator* HasProperty(); | 373 const Operator* HasProperty(); |
| 296 | 374 |
| 297 const Operator* LoadContext(size_t depth, size_t index, bool immutable); | 375 const Operator* LoadContext(size_t depth, size_t index, bool immutable); |
| 298 const Operator* StoreContext(size_t depth, size_t index); | 376 const Operator* StoreContext(size_t depth, size_t index); |
| 299 | 377 |
| 378 const Operator* LoadDynamicGlobal(const Handle<String>& name, |
| 379 uint32_t check_bitset, ContextualMode mode); |
| 380 const Operator* LoadDynamicContext(const Handle<String>& name, |
| 381 uint32_t check_bitset, size_t depth, |
| 382 size_t index); |
| 383 |
| 300 const Operator* TypeOf(); | 384 const Operator* TypeOf(); |
| 301 const Operator* InstanceOf(); | 385 const Operator* InstanceOf(); |
| 302 | 386 |
| 303 const Operator* StackCheck(); | 387 const Operator* StackCheck(); |
| 304 | 388 |
| 305 // TODO(titzer): nail down the static parts of each of these context flavors. | 389 // TODO(titzer): nail down the static parts of each of these context flavors. |
| 306 const Operator* CreateFunctionContext(); | 390 const Operator* CreateFunctionContext(); |
| 307 const Operator* CreateCatchContext(const Unique<String>& name); | 391 const Operator* CreateCatchContext(const Unique<String>& name); |
| 308 const Operator* CreateWithContext(); | 392 const Operator* CreateWithContext(); |
| 309 const Operator* CreateBlockContext(); | 393 const Operator* CreateBlockContext(); |
| 310 const Operator* CreateModuleContext(); | 394 const Operator* CreateModuleContext(); |
| 311 const Operator* CreateScriptContext(); | 395 const Operator* CreateScriptContext(); |
| 312 | 396 |
| 313 private: | 397 private: |
| 314 Zone* zone() const { return zone_; } | 398 Zone* zone() const { return zone_; } |
| 315 | 399 |
| 316 const JSOperatorGlobalCache& cache_; | 400 const JSOperatorGlobalCache& cache_; |
| 317 Zone* const zone_; | 401 Zone* const zone_; |
| 318 | 402 |
| 319 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 403 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
| 320 }; | 404 }; |
| 321 | 405 |
| 322 } // namespace compiler | 406 } // namespace compiler |
| 323 } // namespace internal | 407 } // namespace internal |
| 324 } // namespace v8 | 408 } // namespace v8 |
| 325 | 409 |
| 326 #endif // V8_COMPILER_JS_OPERATOR_H_ | 410 #endif // V8_COMPILER_JS_OPERATOR_H_ |
| OLD | NEW |