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/base/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 #include "src/runtime/runtime.h" | 10 #include "src/runtime/runtime.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 | 482 |
483 bool operator==(CreateLiteralParameters const&, CreateLiteralParameters const&); | 483 bool operator==(CreateLiteralParameters const&, CreateLiteralParameters const&); |
484 bool operator!=(CreateLiteralParameters const&, CreateLiteralParameters const&); | 484 bool operator!=(CreateLiteralParameters const&, CreateLiteralParameters const&); |
485 | 485 |
486 size_t hash_value(CreateLiteralParameters const&); | 486 size_t hash_value(CreateLiteralParameters const&); |
487 | 487 |
488 std::ostream& operator<<(std::ostream&, CreateLiteralParameters const&); | 488 std::ostream& operator<<(std::ostream&, CreateLiteralParameters const&); |
489 | 489 |
490 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op); | 490 const CreateLiteralParameters& CreateLiteralParametersOf(const Operator* op); |
491 | 491 |
| 492 enum class SuspendType { kYield, kAwait }; |
| 493 class GeneratorStoreParameters final { |
| 494 public: |
| 495 GeneratorStoreParameters(int register_count, SuspendType suspend_type) |
| 496 : register_count_(register_count), suspend_type_(suspend_type) {} |
| 497 |
| 498 int register_count() const { return register_count_; } |
| 499 SuspendType suspend_type() const { return suspend_type_; } |
| 500 |
| 501 private: |
| 502 int register_count_; |
| 503 SuspendType suspend_type_; |
| 504 }; |
| 505 |
| 506 bool operator==(GeneratorStoreParameters const&, |
| 507 GeneratorStoreParameters const&); |
| 508 bool operator!=(GeneratorStoreParameters const&, |
| 509 GeneratorStoreParameters const&); |
| 510 |
| 511 size_t hash_value(GeneratorStoreParameters const&); |
| 512 |
| 513 std::ostream& operator<<(std::ostream&, GeneratorStoreParameters const&); |
| 514 |
| 515 const GeneratorStoreParameters& GeneratorStoreParametersOf(const Operator* op); |
| 516 |
492 BinaryOperationHint BinaryOperationHintOf(const Operator* op); | 517 BinaryOperationHint BinaryOperationHintOf(const Operator* op); |
493 | 518 |
494 CompareOperationHint CompareOperationHintOf(const Operator* op); | 519 CompareOperationHint CompareOperationHintOf(const Operator* op); |
495 | 520 |
496 // Interface for building JavaScript-level operators, e.g. directly from the | 521 // Interface for building JavaScript-level operators, e.g. directly from the |
497 // AST. Most operators have no parameters, thus can be globally shared for all | 522 // AST. Most operators have no parameters, thus can be globally shared for all |
498 // graphs. | 523 // graphs. |
499 class V8_EXPORT_PRIVATE JSOperatorBuilder final | 524 class V8_EXPORT_PRIVATE JSOperatorBuilder final |
500 : public NON_EXPORTED_BASE(ZoneObject) { | 525 : public NON_EXPORTED_BASE(ZoneObject) { |
501 public: | 526 public: |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 const Operator* TypeOf(); | 618 const Operator* TypeOf(); |
594 const Operator* InstanceOf(); | 619 const Operator* InstanceOf(); |
595 const Operator* OrdinaryHasInstance(); | 620 const Operator* OrdinaryHasInstance(); |
596 | 621 |
597 const Operator* ForInNext(); | 622 const Operator* ForInNext(); |
598 const Operator* ForInPrepare(); | 623 const Operator* ForInPrepare(); |
599 | 624 |
600 const Operator* LoadMessage(); | 625 const Operator* LoadMessage(); |
601 const Operator* StoreMessage(); | 626 const Operator* StoreMessage(); |
602 | 627 |
603 // Used to implement Ignition's SuspendGenerator bytecode. | 628 // Used to implement Ignition's SuspendGenerator / AwaitGenerator bytecode. |
604 const Operator* GeneratorStore(int register_count); | 629 const Operator* GeneratorStore(int register_count, SuspendType suspend_type); |
605 | 630 |
606 // Used to implement Ignition's ResumeGenerator bytecode. | 631 // Used to implement Ignition's ResumeGenerator bytecode. |
607 const Operator* GeneratorRestoreContinuation(); | 632 const Operator* GeneratorRestoreContinuation(); |
608 const Operator* GeneratorRestoreRegister(int index); | 633 const Operator* GeneratorRestoreRegister(int index); |
609 | 634 |
610 const Operator* StackCheck(); | 635 const Operator* StackCheck(); |
611 | 636 |
612 const Operator* CreateFunctionContext(int slot_count, ScopeType scope_type); | 637 const Operator* CreateFunctionContext(int slot_count, ScopeType scope_type); |
613 const Operator* CreateCatchContext(const Handle<String>& name, | 638 const Operator* CreateCatchContext(const Handle<String>& name, |
614 const Handle<ScopeInfo>& scope_info); | 639 const Handle<ScopeInfo>& scope_info); |
615 const Operator* CreateWithContext(const Handle<ScopeInfo>& scope_info); | 640 const Operator* CreateWithContext(const Handle<ScopeInfo>& scope_info); |
616 const Operator* CreateBlockContext(const Handle<ScopeInfo>& scpope_info); | 641 const Operator* CreateBlockContext(const Handle<ScopeInfo>& scpope_info); |
617 const Operator* CreateModuleContext(); | 642 const Operator* CreateModuleContext(); |
618 const Operator* CreateScriptContext(const Handle<ScopeInfo>& scpope_info); | 643 const Operator* CreateScriptContext(const Handle<ScopeInfo>& scpope_info); |
619 | 644 |
620 private: | 645 private: |
621 Zone* zone() const { return zone_; } | 646 Zone* zone() const { return zone_; } |
622 | 647 |
623 const JSOperatorGlobalCache& cache_; | 648 const JSOperatorGlobalCache& cache_; |
624 Zone* const zone_; | 649 Zone* const zone_; |
625 | 650 |
626 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 651 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
627 }; | 652 }; |
628 | 653 |
629 } // namespace compiler | 654 } // namespace compiler |
630 } // namespace internal | 655 } // namespace internal |
631 } // namespace v8 | 656 } // namespace v8 |
632 | 657 |
633 #endif // V8_COMPILER_JS_OPERATOR_H_ | 658 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |