| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } | 119 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } |
| 120 | 120 |
| 121 void SetJoinId(BailoutId ast_id); | 121 void SetJoinId(BailoutId ast_id); |
| 122 | 122 |
| 123 void Finish(HControlInstruction* last); | 123 void Finish(HControlInstruction* last); |
| 124 void FinishExit(HControlInstruction* instruction); | 124 void FinishExit(HControlInstruction* instruction); |
| 125 void Goto(HBasicBlock* block, FunctionState* state = NULL); | 125 void Goto(HBasicBlock* block, FunctionState* state = NULL); |
| 126 | 126 |
| 127 int PredecessorIndexOf(HBasicBlock* predecessor) const; | 127 int PredecessorIndexOf(HBasicBlock* predecessor) const; |
| 128 void AddSimulate(BailoutId ast_id) { AddInstruction(CreateSimulate(ast_id)); } | 128 void AddSimulate(BailoutId ast_id, bool optional = false) { |
| 129 AddInstruction(CreateSimulate(ast_id, optional)); |
| 130 } |
| 129 void AssignCommonDominator(HBasicBlock* other); | 131 void AssignCommonDominator(HBasicBlock* other); |
| 130 void AssignLoopSuccessorDominators(); | 132 void AssignLoopSuccessorDominators(); |
| 131 | 133 |
| 132 void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) { | 134 void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) { |
| 133 FinishExit(CreateDeoptimize(has_uses)); | 135 FinishExit(CreateDeoptimize(has_uses)); |
| 134 } | 136 } |
| 135 | 137 |
| 136 // Add the inlined function exit sequence, adding an HLeaveInlined | 138 // Add the inlined function exit sequence, adding an HLeaveInlined |
| 137 // instruction and updating the bailout environment. | 139 // instruction and updating the bailout environment. |
| 138 void AddLeaveInlined(HValue* return_value, FunctionState* state); | 140 void AddLeaveInlined(HValue* return_value, FunctionState* state); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 159 inline Zone* zone() const; | 161 inline Zone* zone() const; |
| 160 | 162 |
| 161 #ifdef DEBUG | 163 #ifdef DEBUG |
| 162 void Verify(); | 164 void Verify(); |
| 163 #endif | 165 #endif |
| 164 | 166 |
| 165 private: | 167 private: |
| 166 void RegisterPredecessor(HBasicBlock* pred); | 168 void RegisterPredecessor(HBasicBlock* pred); |
| 167 void AddDominatedBlock(HBasicBlock* block); | 169 void AddDominatedBlock(HBasicBlock* block); |
| 168 | 170 |
| 169 HSimulate* CreateSimulate(BailoutId ast_id); | 171 HSimulate* CreateSimulate(BailoutId ast_id, bool optional); |
| 170 HDeoptimize* CreateDeoptimize(HDeoptimize::UseEnvironment has_uses); | 172 HDeoptimize* CreateDeoptimize(HDeoptimize::UseEnvironment has_uses); |
| 171 | 173 |
| 172 int block_id_; | 174 int block_id_; |
| 173 HGraph* graph_; | 175 HGraph* graph_; |
| 174 ZoneList<HPhi*> phis_; | 176 ZoneList<HPhi*> phis_; |
| 175 HInstruction* first_; | 177 HInstruction* first_; |
| 176 HInstruction* last_; | 178 HInstruction* last_; |
| 177 HControlInstruction* end_; | 179 HControlInstruction* end_; |
| 178 HLoopInformation* loop_information_; | 180 HLoopInformation* loop_information_; |
| 179 ZoneList<HBasicBlock*> predecessors_; | 181 ZoneList<HBasicBlock*> predecessors_; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 int local_count_; | 607 int local_count_; |
| 606 HEnvironment* outer_; | 608 HEnvironment* outer_; |
| 607 HEnterInlined* entry_; | 609 HEnterInlined* entry_; |
| 608 int pop_count_; | 610 int pop_count_; |
| 609 int push_count_; | 611 int push_count_; |
| 610 BailoutId ast_id_; | 612 BailoutId ast_id_; |
| 611 Zone* zone_; | 613 Zone* zone_; |
| 612 }; | 614 }; |
| 613 | 615 |
| 614 | 616 |
| 617 class HInferRepresentation BASE_EMBEDDED { |
| 618 public: |
| 619 explicit HInferRepresentation(HGraph* graph) |
| 620 : graph_(graph), |
| 621 worklist_(8, graph->zone()), |
| 622 in_worklist_(graph->GetMaximumValueID(), graph->zone()) { } |
| 623 |
| 624 void Analyze(); |
| 625 void AddToWorklist(HValue* current); |
| 626 |
| 627 private: |
| 628 Zone* zone() const { return graph_->zone(); } |
| 629 |
| 630 HGraph* graph_; |
| 631 ZoneList<HValue*> worklist_; |
| 632 BitVector in_worklist_; |
| 633 }; |
| 634 |
| 635 |
| 615 class HGraphBuilder; | 636 class HGraphBuilder; |
| 616 | 637 |
| 617 enum ArgumentsAllowedFlag { | 638 enum ArgumentsAllowedFlag { |
| 618 ARGUMENTS_NOT_ALLOWED, | 639 ARGUMENTS_NOT_ALLOWED, |
| 619 ARGUMENTS_ALLOWED | 640 ARGUMENTS_ALLOWED |
| 620 }; | 641 }; |
| 621 | 642 |
| 622 // This class is not BASE_EMBEDDED because our inlining implementation uses | 643 // This class is not BASE_EMBEDDED because our inlining implementation uses |
| 623 // new and delete. | 644 // new and delete. |
| 624 class AstContext { | 645 class AstContext { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 HBasicBlock* current_block() const { return current_block_; } | 893 HBasicBlock* current_block() const { return current_block_; } |
| 873 void set_current_block(HBasicBlock* block) { current_block_ = block; } | 894 void set_current_block(HBasicBlock* block) { current_block_ = block; } |
| 874 HEnvironment* environment() const { | 895 HEnvironment* environment() const { |
| 875 return current_block()->last_environment(); | 896 return current_block()->last_environment(); |
| 876 } | 897 } |
| 877 | 898 |
| 878 bool inline_bailout() { return inline_bailout_; } | 899 bool inline_bailout() { return inline_bailout_; } |
| 879 | 900 |
| 880 // Adding instructions. | 901 // Adding instructions. |
| 881 HInstruction* AddInstruction(HInstruction* instr); | 902 HInstruction* AddInstruction(HInstruction* instr); |
| 882 void AddSimulate(BailoutId ast_id); | 903 void AddSimulate(BailoutId ast_id, bool optional = false); |
| 883 | 904 |
| 884 // Bailout environment manipulation. | 905 // Bailout environment manipulation. |
| 885 void Push(HValue* value) { environment()->Push(value); } | 906 void Push(HValue* value) { environment()->Push(value); } |
| 886 HValue* Pop() { return environment()->Pop(); } | 907 HValue* Pop() { return environment()->Pop(); } |
| 887 | 908 |
| 888 void Bailout(const char* reason); | 909 void Bailout(const char* reason); |
| 889 | 910 |
| 890 HBasicBlock* CreateJoin(HBasicBlock* first, | 911 HBasicBlock* CreateJoin(HBasicBlock* first, |
| 891 HBasicBlock* second, | 912 HBasicBlock* second, |
| 892 BailoutId join_id); | 913 BailoutId join_id); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 void VisitExpressions(ZoneList<Expression*>* exprs); | 1038 void VisitExpressions(ZoneList<Expression*>* exprs); |
| 1018 | 1039 |
| 1019 void AddPhi(HPhi* phi); | 1040 void AddPhi(HPhi* phi); |
| 1020 | 1041 |
| 1021 void PushAndAdd(HInstruction* instr); | 1042 void PushAndAdd(HInstruction* instr); |
| 1022 | 1043 |
| 1023 // Remove the arguments from the bailout environment and emit instructions | 1044 // Remove the arguments from the bailout environment and emit instructions |
| 1024 // to push them as outgoing parameters. | 1045 // to push them as outgoing parameters. |
| 1025 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); | 1046 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); |
| 1026 | 1047 |
| 1027 void TraceRepresentation(Token::Value op, | |
| 1028 TypeInfo info, | |
| 1029 HValue* value, | |
| 1030 Representation rep); | |
| 1031 static Representation ToRepresentation(TypeInfo info); | 1048 static Representation ToRepresentation(TypeInfo info); |
| 1032 | 1049 |
| 1033 void SetUpScope(Scope* scope); | 1050 void SetUpScope(Scope* scope); |
| 1034 virtual void VisitStatements(ZoneList<Statement*>* statements); | 1051 virtual void VisitStatements(ZoneList<Statement*>* statements); |
| 1035 | 1052 |
| 1036 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 1053 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 1037 AST_NODE_LIST(DECLARE_VISIT) | 1054 AST_NODE_LIST(DECLARE_VISIT) |
| 1038 #undef DECLARE_VISIT | 1055 #undef DECLARE_VISIT |
| 1039 | 1056 |
| 1040 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 1057 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 const char* filename_; | 1507 const char* filename_; |
| 1491 HeapStringAllocator string_allocator_; | 1508 HeapStringAllocator string_allocator_; |
| 1492 StringStream trace_; | 1509 StringStream trace_; |
| 1493 int indent_; | 1510 int indent_; |
| 1494 }; | 1511 }; |
| 1495 | 1512 |
| 1496 | 1513 |
| 1497 } } // namespace v8::internal | 1514 } } // namespace v8::internal |
| 1498 | 1515 |
| 1499 #endif // V8_HYDROGEN_H_ | 1516 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |