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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
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 Handle<Name>& name, const VectorSlotPair& feedback, |
240 LanguageMode language_mode) | 240 LanguageMode language_mode) |
241 : name_(name), feedback_(feedback), language_mode_(language_mode) {} | 241 : name_(name), feedback_(feedback), language_mode_(language_mode) {} |
242 | 242 |
243 const Unique<Name>& name() const { return name_; } | 243 const Handle<Name>& name() const { return name_; } |
244 LanguageMode language_mode() const { return language_mode_; } | 244 LanguageMode language_mode() const { return language_mode_; } |
245 | 245 |
246 const VectorSlotPair& feedback() const { return feedback_; } | 246 const VectorSlotPair& feedback() const { return feedback_; } |
247 | 247 |
248 private: | 248 private: |
249 const Unique<Name> name_; | 249 const Handle<Name> name_; |
250 const VectorSlotPair feedback_; | 250 const VectorSlotPair feedback_; |
251 const LanguageMode language_mode_; | 251 const LanguageMode language_mode_; |
252 }; | 252 }; |
253 | 253 |
254 bool operator==(LoadNamedParameters const&, LoadNamedParameters const&); | 254 bool operator==(LoadNamedParameters const&, LoadNamedParameters const&); |
255 bool operator!=(LoadNamedParameters const&, LoadNamedParameters const&); | 255 bool operator!=(LoadNamedParameters const&, LoadNamedParameters const&); |
256 | 256 |
257 size_t hash_value(LoadNamedParameters const&); | 257 size_t hash_value(LoadNamedParameters const&); |
258 | 258 |
259 std::ostream& operator<<(std::ostream&, LoadNamedParameters const&); | 259 std::ostream& operator<<(std::ostream&, LoadNamedParameters const&); |
260 | 260 |
261 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op); | 261 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op); |
262 | 262 |
263 | 263 |
264 // 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 |
265 // used as a parameter by JSLoadGlobal operator. | 265 // used as a parameter by JSLoadGlobal operator. |
266 class LoadGlobalParameters final { | 266 class LoadGlobalParameters final { |
267 public: | 267 public: |
268 LoadGlobalParameters(const Unique<Name>& name, const VectorSlotPair& feedback, | 268 LoadGlobalParameters(const Handle<Name>& name, const VectorSlotPair& feedback, |
269 TypeofMode typeof_mode, int slot_index) | 269 TypeofMode typeof_mode, int slot_index) |
270 : name_(name), | 270 : name_(name), |
271 feedback_(feedback), | 271 feedback_(feedback), |
272 typeof_mode_(typeof_mode), | 272 typeof_mode_(typeof_mode), |
273 slot_index_(slot_index) {} | 273 slot_index_(slot_index) {} |
274 | 274 |
275 const Unique<Name>& name() const { return name_; } | 275 const Handle<Name>& name() const { return name_; } |
276 TypeofMode typeof_mode() const { return typeof_mode_; } | 276 TypeofMode typeof_mode() const { return typeof_mode_; } |
277 | 277 |
278 const VectorSlotPair& feedback() const { return feedback_; } | 278 const VectorSlotPair& feedback() const { return feedback_; } |
279 | 279 |
280 int slot_index() const { return slot_index_; } | 280 int slot_index() const { return slot_index_; } |
281 | 281 |
282 private: | 282 private: |
283 const Unique<Name> name_; | 283 const Handle<Name> name_; |
284 const VectorSlotPair feedback_; | 284 const VectorSlotPair feedback_; |
285 const TypeofMode typeof_mode_; | 285 const TypeofMode typeof_mode_; |
286 const int slot_index_; | 286 const int slot_index_; |
287 }; | 287 }; |
288 | 288 |
289 bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&); | 289 bool operator==(LoadGlobalParameters const&, LoadGlobalParameters const&); |
290 bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&); | 290 bool operator!=(LoadGlobalParameters const&, LoadGlobalParameters const&); |
291 | 291 |
292 size_t hash_value(LoadGlobalParameters const&); | 292 size_t hash_value(LoadGlobalParameters const&); |
293 | 293 |
294 std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&); | 294 std::ostream& operator<<(std::ostream&, LoadGlobalParameters const&); |
295 | 295 |
296 const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op); | 296 const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op); |
297 | 297 |
298 | 298 |
299 // Defines the property being stored to an object by a named store. This is | 299 // Defines the property being stored to an object by a named store. This is |
300 // used as a parameter by JSStoreGlobal operator. | 300 // used as a parameter by JSStoreGlobal operator. |
301 class StoreGlobalParameters final { | 301 class StoreGlobalParameters final { |
302 public: | 302 public: |
303 StoreGlobalParameters(LanguageMode language_mode, | 303 StoreGlobalParameters(LanguageMode language_mode, |
304 const VectorSlotPair& feedback, | 304 const VectorSlotPair& feedback, |
305 const Unique<Name>& name, int slot_index) | 305 const Handle<Name>& name, int slot_index) |
306 : language_mode_(language_mode), | 306 : language_mode_(language_mode), |
307 name_(name), | 307 name_(name), |
308 feedback_(feedback), | 308 feedback_(feedback), |
309 slot_index_(slot_index) {} | 309 slot_index_(slot_index) {} |
310 | 310 |
311 LanguageMode language_mode() const { return language_mode_; } | 311 LanguageMode language_mode() const { return language_mode_; } |
312 const VectorSlotPair& feedback() const { return feedback_; } | 312 const VectorSlotPair& feedback() const { return feedback_; } |
313 const Unique<Name>& name() const { return name_; } | 313 const Handle<Name>& name() const { return name_; } |
314 int slot_index() const { return slot_index_; } | 314 int slot_index() const { return slot_index_; } |
315 | 315 |
316 private: | 316 private: |
317 const LanguageMode language_mode_; | 317 const LanguageMode language_mode_; |
318 const Unique<Name> name_; | 318 const Handle<Name> name_; |
319 const VectorSlotPair feedback_; | 319 const VectorSlotPair feedback_; |
320 int slot_index_; | 320 int slot_index_; |
321 }; | 321 }; |
322 | 322 |
323 bool operator==(StoreGlobalParameters const&, StoreGlobalParameters const&); | 323 bool operator==(StoreGlobalParameters const&, StoreGlobalParameters const&); |
324 bool operator!=(StoreGlobalParameters const&, StoreGlobalParameters const&); | 324 bool operator!=(StoreGlobalParameters const&, StoreGlobalParameters const&); |
325 | 325 |
326 size_t hash_value(StoreGlobalParameters const&); | 326 size_t hash_value(StoreGlobalParameters const&); |
327 | 327 |
328 std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&); | 328 std::ostream& operator<<(std::ostream&, StoreGlobalParameters const&); |
(...skipping 26 matching lines...) Expand all Loading... |
355 std::ostream& operator<<(std::ostream&, LoadPropertyParameters const&); | 355 std::ostream& operator<<(std::ostream&, LoadPropertyParameters const&); |
356 | 356 |
357 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op); | 357 const LoadPropertyParameters& LoadPropertyParametersOf(const Operator* op); |
358 | 358 |
359 | 359 |
360 // Defines the property being stored to an object by a named store. This is | 360 // Defines the property being stored to an object by a named store. This is |
361 // used as a parameter by JSStoreNamed operator. | 361 // used as a parameter by JSStoreNamed operator. |
362 class StoreNamedParameters final { | 362 class StoreNamedParameters final { |
363 public: | 363 public: |
364 StoreNamedParameters(LanguageMode language_mode, | 364 StoreNamedParameters(LanguageMode language_mode, |
365 const VectorSlotPair& feedback, const Unique<Name>& name) | 365 const VectorSlotPair& feedback, const Handle<Name>& name) |
366 : language_mode_(language_mode), name_(name), feedback_(feedback) {} | 366 : language_mode_(language_mode), name_(name), feedback_(feedback) {} |
367 | 367 |
368 LanguageMode language_mode() const { return language_mode_; } | 368 LanguageMode language_mode() const { return language_mode_; } |
369 const VectorSlotPair& feedback() const { return feedback_; } | 369 const VectorSlotPair& feedback() const { return feedback_; } |
370 const Unique<Name>& name() const { return name_; } | 370 const Handle<Name>& name() const { return name_; } |
371 | 371 |
372 private: | 372 private: |
373 const LanguageMode language_mode_; | 373 const LanguageMode language_mode_; |
374 const Unique<Name> name_; | 374 const Handle<Name> name_; |
375 const VectorSlotPair feedback_; | 375 const VectorSlotPair feedback_; |
376 }; | 376 }; |
377 | 377 |
378 bool operator==(StoreNamedParameters const&, StoreNamedParameters const&); | 378 bool operator==(StoreNamedParameters const&, StoreNamedParameters const&); |
379 bool operator!=(StoreNamedParameters const&, StoreNamedParameters const&); | 379 bool operator!=(StoreNamedParameters const&, StoreNamedParameters const&); |
380 | 380 |
381 size_t hash_value(StoreNamedParameters const&); | 381 size_t hash_value(StoreNamedParameters const&); |
382 | 382 |
383 std::ostream& operator<<(std::ostream&, StoreNamedParameters const&); | 383 std::ostream& operator<<(std::ostream&, StoreNamedParameters const&); |
384 | 384 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 const Operator* CallFunction( | 481 const Operator* CallFunction( |
482 size_t arity, CallFunctionFlags flags, LanguageMode language_mode, | 482 size_t arity, CallFunctionFlags flags, LanguageMode language_mode, |
483 VectorSlotPair const& feedback = VectorSlotPair(), | 483 VectorSlotPair const& feedback = VectorSlotPair(), |
484 TailCallMode tail_call_mode = NO_TAIL_CALLS); | 484 TailCallMode tail_call_mode = NO_TAIL_CALLS); |
485 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); | 485 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); |
486 | 486 |
487 const Operator* CallConstruct(int arguments); | 487 const Operator* CallConstruct(int arguments); |
488 | 488 |
489 const Operator* LoadProperty(const VectorSlotPair& feedback, | 489 const Operator* LoadProperty(const VectorSlotPair& feedback, |
490 LanguageMode language_mode); | 490 LanguageMode language_mode); |
491 const Operator* LoadNamed(const Unique<Name>& name, | 491 const Operator* LoadNamed(const Handle<Name>& name, |
492 const VectorSlotPair& feedback, | 492 const VectorSlotPair& feedback, |
493 LanguageMode language_mode); | 493 LanguageMode language_mode); |
494 | 494 |
495 const Operator* StoreProperty(LanguageMode language_mode, | 495 const Operator* StoreProperty(LanguageMode language_mode, |
496 const VectorSlotPair& feedback); | 496 const VectorSlotPair& feedback); |
497 const Operator* StoreNamed(LanguageMode language_mode, | 497 const Operator* StoreNamed(LanguageMode language_mode, |
498 const Unique<Name>& name, | 498 const Handle<Name>& name, |
499 const VectorSlotPair& feedback); | 499 const VectorSlotPair& feedback); |
500 | 500 |
501 const Operator* DeleteProperty(LanguageMode language_mode); | 501 const Operator* DeleteProperty(LanguageMode language_mode); |
502 | 502 |
503 const Operator* HasProperty(); | 503 const Operator* HasProperty(); |
504 | 504 |
505 const Operator* LoadGlobal(const Unique<Name>& name, | 505 const Operator* LoadGlobal(const Handle<Name>& name, |
506 const VectorSlotPair& feedback, | 506 const VectorSlotPair& feedback, |
507 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF, | 507 TypeofMode typeof_mode = NOT_INSIDE_TYPEOF, |
508 int slot_index = -1); | 508 int slot_index = -1); |
509 const Operator* StoreGlobal(LanguageMode language_mode, | 509 const Operator* StoreGlobal(LanguageMode language_mode, |
510 const Unique<Name>& name, | 510 const Handle<Name>& name, |
511 const VectorSlotPair& feedback, | 511 const VectorSlotPair& feedback, |
512 int slot_index = -1); | 512 int slot_index = -1); |
513 | 513 |
514 const Operator* LoadContext(size_t depth, size_t index, bool immutable); | 514 const Operator* LoadContext(size_t depth, size_t index, bool immutable); |
515 const Operator* StoreContext(size_t depth, size_t index); | 515 const Operator* StoreContext(size_t depth, size_t index); |
516 | 516 |
517 const Operator* LoadDynamicGlobal(const Handle<String>& name, | 517 const Operator* LoadDynamicGlobal(const Handle<String>& name, |
518 uint32_t check_bitset, | 518 uint32_t check_bitset, |
519 const VectorSlotPair& feedback, | 519 const VectorSlotPair& feedback, |
520 TypeofMode typeof_mode); | 520 TypeofMode typeof_mode); |
521 const Operator* LoadDynamicContext(const Handle<String>& name, | 521 const Operator* LoadDynamicContext(const Handle<String>& name, |
522 uint32_t check_bitset, size_t depth, | 522 uint32_t check_bitset, size_t depth, |
523 size_t index); | 523 size_t index); |
524 | 524 |
525 const Operator* TypeOf(); | 525 const Operator* TypeOf(); |
526 const Operator* InstanceOf(); | 526 const Operator* InstanceOf(); |
527 | 527 |
528 const Operator* ForInDone(); | 528 const Operator* ForInDone(); |
529 const Operator* ForInNext(); | 529 const Operator* ForInNext(); |
530 const Operator* ForInPrepare(); | 530 const Operator* ForInPrepare(); |
531 const Operator* ForInStep(); | 531 const Operator* ForInStep(); |
532 | 532 |
533 const Operator* StackCheck(); | 533 const Operator* StackCheck(); |
534 | 534 |
535 // TODO(titzer): nail down the static parts of each of these context flavors. | 535 // TODO(titzer): nail down the static parts of each of these context flavors. |
536 const Operator* CreateFunctionContext(); | 536 const Operator* CreateFunctionContext(); |
537 const Operator* CreateCatchContext(const Unique<String>& name); | 537 const Operator* CreateCatchContext(const Handle<String>& name); |
538 const Operator* CreateWithContext(); | 538 const Operator* CreateWithContext(); |
539 const Operator* CreateBlockContext(); | 539 const Operator* CreateBlockContext(); |
540 const Operator* CreateModuleContext(); | 540 const Operator* CreateModuleContext(); |
541 const Operator* CreateScriptContext(); | 541 const Operator* CreateScriptContext(); |
542 | 542 |
543 private: | 543 private: |
544 Zone* zone() const { return zone_; } | 544 Zone* zone() const { return zone_; } |
545 | 545 |
546 const JSOperatorGlobalCache& cache_; | 546 const JSOperatorGlobalCache& cache_; |
547 Zone* const zone_; | 547 Zone* const zone_; |
548 | 548 |
549 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 549 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
550 }; | 550 }; |
551 | 551 |
552 } // namespace compiler | 552 } // namespace compiler |
553 } // namespace internal | 553 } // namespace internal |
554 } // namespace v8 | 554 } // namespace v8 |
555 | 555 |
556 #endif // V8_COMPILER_JS_OPERATOR_H_ | 556 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |