| 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, RemovableSimulate removable = FIXED) { |
| 129 AddInstruction(CreateSimulate(ast_id, removable)); |
| 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, RemovableSimulate removable); |
| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 Zone* zone() const { return zone_; } | 250 Zone* zone() const { return zone_; } |
| 249 CompilationInfo* info() const { return info_; } | 251 CompilationInfo* info() const { return info_; } |
| 250 | 252 |
| 251 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 253 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| 252 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } | 254 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } |
| 253 HBasicBlock* entry_block() const { return entry_block_; } | 255 HBasicBlock* entry_block() const { return entry_block_; } |
| 254 HEnvironment* start_environment() const { return start_environment_; } | 256 HEnvironment* start_environment() const { return start_environment_; } |
| 255 | 257 |
| 256 void InitializeInferredTypes(); | 258 void InitializeInferredTypes(); |
| 257 void InsertTypeConversions(); | 259 void InsertTypeConversions(); |
| 260 void MergeRemovableSimulates(); |
| 258 void InsertRepresentationChanges(); | 261 void InsertRepresentationChanges(); |
| 259 void MarkDeoptimizeOnUndefined(); | 262 void MarkDeoptimizeOnUndefined(); |
| 260 void ComputeMinusZeroChecks(); | 263 void ComputeMinusZeroChecks(); |
| 261 void ComputeSafeUint32Operations(); | 264 void ComputeSafeUint32Operations(); |
| 262 bool ProcessArgumentsObject(); | 265 bool ProcessArgumentsObject(); |
| 263 void EliminateRedundantPhis(); | 266 void EliminateRedundantPhis(); |
| 264 void EliminateUnreachablePhis(); | 267 void EliminateUnreachablePhis(); |
| 265 void Canonicalize(); | 268 void Canonicalize(); |
| 266 void OrderBlocks(); | 269 void OrderBlocks(); |
| 267 void AssignDominators(); | 270 void AssignDominators(); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 int local_count_; | 609 int local_count_; |
| 607 HEnvironment* outer_; | 610 HEnvironment* outer_; |
| 608 HEnterInlined* entry_; | 611 HEnterInlined* entry_; |
| 609 int pop_count_; | 612 int pop_count_; |
| 610 int push_count_; | 613 int push_count_; |
| 611 BailoutId ast_id_; | 614 BailoutId ast_id_; |
| 612 Zone* zone_; | 615 Zone* zone_; |
| 613 }; | 616 }; |
| 614 | 617 |
| 615 | 618 |
| 619 class HInferRepresentation BASE_EMBEDDED { |
| 620 public: |
| 621 explicit HInferRepresentation(HGraph* graph) |
| 622 : graph_(graph), |
| 623 worklist_(8, graph->zone()), |
| 624 in_worklist_(graph->GetMaximumValueID(), graph->zone()) { } |
| 625 |
| 626 void Analyze(); |
| 627 void AddToWorklist(HValue* current); |
| 628 |
| 629 private: |
| 630 Zone* zone() const { return graph_->zone(); } |
| 631 |
| 632 HGraph* graph_; |
| 633 ZoneList<HValue*> worklist_; |
| 634 BitVector in_worklist_; |
| 635 }; |
| 636 |
| 637 |
| 616 class HGraphBuilder; | 638 class HGraphBuilder; |
| 617 | 639 |
| 618 enum ArgumentsAllowedFlag { | 640 enum ArgumentsAllowedFlag { |
| 619 ARGUMENTS_NOT_ALLOWED, | 641 ARGUMENTS_NOT_ALLOWED, |
| 620 ARGUMENTS_ALLOWED | 642 ARGUMENTS_ALLOWED |
| 621 }; | 643 }; |
| 622 | 644 |
| 623 // This class is not BASE_EMBEDDED because our inlining implementation uses | 645 // This class is not BASE_EMBEDDED because our inlining implementation uses |
| 624 // new and delete. | 646 // new and delete. |
| 625 class AstContext { | 647 class AstContext { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 HBasicBlock* current_block() const { return current_block_; } | 895 HBasicBlock* current_block() const { return current_block_; } |
| 874 void set_current_block(HBasicBlock* block) { current_block_ = block; } | 896 void set_current_block(HBasicBlock* block) { current_block_ = block; } |
| 875 HEnvironment* environment() const { | 897 HEnvironment* environment() const { |
| 876 return current_block()->last_environment(); | 898 return current_block()->last_environment(); |
| 877 } | 899 } |
| 878 | 900 |
| 879 bool inline_bailout() { return inline_bailout_; } | 901 bool inline_bailout() { return inline_bailout_; } |
| 880 | 902 |
| 881 // Adding instructions. | 903 // Adding instructions. |
| 882 HInstruction* AddInstruction(HInstruction* instr); | 904 HInstruction* AddInstruction(HInstruction* instr); |
| 883 void AddSimulate(BailoutId ast_id); | 905 void AddSimulate(BailoutId ast_id, RemovableSimulate removable = FIXED); |
| 884 | 906 |
| 885 // Bailout environment manipulation. | 907 // Bailout environment manipulation. |
| 886 void Push(HValue* value) { environment()->Push(value); } | 908 void Push(HValue* value) { environment()->Push(value); } |
| 887 HValue* Pop() { return environment()->Pop(); } | 909 HValue* Pop() { return environment()->Pop(); } |
| 888 | 910 |
| 889 void Bailout(const char* reason); | 911 void Bailout(const char* reason); |
| 890 | 912 |
| 891 HBasicBlock* CreateJoin(HBasicBlock* first, | 913 HBasicBlock* CreateJoin(HBasicBlock* first, |
| 892 HBasicBlock* second, | 914 HBasicBlock* second, |
| 893 BailoutId join_id); | 915 BailoutId join_id); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 void VisitExpressions(ZoneList<Expression*>* exprs); | 1040 void VisitExpressions(ZoneList<Expression*>* exprs); |
| 1019 | 1041 |
| 1020 void AddPhi(HPhi* phi); | 1042 void AddPhi(HPhi* phi); |
| 1021 | 1043 |
| 1022 void PushAndAdd(HInstruction* instr); | 1044 void PushAndAdd(HInstruction* instr); |
| 1023 | 1045 |
| 1024 // Remove the arguments from the bailout environment and emit instructions | 1046 // Remove the arguments from the bailout environment and emit instructions |
| 1025 // to push them as outgoing parameters. | 1047 // to push them as outgoing parameters. |
| 1026 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); | 1048 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); |
| 1027 | 1049 |
| 1028 void TraceRepresentation(Token::Value op, | |
| 1029 TypeInfo info, | |
| 1030 HValue* value, | |
| 1031 Representation rep); | |
| 1032 static Representation ToRepresentation(TypeInfo info); | 1050 static Representation ToRepresentation(TypeInfo info); |
| 1033 | 1051 |
| 1034 void SetUpScope(Scope* scope); | 1052 void SetUpScope(Scope* scope); |
| 1035 virtual void VisitStatements(ZoneList<Statement*>* statements); | 1053 virtual void VisitStatements(ZoneList<Statement*>* statements); |
| 1036 | 1054 |
| 1037 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 1055 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 1038 AST_NODE_LIST(DECLARE_VISIT) | 1056 AST_NODE_LIST(DECLARE_VISIT) |
| 1039 #undef DECLARE_VISIT | 1057 #undef DECLARE_VISIT |
| 1040 | 1058 |
| 1041 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 1059 HBasicBlock* CreateBasicBlock(HEnvironment* env); |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 const char* filename_; | 1514 const char* filename_; |
| 1497 HeapStringAllocator string_allocator_; | 1515 HeapStringAllocator string_allocator_; |
| 1498 StringStream trace_; | 1516 StringStream trace_; |
| 1499 int indent_; | 1517 int indent_; |
| 1500 }; | 1518 }; |
| 1501 | 1519 |
| 1502 | 1520 |
| 1503 } } // namespace v8::internal | 1521 } } // namespace v8::internal |
| 1504 | 1522 |
| 1505 #endif // V8_HYDROGEN_H_ | 1523 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |