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