OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 // Adding instructions. | 643 // Adding instructions. |
644 HInstruction* AddInstruction(HInstruction* instr); | 644 HInstruction* AddInstruction(HInstruction* instr); |
645 void AddSimulate(int id); | 645 void AddSimulate(int id); |
646 | 646 |
647 // Bailout environment manipulation. | 647 // Bailout environment manipulation. |
648 void Push(HValue* value) { environment()->Push(value); } | 648 void Push(HValue* value) { environment()->Push(value); } |
649 HValue* Pop() { return environment()->Pop(); } | 649 HValue* Pop() { return environment()->Pop(); } |
650 | 650 |
651 private: | 651 private: |
652 // Type of a member function that generates inline code for a native function. | 652 // Type of a member function that generates inline code for a native function. |
653 typedef void (HGraphBuilder::*InlineFunctionGenerator)(int argument_count, | 653 typedef void (HGraphBuilder::*InlineFunctionGenerator)(CallRuntime* call); |
654 int ast_id); | |
655 | 654 |
656 // Forward declarations for inner scope classes. | 655 // Forward declarations for inner scope classes. |
657 class SubgraphScope; | 656 class SubgraphScope; |
658 | 657 |
659 static const InlineFunctionGenerator kInlineFunctionGenerators[]; | 658 static const InlineFunctionGenerator kInlineFunctionGenerators[]; |
660 | 659 |
661 static const int kMaxCallPolymorphism = 4; | 660 static const int kMaxCallPolymorphism = 4; |
662 static const int kMaxLoadPolymorphism = 4; | 661 static const int kMaxLoadPolymorphism = 4; |
663 static const int kMaxStorePolymorphism = 4; | 662 static const int kMaxStorePolymorphism = 4; |
664 | 663 |
665 static const int kMaxInlinedNodes = 196; | 664 static const int kMaxInlinedNodes = 196; |
666 static const int kMaxInlinedSize = 196; | 665 static const int kMaxInlinedSize = 196; |
667 static const int kMaxSourceSize = 600; | 666 static const int kMaxSourceSize = 600; |
668 | 667 |
669 // Simple accessors. | 668 // Simple accessors. |
670 TypeFeedbackOracle* oracle() const { return oracle_; } | 669 TypeFeedbackOracle* oracle() const { return oracle_; } |
671 AstContext* ast_context() const { return ast_context_; } | 670 AstContext* ast_context() const { return ast_context_; } |
672 void set_ast_context(AstContext* context) { ast_context_ = context; } | 671 void set_ast_context(AstContext* context) { ast_context_ = context; } |
673 AstContext* call_context() const { return call_context_; } | 672 AstContext* call_context() const { return call_context_; } |
674 HBasicBlock* function_return() const { return function_return_; } | 673 HBasicBlock* function_return() const { return function_return_; } |
675 | 674 |
676 // Generators for inline runtime functions. | 675 // Generators for inline runtime functions. |
677 #define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \ | 676 #define INLINE_FUNCTION_GENERATOR_DECLARATION(Name, argc, ressize) \ |
678 void Generate##Name(int argument_count, int ast_id); | 677 void Generate##Name(CallRuntime* call); |
679 | 678 |
680 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) | 679 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) |
681 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) | 680 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_DECLARATION) |
682 #undef INLINE_FUNCTION_GENERATOR_DECLARATION | 681 #undef INLINE_FUNCTION_GENERATOR_DECLARATION |
683 | 682 |
684 void Bailout(const char* reason); | 683 void Bailout(const char* reason); |
685 | 684 |
686 void AppendPeeledWhile(IterationStatement* stmt, | 685 void AppendPeeledWhile(IterationStatement* stmt, |
687 HSubgraph* cond_graph, | 686 HSubgraph* cond_graph, |
688 HSubgraph* body_graph, | 687 HSubgraph* body_graph, |
689 HSubgraph* exit_graph); | 688 HSubgraph* exit_graph); |
690 | 689 |
691 void AddToSubgraph(HSubgraph* graph, ZoneList<Statement*>* stmts); | 690 void AddToSubgraph(HSubgraph* graph, ZoneList<Statement*>* stmts); |
692 void AddToSubgraph(HSubgraph* graph, Statement* stmt); | 691 void AddToSubgraph(HSubgraph* graph, Statement* stmt); |
693 void AddToSubgraph(HSubgraph* graph, Expression* expr); | 692 void AddToSubgraph(HSubgraph* graph, Expression* expr); |
694 | 693 |
695 HValue* Top() const { return environment()->Top(); } | 694 HValue* Top() const { return environment()->Top(); } |
696 void Drop(int n) { environment()->Drop(n); } | 695 void Drop(int n) { environment()->Drop(n); } |
697 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } | 696 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } |
698 | 697 |
699 void VisitForValue(Expression* expr); | 698 void VisitForValue(Expression* expr); |
700 void VisitForEffect(Expression* expr); | 699 void VisitForEffect(Expression* expr); |
701 void VisitForControl(Expression* expr, | 700 void VisitForControl(Expression* expr, |
702 HBasicBlock* true_block, | 701 HBasicBlock* true_block, |
703 HBasicBlock* false_block); | 702 HBasicBlock* false_block); |
704 | 703 |
705 // Visit an argument subexpression. | 704 // Visit an argument subexpression and emit a push to the outgoing |
| 705 // arguments. |
706 void VisitArgument(Expression* expr); | 706 void VisitArgument(Expression* expr); |
707 void VisitArgumentList(ZoneList<Expression*>* arguments); | 707 void VisitArgumentList(ZoneList<Expression*>* arguments); |
708 | 708 |
| 709 // Visit a list of expressions from left to right, each in a value context. |
| 710 void VisitExpressions(ZoneList<Expression*>* exprs); |
| 711 |
709 void AddPhi(HPhi* phi); | 712 void AddPhi(HPhi* phi); |
710 | 713 |
711 void PushAndAdd(HInstruction* instr); | 714 void PushAndAdd(HInstruction* instr); |
712 | 715 |
713 // Remove the arguments from the bailout environment and emit instructions | 716 // Remove the arguments from the bailout environment and emit instructions |
714 // to push them as outgoing parameters. | 717 // to push them as outgoing parameters. |
715 void PreProcessCall(HCall* call); | 718 void PreProcessCall(HCall* call); |
716 | 719 |
717 void AssumeRepresentation(HValue* value, Representation r); | 720 void AssumeRepresentation(HValue* value, Representation r); |
718 static Representation ToRepresentation(TypeInfo info); | 721 static Representation ToRepresentation(TypeInfo info); |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 const char* filename_; | 1069 const char* filename_; |
1067 HeapStringAllocator string_allocator_; | 1070 HeapStringAllocator string_allocator_; |
1068 StringStream trace_; | 1071 StringStream trace_; |
1069 int indent_; | 1072 int indent_; |
1070 }; | 1073 }; |
1071 | 1074 |
1072 | 1075 |
1073 } } // namespace v8::internal | 1076 } } // namespace v8::internal |
1074 | 1077 |
1075 #endif // V8_HYDROGEN_H_ | 1078 #endif // V8_HYDROGEN_H_ |
OLD | NEW |