OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_VM_KERNEL_TO_IL_H_ | 5 #ifndef RUNTIME_VM_KERNEL_TO_IL_H_ |
6 #define RUNTIME_VM_KERNEL_TO_IL_H_ | 6 #define RUNTIME_VM_KERNEL_TO_IL_H_ |
7 | 7 |
8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
9 | 9 |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
11 #include "vm/hash_map.h" | 11 #include "vm/hash_map.h" |
12 | 12 |
13 #include "vm/flow_graph.h" | 13 #include "vm/flow_graph.h" |
14 #include "vm/flow_graph_builder.h" | 14 #include "vm/flow_graph_builder.h" |
15 #include "vm/intermediate_language.h" | 15 #include "vm/intermediate_language.h" |
| 16 #include "vm/kernel.h" |
16 | 17 |
17 namespace dart { | 18 namespace dart { |
18 namespace kernel { | 19 namespace kernel { |
19 | 20 |
20 class StreamingFlowGraphBuilder; | 21 class StreamingFlowGraphBuilder; |
21 | 22 |
22 class KernelConstMapKeyEqualsTraits { | 23 class KernelConstMapKeyEqualsTraits { |
23 public: | 24 public: |
24 static const char* Name() { return "KernelConstMapKeyEqualsTraits"; } | 25 static const char* Name() { return "KernelConstMapKeyEqualsTraits"; } |
25 static bool ReportStats() { return false; } | 26 static bool ReportStats() { return false; } |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 | 544 |
544 TranslationHelper& translation_helper_; | 545 TranslationHelper& translation_helper_; |
545 ActiveClass* active_class_; | 546 ActiveClass* active_class_; |
546 TypeParameterScope* type_parameter_scope_; | 547 TypeParameterScope* type_parameter_scope_; |
547 Zone* zone_; | 548 Zone* zone_; |
548 AbstractType& result_; | 549 AbstractType& result_; |
549 bool finalize_; | 550 bool finalize_; |
550 }; | 551 }; |
551 | 552 |
552 | 553 |
| 554 // There are several cases when we are compiling constant expressions: |
| 555 // |
| 556 // * constant field initializers: |
| 557 // const FieldName = <expr>; |
| 558 // |
| 559 // * constant expressions: |
| 560 // const [<expr>, ...] |
| 561 // const {<expr> : <expr>, ...} |
| 562 // const Constructor(<expr>, ...) |
| 563 // |
| 564 // * constant default parameters: |
| 565 // f(a, [b = <expr>]) |
| 566 // f(a, {b: <expr>}) |
| 567 // |
| 568 // * constant values to compare in a [SwitchCase] |
| 569 // case <expr>: |
| 570 // |
| 571 // In all cases `<expr>` must be recursively evaluated and canonicalized at |
| 572 // compile-time. |
| 573 class ConstantEvaluator : public ExpressionVisitor { |
| 574 public: |
| 575 ConstantEvaluator(FlowGraphBuilder* builder, |
| 576 Zone* zone, |
| 577 TranslationHelper* h, |
| 578 DartTypeTranslator* type_translator); |
| 579 virtual ~ConstantEvaluator() {} |
| 580 |
| 581 Instance& EvaluateExpression(Expression* node); |
| 582 Object& EvaluateExpressionSafe(Expression* node); |
| 583 Instance& EvaluateConstructorInvocation(ConstructorInvocation* node); |
| 584 Instance& EvaluateListLiteral(ListLiteral* node); |
| 585 Instance& EvaluateMapLiteral(MapLiteral* node); |
| 586 |
| 587 virtual void VisitDefaultExpression(Expression* node) { UNREACHABLE(); } |
| 588 |
| 589 virtual void VisitBigintLiteral(BigintLiteral* node); |
| 590 virtual void VisitBoolLiteral(BoolLiteral* node); |
| 591 virtual void VisitDoubleLiteral(DoubleLiteral* node); |
| 592 virtual void VisitIntLiteral(IntLiteral* node); |
| 593 virtual void VisitNullLiteral(NullLiteral* node); |
| 594 virtual void VisitStringLiteral(StringLiteral* node); |
| 595 virtual void VisitSymbolLiteral(SymbolLiteral* node); |
| 596 virtual void VisitTypeLiteral(TypeLiteral* node); |
| 597 |
| 598 virtual void VisitListLiteral(ListLiteral* node); |
| 599 virtual void VisitMapLiteral(MapLiteral* node); |
| 600 |
| 601 virtual void VisitConstructorInvocation(ConstructorInvocation* node); |
| 602 virtual void VisitMethodInvocation(MethodInvocation* node); |
| 603 virtual void VisitStaticGet(StaticGet* node); |
| 604 virtual void VisitVariableGet(VariableGet* node); |
| 605 virtual void VisitLet(Let* node); |
| 606 virtual void VisitStaticInvocation(StaticInvocation* node); |
| 607 virtual void VisitStringConcatenation(StringConcatenation* node); |
| 608 virtual void VisitConditionalExpression(ConditionalExpression* node); |
| 609 virtual void VisitLogicalExpression(LogicalExpression* node); |
| 610 virtual void VisitNot(Not* node); |
| 611 virtual void VisitPropertyGet(PropertyGet* node); |
| 612 |
| 613 private: |
| 614 // This will translate type arguments form [kernel_arguments]. If no type |
| 615 // arguments are passed and the [target] is a factory then the null type |
| 616 // argument array will be returned. |
| 617 // |
| 618 // If none of these cases apply, NULL will be returned. |
| 619 const TypeArguments* TranslateTypeArguments(const Function& target, |
| 620 dart::Class* target_klass, |
| 621 Arguments* kernel_arguments); |
| 622 |
| 623 const Object& RunFunction(const Function& function, |
| 624 Arguments* arguments, |
| 625 const Instance* receiver = NULL, |
| 626 const TypeArguments* type_args = NULL); |
| 627 |
| 628 const Object& RunFunction(const Function& function, |
| 629 const Array& arguments, |
| 630 const Array& names); |
| 631 |
| 632 RawObject* EvaluateConstConstructorCall(const dart::Class& type_class, |
| 633 const TypeArguments& type_arguments, |
| 634 const Function& constructor, |
| 635 const Object& argument); |
| 636 |
| 637 void AssertBoolInCheckedMode() { |
| 638 if (isolate_->type_checks() && !result_.IsBool()) { |
| 639 translation_helper_.ReportError("Expected boolean expression."); |
| 640 } |
| 641 } |
| 642 |
| 643 bool EvaluateBooleanExpression(Expression* expression) { |
| 644 EvaluateExpression(expression); |
| 645 AssertBoolInCheckedMode(); |
| 646 return result_.raw() == Bool::True().raw(); |
| 647 } |
| 648 |
| 649 bool GetCachedConstant(TreeNode* node, Instance* value); |
| 650 void CacheConstantValue(TreeNode* node, const Instance& value); |
| 651 |
| 652 FlowGraphBuilder* builder_; |
| 653 Isolate* isolate_; |
| 654 Zone* zone_; |
| 655 TranslationHelper& translation_helper_; |
| 656 DartTypeTranslator& type_translator_; |
| 657 |
| 658 Script& script_; |
| 659 Instance& result_; |
| 660 }; |
| 661 |
| 662 |
553 struct FunctionScope { | 663 struct FunctionScope { |
554 intptr_t kernel_offset; | 664 intptr_t kernel_offset; |
555 LocalScope* scope; | 665 LocalScope* scope; |
556 }; | 666 }; |
557 | 667 |
558 | 668 |
559 class ScopeBuildingResult : public ZoneAllocated { | 669 class ScopeBuildingResult : public ZoneAllocated { |
560 public: | 670 public: |
561 ScopeBuildingResult() | 671 ScopeBuildingResult() |
562 : this_variable(NULL), | 672 : this_variable(NULL), |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 Instruction* entry; | 721 Instruction* entry; |
612 intptr_t try_index; | 722 intptr_t try_index; |
613 | 723 |
614 YieldContinuation(Instruction* entry, intptr_t try_index) | 724 YieldContinuation(Instruction* entry, intptr_t try_index) |
615 : entry(entry), try_index(try_index) {} | 725 : entry(entry), try_index(try_index) {} |
616 | 726 |
617 YieldContinuation() | 727 YieldContinuation() |
618 : entry(NULL), try_index(CatchClauseNode::kInvalidTryIndex) {} | 728 : entry(NULL), try_index(CatchClauseNode::kInvalidTryIndex) {} |
619 }; | 729 }; |
620 | 730 |
621 class FlowGraphBuilder { | 731 class FlowGraphBuilder : public ExpressionVisitor, public StatementVisitor { |
622 public: | 732 public: |
623 FlowGraphBuilder(intptr_t kernel_offset, | 733 FlowGraphBuilder(TreeNode* node, |
624 ParsedFunction* parsed_function, | 734 ParsedFunction* parsed_function, |
625 const ZoneGrowableArray<const ICData*>& ic_data_array, | 735 const ZoneGrowableArray<const ICData*>& ic_data_array, |
626 ZoneGrowableArray<intptr_t>* context_level_array, | 736 ZoneGrowableArray<intptr_t>* context_level_array, |
627 InlineExitCollector* exit_collector, | 737 InlineExitCollector* exit_collector, |
628 intptr_t osr_id, | 738 intptr_t osr_id, |
629 intptr_t first_block_id = 1); | 739 intptr_t first_block_id = 1); |
630 virtual ~FlowGraphBuilder(); | 740 virtual ~FlowGraphBuilder(); |
631 | 741 |
632 FlowGraph* BuildGraph(); | 742 FlowGraph* BuildGraph(); |
633 | 743 |
| 744 virtual void VisitDefaultExpression(Expression* node) { UNREACHABLE(); } |
| 745 virtual void VisitDefaultStatement(Statement* node) { UNREACHABLE(); } |
| 746 |
| 747 virtual void VisitInvalidExpression(InvalidExpression* node); |
| 748 virtual void VisitNullLiteral(NullLiteral* node); |
| 749 virtual void VisitBoolLiteral(BoolLiteral* node); |
| 750 virtual void VisitIntLiteral(IntLiteral* node); |
| 751 virtual void VisitBigintLiteral(BigintLiteral* node); |
| 752 virtual void VisitDoubleLiteral(DoubleLiteral* node); |
| 753 virtual void VisitStringLiteral(StringLiteral* node); |
| 754 virtual void VisitSymbolLiteral(SymbolLiteral* node); |
| 755 virtual void VisitTypeLiteral(TypeLiteral* node); |
| 756 virtual void VisitVariableGet(VariableGet* node); |
| 757 virtual void VisitVariableSet(VariableSet* node); |
| 758 virtual void VisitStaticGet(StaticGet* node); |
| 759 virtual void VisitStaticSet(StaticSet* node); |
| 760 virtual void VisitPropertyGet(PropertyGet* node); |
| 761 virtual void VisitPropertySet(PropertySet* node); |
| 762 virtual void VisitDirectPropertyGet(DirectPropertyGet* node); |
| 763 virtual void VisitDirectPropertySet(DirectPropertySet* node); |
| 764 virtual void VisitStaticInvocation(StaticInvocation* node); |
| 765 virtual void VisitMethodInvocation(MethodInvocation* node); |
| 766 virtual void VisitDirectMethodInvocation(DirectMethodInvocation* node); |
| 767 virtual void VisitConstructorInvocation(ConstructorInvocation* node); |
| 768 virtual void VisitIsExpression(IsExpression* node); |
| 769 virtual void VisitAsExpression(AsExpression* node); |
| 770 virtual void VisitConditionalExpression(ConditionalExpression* node); |
| 771 virtual void VisitLogicalExpression(LogicalExpression* node); |
| 772 virtual void VisitNot(Not* node); |
| 773 virtual void VisitThisExpression(ThisExpression* node); |
| 774 virtual void VisitStringConcatenation(StringConcatenation* node); |
| 775 virtual void VisitListLiteral(ListLiteral* node); |
| 776 virtual void VisitMapLiteral(MapLiteral* node); |
| 777 virtual void VisitFunctionExpression(FunctionExpression* node); |
| 778 virtual void VisitLet(Let* node); |
| 779 virtual void VisitThrow(Throw* node); |
| 780 virtual void VisitRethrow(Rethrow* node); |
| 781 |
| 782 virtual void VisitInvalidStatement(InvalidStatement* node); |
| 783 virtual void VisitEmptyStatement(EmptyStatement* node); |
| 784 virtual void VisitBlock(Block* node); |
| 785 virtual void VisitReturnStatement(ReturnStatement* node); |
| 786 virtual void VisitExpressionStatement(ExpressionStatement* node); |
| 787 virtual void VisitVariableDeclaration(VariableDeclaration* node); |
| 788 virtual void VisitFunctionDeclaration(FunctionDeclaration* node); |
| 789 virtual void VisitIfStatement(IfStatement* node); |
| 790 virtual void VisitWhileStatement(WhileStatement* node); |
| 791 virtual void VisitDoStatement(DoStatement* node); |
| 792 virtual void VisitForStatement(ForStatement* node); |
| 793 virtual void VisitForInStatement(ForInStatement* node); |
| 794 virtual void VisitLabeledStatement(LabeledStatement* node); |
| 795 virtual void VisitBreakStatement(BreakStatement* node); |
| 796 virtual void VisitSwitchStatement(SwitchStatement* node); |
| 797 virtual void VisitContinueSwitchStatement(ContinueSwitchStatement* node); |
| 798 virtual void VisitAssertStatement(AssertStatement* node); |
| 799 virtual void VisitTryFinally(TryFinally* node); |
| 800 virtual void VisitTryCatch(TryCatch* node); |
| 801 virtual void VisitYieldStatement(YieldStatement* node); |
| 802 |
634 private: | 803 private: |
| 804 FlowGraph* BuildGraphOfFunction(FunctionNode* node, |
| 805 Constructor* constructor = NULL); |
| 806 FlowGraph* BuildGraphOfFieldAccessor(Field* node, |
| 807 LocalVariable* setter_value); |
| 808 FlowGraph* BuildGraphOfStaticFieldInitializer(Field* node); |
635 FlowGraph* BuildGraphOfMethodExtractor(const Function& method); | 809 FlowGraph* BuildGraphOfMethodExtractor(const Function& method); |
| 810 FlowGraph* BuildGraphOfImplicitClosureFunction(FunctionNode* kernel_function, |
| 811 const Function& function); |
636 FlowGraph* BuildGraphOfNoSuchMethodDispatcher(const Function& function); | 812 FlowGraph* BuildGraphOfNoSuchMethodDispatcher(const Function& function); |
637 FlowGraph* BuildGraphOfInvokeFieldDispatcher(const Function& function); | 813 FlowGraph* BuildGraphOfInvokeFieldDispatcher(const Function& function); |
638 | 814 |
639 Fragment NativeFunctionBody(intptr_t first_positional_offset, | 815 Fragment NativeFunctionBody(FunctionNode* kernel_function, |
640 const Function& function); | 816 const Function& function); |
641 | 817 |
| 818 void SetupDefaultParameterValues(FunctionNode* function); |
| 819 |
642 TargetEntryInstr* BuildTargetEntry(); | 820 TargetEntryInstr* BuildTargetEntry(); |
643 JoinEntryInstr* BuildJoinEntry(); | 821 JoinEntryInstr* BuildJoinEntry(); |
644 JoinEntryInstr* BuildJoinEntry(intptr_t try_index); | 822 JoinEntryInstr* BuildJoinEntry(intptr_t try_index); |
645 | 823 |
| 824 Fragment TranslateArguments(Arguments* node, Array* argument_names); |
646 ArgumentArray GetArguments(int count); | 825 ArgumentArray GetArguments(int count); |
647 | 826 |
| 827 Fragment TranslateInitializers(Class* kernel_class, |
| 828 List<Initializer>* initialiers); |
| 829 Fragment TranslateFieldInitializer(NameIndex canonical_name, |
| 830 Expression* init); |
| 831 |
| 832 Fragment TranslateStatement(Statement* statement); |
| 833 Fragment TranslateCondition(Expression* expression, bool* negate); |
| 834 Fragment TranslateExpression(Expression* expression); |
| 835 |
648 Fragment TranslateFinallyFinalizers(TryFinallyBlock* outer_finally, | 836 Fragment TranslateFinallyFinalizers(TryFinallyBlock* outer_finally, |
649 intptr_t target_context_depth); | 837 intptr_t target_context_depth); |
650 | 838 |
| 839 Fragment TranslateFunctionNode(FunctionNode* node, TreeNode* parent); |
| 840 |
| 841 Fragment EnterScope(TreeNode* node, bool* new_context = NULL); |
651 Fragment EnterScope(intptr_t kernel_offset, bool* new_context = NULL); | 842 Fragment EnterScope(intptr_t kernel_offset, bool* new_context = NULL); |
| 843 Fragment ExitScope(TreeNode* node); |
652 Fragment ExitScope(intptr_t kernel_offset); | 844 Fragment ExitScope(intptr_t kernel_offset); |
653 | 845 |
654 Fragment LoadContextAt(int depth); | 846 Fragment LoadContextAt(int depth); |
655 Fragment AdjustContextTo(int depth); | 847 Fragment AdjustContextTo(int depth); |
656 | 848 |
657 Fragment PushContext(int size); | 849 Fragment PushContext(int size); |
658 Fragment PopContext(); | 850 Fragment PopContext(); |
659 | 851 |
660 Fragment LoadInstantiatorTypeArguments(); | 852 Fragment LoadInstantiatorTypeArguments(); |
661 Fragment LoadFunctionTypeArguments(); | 853 Fragment LoadFunctionTypeArguments(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 Fragment StringInterpolate(TokenPosition position); | 936 Fragment StringInterpolate(TokenPosition position); |
745 Fragment StringInterpolateSingle(TokenPosition position); | 937 Fragment StringInterpolateSingle(TokenPosition position); |
746 Fragment ThrowTypeError(); | 938 Fragment ThrowTypeError(); |
747 Fragment ThrowNoSuchMethodError(); | 939 Fragment ThrowNoSuchMethodError(); |
748 Fragment BuildImplicitClosureCreation(const Function& target); | 940 Fragment BuildImplicitClosureCreation(const Function& target); |
749 Fragment GuardFieldLength(const dart::Field& field, intptr_t deopt_id); | 941 Fragment GuardFieldLength(const dart::Field& field, intptr_t deopt_id); |
750 Fragment GuardFieldClass(const dart::Field& field, intptr_t deopt_id); | 942 Fragment GuardFieldClass(const dart::Field& field, intptr_t deopt_id); |
751 | 943 |
752 Fragment EvaluateAssertion(); | 944 Fragment EvaluateAssertion(); |
753 Fragment CheckReturnTypeInCheckedMode(); | 945 Fragment CheckReturnTypeInCheckedMode(); |
| 946 Fragment CheckVariableTypeInCheckedMode(VariableDeclaration* variable); |
754 Fragment CheckVariableTypeInCheckedMode(const AbstractType& dst_type, | 947 Fragment CheckVariableTypeInCheckedMode(const AbstractType& dst_type, |
755 const dart::String& name_symbol); | 948 const dart::String& name_symbol); |
756 Fragment CheckBooleanInCheckedMode(); | 949 Fragment CheckBooleanInCheckedMode(); |
757 Fragment CheckAssignableInCheckedMode(const dart::AbstractType& dst_type, | 950 Fragment CheckAssignableInCheckedMode(const dart::AbstractType& dst_type, |
758 const dart::String& dst_name); | 951 const dart::String& dst_name); |
759 | 952 |
760 Fragment AssertBool(); | 953 Fragment AssertBool(); |
761 Fragment AssertAssignable(const dart::AbstractType& dst_type, | 954 Fragment AssertAssignable(const dart::AbstractType& dst_type, |
762 const dart::String& dst_name); | 955 const dart::String& dst_name); |
763 | 956 |
| 957 template <class Invocation> |
| 958 bool RecognizeComparisonWithNull(Token::Kind token_kind, Invocation* node); |
| 959 |
764 bool NeedsDebugStepCheck(const Function& function, TokenPosition position); | 960 bool NeedsDebugStepCheck(const Function& function, TokenPosition position); |
765 bool NeedsDebugStepCheck(Value* value, TokenPosition position); | 961 bool NeedsDebugStepCheck(Value* value, TokenPosition position); |
766 Fragment DebugStepCheck(TokenPosition position); | 962 Fragment DebugStepCheck(TokenPosition position); |
767 | 963 |
768 dart::RawFunction* LookupMethodByMember(NameIndex target, | 964 dart::RawFunction* LookupMethodByMember(NameIndex target, |
769 const dart::String& method_name); | 965 const dart::String& method_name); |
770 | 966 |
771 LocalVariable* MakeTemporary(); | 967 LocalVariable* MakeTemporary(); |
772 LocalVariable* MakeNonTemporary(const dart::String& symbol); | 968 LocalVariable* MakeNonTemporary(const dart::String& symbol); |
773 | 969 |
774 intptr_t CurrentTryIndex(); | 970 intptr_t CurrentTryIndex(); |
775 intptr_t AllocateTryIndex() { return next_used_try_index_++; } | 971 intptr_t AllocateTryIndex() { return next_used_try_index_++; } |
776 | 972 |
| 973 void AddVariable(VariableDeclaration* declaration, LocalVariable* variable); |
| 974 void AddParameter(VariableDeclaration* declaration, |
| 975 LocalVariable* variable, |
| 976 intptr_t pos); |
777 dart::LocalVariable* LookupVariable(VariableDeclaration* var); | 977 dart::LocalVariable* LookupVariable(VariableDeclaration* var); |
778 dart::LocalVariable* LookupVariable(intptr_t kernel_offset); | 978 dart::LocalVariable* LookupVariable(intptr_t kernel_offset); |
779 | 979 |
780 void SetTempIndex(Definition* definition); | 980 void SetTempIndex(Definition* definition); |
781 | 981 |
782 void Push(Definition* definition); | 982 void Push(Definition* definition); |
783 Value* Pop(); | 983 Value* Pop(); |
784 Fragment Drop(); | 984 Fragment Drop(); |
785 | 985 |
786 bool IsInlining() { return exit_collector_ != NULL; } | 986 bool IsInlining() { return exit_collector_ != NULL; } |
787 | 987 |
788 Token::Kind MethodKind(const dart::String& name); | 988 Token::Kind MethodKind(const dart::String& name); |
789 | 989 |
790 void InlineBailout(const char* reason); | 990 void InlineBailout(const char* reason); |
791 | 991 |
792 TranslationHelper translation_helper_; | 992 TranslationHelper translation_helper_; |
793 Thread* thread_; | 993 Thread* thread_; |
794 Zone* zone_; | 994 Zone* zone_; |
795 | 995 |
796 intptr_t kernel_offset_; | 996 // The node we are currently compiling (e.g. FunctionNode, Constructor, |
| 997 // Field) |
| 998 TreeNode* node_; |
797 | 999 |
798 ParsedFunction* parsed_function_; | 1000 ParsedFunction* parsed_function_; |
799 intptr_t osr_id_; | 1001 intptr_t osr_id_; |
800 const ZoneGrowableArray<const ICData*>& ic_data_array_; | 1002 const ZoneGrowableArray<const ICData*>& ic_data_array_; |
801 // Contains (deopt_id, context_level) pairs. | 1003 // Contains (deopt_id, context_level) pairs. |
802 ZoneGrowableArray<intptr_t>* context_level_array_; | 1004 ZoneGrowableArray<intptr_t>* context_level_array_; |
803 InlineExitCollector* exit_collector_; | 1005 InlineExitCollector* exit_collector_; |
804 | 1006 |
805 intptr_t next_block_id_; | 1007 intptr_t next_block_id_; |
806 intptr_t AllocateBlockId() { return next_block_id_++; } | 1008 intptr_t AllocateBlockId() { return next_block_id_++; } |
807 | 1009 |
808 intptr_t GetNextDeoptId() { | 1010 intptr_t GetNextDeoptId() { |
809 intptr_t deopt_id = thread_->GetNextDeoptId(); | 1011 intptr_t deopt_id = thread_->GetNextDeoptId(); |
810 if (context_level_array_ != NULL) { | 1012 if (context_level_array_ != NULL) { |
811 intptr_t level = context_depth_; | 1013 intptr_t level = context_depth_; |
812 context_level_array_->Add(deopt_id); | 1014 context_level_array_->Add(deopt_id); |
813 context_level_array_->Add(level); | 1015 context_level_array_->Add(level); |
814 } | 1016 } |
815 return deopt_id; | 1017 return deopt_id; |
816 } | 1018 } |
817 | 1019 |
818 intptr_t next_function_id_; | 1020 intptr_t next_function_id_; |
819 intptr_t AllocateFunctionId() { return next_function_id_++; } | 1021 intptr_t AllocateFunctionId() { return next_function_id_++; } |
820 | 1022 |
821 intptr_t context_depth_; | 1023 intptr_t context_depth_; |
822 intptr_t loop_depth_; | 1024 intptr_t loop_depth_; |
823 intptr_t try_depth_; | 1025 intptr_t try_depth_; |
824 intptr_t catch_depth_; | 1026 intptr_t catch_depth_; |
825 intptr_t for_in_depth_; | 1027 intptr_t for_in_depth_; |
| 1028 Fragment fragment_; |
826 Value* stack_; | 1029 Value* stack_; |
827 intptr_t pending_argument_count_; | 1030 intptr_t pending_argument_count_; |
828 | 1031 |
829 GraphEntryInstr* graph_entry_; | 1032 GraphEntryInstr* graph_entry_; |
830 | 1033 |
831 ScopeBuildingResult* scopes_; | 1034 ScopeBuildingResult* scopes_; |
832 | 1035 |
833 GrowableArray<YieldContinuation> yield_continuations_; | 1036 GrowableArray<YieldContinuation> yield_continuations_; |
834 | 1037 |
835 LocalVariable* CurrentException() { | 1038 LocalVariable* CurrentException() { |
(...skipping 23 matching lines...) Expand all Loading... |
859 // [TryCatchBlock] class. | 1062 // [TryCatchBlock] class. |
860 TryCatchBlock* try_catch_block_; | 1063 TryCatchBlock* try_catch_block_; |
861 intptr_t next_used_try_index_; | 1064 intptr_t next_used_try_index_; |
862 | 1065 |
863 // A chained list of catch blocks. Chaining and lookup is done by the | 1066 // A chained list of catch blocks. Chaining and lookup is done by the |
864 // [CatchBlock] class. | 1067 // [CatchBlock] class. |
865 CatchBlock* catch_block_; | 1068 CatchBlock* catch_block_; |
866 | 1069 |
867 ActiveClass active_class_; | 1070 ActiveClass active_class_; |
868 DartTypeTranslator type_translator_; | 1071 DartTypeTranslator type_translator_; |
| 1072 ConstantEvaluator constant_evaluator_; |
869 | 1073 |
870 StreamingFlowGraphBuilder* streaming_flow_graph_builder_; | 1074 StreamingFlowGraphBuilder* streaming_flow_graph_builder_; |
871 | 1075 |
872 friend class BreakableBlock; | 1076 friend class BreakableBlock; |
873 friend class CatchBlock; | 1077 friend class CatchBlock; |
874 friend class ConstantEvaluator; | 1078 friend class ConstantEvaluator; |
875 friend class DartTypeTranslator; | 1079 friend class DartTypeTranslator; |
876 friend class StreamingFlowGraphBuilder; | 1080 friend class StreamingFlowGraphBuilder; |
877 friend class ScopeBuilder; | 1081 friend class ScopeBuilder; |
878 friend class SwitchBlock; | 1082 friend class SwitchBlock; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 namespace kernel { | 1322 namespace kernel { |
1119 | 1323 |
1120 RawObject* EvaluateMetadata(const dart::Field& metadata_field); | 1324 RawObject* EvaluateMetadata(const dart::Field& metadata_field); |
1121 RawObject* BuildParameterDescriptor(const Function& function); | 1325 RawObject* BuildParameterDescriptor(const Function& function); |
1122 | 1326 |
1123 } // namespace kernel | 1327 } // namespace kernel |
1124 } // namespace dart | 1328 } // namespace dart |
1125 | 1329 |
1126 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1330 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
1127 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ | 1331 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ |
OLD | NEW |