| OLD | NEW |
| 1 // Copyright 2010 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 public: | 53 public: |
| 54 explicit HBasicBlock(HGraph* graph); | 54 explicit HBasicBlock(HGraph* graph); |
| 55 virtual ~HBasicBlock() { } | 55 virtual ~HBasicBlock() { } |
| 56 | 56 |
| 57 // Simple accessors. | 57 // Simple accessors. |
| 58 int block_id() const { return block_id_; } | 58 int block_id() const { return block_id_; } |
| 59 void set_block_id(int id) { block_id_ = id; } | 59 void set_block_id(int id) { block_id_ = id; } |
| 60 HGraph* graph() const { return graph_; } | 60 HGraph* graph() const { return graph_; } |
| 61 const ZoneList<HPhi*>* phis() const { return &phis_; } | 61 const ZoneList<HPhi*>* phis() const { return &phis_; } |
| 62 HInstruction* first() const { return first_; } | 62 HInstruction* first() const { return first_; } |
| 63 HInstruction* last() const { return last_; } |
| 64 void set_last(HInstruction* instr) { last_ = instr; } |
| 63 HInstruction* GetLastInstruction(); | 65 HInstruction* GetLastInstruction(); |
| 64 HControlInstruction* end() const { return end_; } | 66 HControlInstruction* end() const { return end_; } |
| 65 HLoopInformation* loop_information() const { return loop_information_; } | 67 HLoopInformation* loop_information() const { return loop_information_; } |
| 66 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } | 68 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } |
| 67 bool HasPredecessor() const { return predecessors_.length() > 0; } | 69 bool HasPredecessor() const { return predecessors_.length() > 0; } |
| 68 const ZoneList<HBasicBlock*>* dominated_blocks() const { | 70 const ZoneList<HBasicBlock*>* dominated_blocks() const { |
| 69 return &dominated_blocks_; | 71 return &dominated_blocks_; |
| 70 } | 72 } |
| 71 const ZoneList<int>* deleted_phis() const { | 73 const ZoneList<int>* deleted_phis() const { |
| 72 return &deleted_phis_; | 74 return &deleted_phis_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 96 bool IsFinished() const { return end_ != NULL; } | 98 bool IsFinished() const { return end_ != NULL; } |
| 97 void AddPhi(HPhi* phi); | 99 void AddPhi(HPhi* phi); |
| 98 void RemovePhi(HPhi* phi); | 100 void RemovePhi(HPhi* phi); |
| 99 void AddInstruction(HInstruction* instr); | 101 void AddInstruction(HInstruction* instr); |
| 100 bool Dominates(HBasicBlock* other) const; | 102 bool Dominates(HBasicBlock* other) const; |
| 101 | 103 |
| 102 void SetInitialEnvironment(HEnvironment* env); | 104 void SetInitialEnvironment(HEnvironment* env); |
| 103 void ClearEnvironment() { last_environment_ = NULL; } | 105 void ClearEnvironment() { last_environment_ = NULL; } |
| 104 bool HasEnvironment() const { return last_environment_ != NULL; } | 106 bool HasEnvironment() const { return last_environment_ != NULL; } |
| 105 void UpdateEnvironment(HEnvironment* env) { last_environment_ = env; } | 107 void UpdateEnvironment(HEnvironment* env) { last_environment_ = env; } |
| 106 HBasicBlock* parent_loop_header() const { | 108 HBasicBlock* parent_loop_header() const { return parent_loop_header_; } |
| 107 if (!HasParentLoopHeader()) return NULL; | 109 |
| 108 return parent_loop_header_.get(); | 110 void set_parent_loop_header(HBasicBlock* block) { |
| 111 ASSERT(parent_loop_header_ == NULL); |
| 112 parent_loop_header_ = block; |
| 109 } | 113 } |
| 110 | 114 |
| 111 void set_parent_loop_header(HBasicBlock* block) { | 115 bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } |
| 112 parent_loop_header_.set(block); | |
| 113 } | |
| 114 | |
| 115 bool HasParentLoopHeader() const { return parent_loop_header_.is_set(); } | |
| 116 | 116 |
| 117 void SetJoinId(int id); | 117 void SetJoinId(int id); |
| 118 | 118 |
| 119 void Finish(HControlInstruction* last); | 119 void Finish(HControlInstruction* last); |
| 120 void Goto(HBasicBlock* block, bool include_stack_check = false); | 120 void Goto(HBasicBlock* block, bool include_stack_check = false); |
| 121 | 121 |
| 122 int PredecessorIndexOf(HBasicBlock* predecessor) const; | 122 int PredecessorIndexOf(HBasicBlock* predecessor) const; |
| 123 void AddSimulate(int id) { AddInstruction(CreateSimulate(id)); } | 123 void AddSimulate(int id) { AddInstruction(CreateSimulate(id)); } |
| 124 void AssignCommonDominator(HBasicBlock* other); | 124 void AssignCommonDominator(HBasicBlock* other); |
| 125 | 125 |
| 126 // Add the inlined function exit sequence, adding an HLeaveInlined | 126 // Add the inlined function exit sequence, adding an HLeaveInlined |
| 127 // instruction and updating the bailout environment. | 127 // instruction and updating the bailout environment. |
| 128 void AddLeaveInlined(HValue* return_value, HBasicBlock* target); | 128 void AddLeaveInlined(HValue* return_value, HBasicBlock* target); |
| 129 | 129 |
| 130 // If a target block is tagged as an inline function return, all | 130 // If a target block is tagged as an inline function return, all |
| 131 // predecessors should contain the inlined exit sequence: | 131 // predecessors should contain the inlined exit sequence: |
| 132 // | 132 // |
| 133 // LeaveInlined | 133 // LeaveInlined |
| 134 // Simulate (caller's environment) | 134 // Simulate (caller's environment) |
| 135 // Goto (target block) | 135 // Goto (target block) |
| 136 bool IsInlineReturnTarget() const { return is_inline_return_target_; } | 136 bool IsInlineReturnTarget() const { return is_inline_return_target_; } |
| 137 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } | 137 void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } |
| 138 | 138 |
| 139 Handle<Object> cond() { return cond_; } | |
| 140 void set_cond(Handle<Object> value) { cond_ = value; } | |
| 141 | |
| 142 #ifdef DEBUG | 139 #ifdef DEBUG |
| 143 void Verify(); | 140 void Verify(); |
| 144 #endif | 141 #endif |
| 145 | 142 |
| 146 private: | 143 private: |
| 147 void RegisterPredecessor(HBasicBlock* pred); | 144 void RegisterPredecessor(HBasicBlock* pred); |
| 148 void AddDominatedBlock(HBasicBlock* block); | 145 void AddDominatedBlock(HBasicBlock* block); |
| 149 | 146 |
| 150 HSimulate* CreateSimulate(int id); | 147 HSimulate* CreateSimulate(int id); |
| 151 | 148 |
| 152 int block_id_; | 149 int block_id_; |
| 153 HGraph* graph_; | 150 HGraph* graph_; |
| 154 ZoneList<HPhi*> phis_; | 151 ZoneList<HPhi*> phis_; |
| 155 HInstruction* first_; | 152 HInstruction* first_; |
| 156 HInstruction* last_; // Last non-control instruction of the block. | 153 HInstruction* last_; |
| 157 HControlInstruction* end_; | 154 HControlInstruction* end_; |
| 158 HLoopInformation* loop_information_; | 155 HLoopInformation* loop_information_; |
| 159 ZoneList<HBasicBlock*> predecessors_; | 156 ZoneList<HBasicBlock*> predecessors_; |
| 160 HBasicBlock* dominator_; | 157 HBasicBlock* dominator_; |
| 161 ZoneList<HBasicBlock*> dominated_blocks_; | 158 ZoneList<HBasicBlock*> dominated_blocks_; |
| 162 HEnvironment* last_environment_; | 159 HEnvironment* last_environment_; |
| 163 // Outgoing parameter count at block exit, set during lithium translation. | 160 // Outgoing parameter count at block exit, set during lithium translation. |
| 164 int argument_count_; | 161 int argument_count_; |
| 165 // Instruction indices into the lithium code stream. | 162 // Instruction indices into the lithium code stream. |
| 166 int first_instruction_index_; | 163 int first_instruction_index_; |
| 167 int last_instruction_index_; | 164 int last_instruction_index_; |
| 168 ZoneList<int> deleted_phis_; | 165 ZoneList<int> deleted_phis_; |
| 169 SetOncePointer<HBasicBlock> parent_loop_header_; | 166 HBasicBlock* parent_loop_header_; |
| 170 bool is_inline_return_target_; | 167 bool is_inline_return_target_; |
| 171 Handle<Object> cond_; | |
| 172 }; | 168 }; |
| 173 | 169 |
| 174 | 170 |
| 175 class HLoopInformation: public ZoneObject { | 171 class HLoopInformation: public ZoneObject { |
| 176 public: | 172 public: |
| 177 explicit HLoopInformation(HBasicBlock* loop_header) | 173 explicit HLoopInformation(HBasicBlock* loop_header) |
| 178 : back_edges_(4), loop_header_(loop_header), blocks_(8) { | 174 : back_edges_(4), loop_header_(loop_header), blocks_(8) { |
| 179 blocks_.Add(loop_header); | 175 blocks_.Add(loop_header); |
| 180 } | 176 } |
| 181 virtual ~HLoopInformation() {} | 177 virtual ~HLoopInformation() {} |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 private: | 285 private: |
| 290 ZoneList<BreakContinueInfo*> break_continue_info_; | 286 ZoneList<BreakContinueInfo*> break_continue_info_; |
| 291 }; | 287 }; |
| 292 | 288 |
| 293 | 289 |
| 294 class HGraph: public HSubgraph { | 290 class HGraph: public HSubgraph { |
| 295 public: | 291 public: |
| 296 explicit HGraph(CompilationInfo* info); | 292 explicit HGraph(CompilationInfo* info); |
| 297 | 293 |
| 298 CompilationInfo* info() const { return info_; } | 294 CompilationInfo* info() const { return info_; } |
| 295 |
| 296 bool AllowCodeMotion() const; |
| 297 |
| 299 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 298 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| 300 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } | 299 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } |
| 301 Handle<String> debug_name() const { return info_->function()->debug_name(); } | 300 Handle<String> debug_name() const { return info_->function()->debug_name(); } |
| 302 HEnvironment* start_environment() const { return start_environment_; } | 301 HEnvironment* start_environment() const { return start_environment_; } |
| 303 | 302 |
| 304 void InitializeInferredTypes(); | 303 void InitializeInferredTypes(); |
| 305 void InsertTypeConversions(); | 304 void InsertTypeConversions(); |
| 306 void InsertRepresentationChanges(); | 305 void InsertRepresentationChanges(); |
| 306 void ComputeMinusZeroChecks(); |
| 307 bool ProcessArgumentsObject(); | 307 bool ProcessArgumentsObject(); |
| 308 void EliminateRedundantPhis(); | 308 void EliminateRedundantPhis(); |
| 309 void Canonicalize(); | 309 void Canonicalize(); |
| 310 void OrderBlocks(); | 310 void OrderBlocks(); |
| 311 void AssignDominators(); | 311 void AssignDominators(); |
| 312 | 312 |
| 313 // Returns false if there are phi-uses of the arguments-object | 313 // Returns false if there are phi-uses of the arguments-object |
| 314 // which are not supported by the optimizing compiler. | 314 // which are not supported by the optimizing compiler. |
| 315 bool CollectPhis(); | 315 bool CollectPhis(); |
| 316 | 316 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 HValue* Top() const { return environment()->Top(); } | 695 HValue* Top() const { return environment()->Top(); } |
| 696 void Drop(int n) { environment()->Drop(n); } | 696 void Drop(int n) { environment()->Drop(n); } |
| 697 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } | 697 void Bind(Variable* var, HValue* value) { environment()->Bind(var, value); } |
| 698 | 698 |
| 699 void VisitForValue(Expression* expr); | 699 void VisitForValue(Expression* expr); |
| 700 void VisitForEffect(Expression* expr); | 700 void VisitForEffect(Expression* expr); |
| 701 void VisitForControl(Expression* expr, | 701 void VisitForControl(Expression* expr, |
| 702 HBasicBlock* true_block, | 702 HBasicBlock* true_block, |
| 703 HBasicBlock* false_block); | 703 HBasicBlock* false_block); |
| 704 | 704 |
| 705 // Visit an argument and wrap it in a PushArgument instruction. | 705 // Visit an argument subexpression. |
| 706 HValue* VisitArgument(Expression* expr); | 706 void VisitArgument(Expression* expr); |
| 707 void VisitArgumentList(ZoneList<Expression*>* arguments); | 707 void VisitArgumentList(ZoneList<Expression*>* arguments); |
| 708 | 708 |
| 709 void AddPhi(HPhi* phi); | 709 void AddPhi(HPhi* phi); |
| 710 | 710 |
| 711 void PushAndAdd(HInstruction* instr); | 711 void PushAndAdd(HInstruction* instr); |
| 712 | 712 |
| 713 void PushArgumentsForStubCall(int argument_count); | |
| 714 | |
| 715 // Remove the arguments from the bailout environment and emit instructions | 713 // Remove the arguments from the bailout environment and emit instructions |
| 716 // to push them as outgoing parameters. | 714 // to push them as outgoing parameters. |
| 717 void ProcessCall(HCall* call); | 715 void PreProcessCall(HCall* call); |
| 718 | 716 |
| 719 void AssumeRepresentation(HValue* value, Representation r); | 717 void AssumeRepresentation(HValue* value, Representation r); |
| 720 static Representation ToRepresentation(TypeInfo info); | 718 static Representation ToRepresentation(TypeInfo info); |
| 721 | 719 |
| 722 void SetupScope(Scope* scope); | 720 void SetupScope(Scope* scope); |
| 723 virtual void VisitStatements(ZoneList<Statement*>* statements); | 721 virtual void VisitStatements(ZoneList<Statement*>* statements); |
| 724 | 722 |
| 725 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 723 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 726 AST_NODE_LIST(DECLARE_VISIT) | 724 AST_NODE_LIST(DECLARE_VISIT) |
| 727 #undef DECLARE_VISIT | 725 #undef DECLARE_VISIT |
| (...skipping 10 matching lines...) Expand all Loading... |
| 738 FunctionLiteral* function); | 736 FunctionLiteral* function); |
| 739 | 737 |
| 740 // Helpers for flow graph construction. | 738 // Helpers for flow graph construction. |
| 741 void LookupGlobalPropertyCell(Variable* var, | 739 void LookupGlobalPropertyCell(Variable* var, |
| 742 LookupResult* lookup, | 740 LookupResult* lookup, |
| 743 bool is_store); | 741 bool is_store); |
| 744 | 742 |
| 745 bool TryArgumentsAccess(Property* expr); | 743 bool TryArgumentsAccess(Property* expr); |
| 746 bool TryCallApply(Call* expr); | 744 bool TryCallApply(Call* expr); |
| 747 bool TryInline(Call* expr); | 745 bool TryInline(Call* expr); |
| 748 bool TryMathFunctionInline(Call* expr); | 746 bool TryInlineBuiltinFunction(Call* expr, |
| 747 HValue* receiver, |
| 748 Handle<Map> receiver_map, |
| 749 CheckType check_type); |
| 749 void TraceInline(Handle<JSFunction> target, bool result); | 750 void TraceInline(Handle<JSFunction> target, bool result); |
| 750 | 751 |
| 751 void HandleGlobalVariableAssignment(Variable* var, | 752 void HandleGlobalVariableAssignment(Variable* var, |
| 752 HValue* value, | 753 HValue* value, |
| 753 int position, | 754 int position, |
| 754 int ast_id); | 755 int ast_id); |
| 755 | 756 |
| 756 void HandlePropertyAssignment(Assignment* expr); | 757 void HandlePropertyAssignment(Assignment* expr); |
| 757 void HandleCompoundAssignment(Assignment* expr); | 758 void HandleCompoundAssignment(Assignment* expr); |
| 758 void HandlePolymorphicLoadNamedField(Property* expr, | 759 void HandlePolymorphicLoadNamedField(Property* expr, |
| 759 HValue* object, | 760 HValue* object, |
| 760 ZoneMapList* types, | 761 ZoneMapList* types, |
| 761 Handle<String> name); | 762 Handle<String> name); |
| 762 void HandlePolymorphicStoreNamedField(Assignment* expr, | 763 void HandlePolymorphicStoreNamedField(Assignment* expr, |
| 763 HValue* object, | 764 HValue* object, |
| 764 HValue* value, | 765 HValue* value, |
| 765 ZoneMapList* types, | 766 ZoneMapList* types, |
| 766 Handle<String> name); | 767 Handle<String> name); |
| 767 void HandlePolymorphicCallNamed(Call* expr, | 768 void HandlePolymorphicCallNamed(Call* expr, |
| 768 HValue* receiver, | 769 HValue* receiver, |
| 769 ZoneMapList* types, | 770 ZoneMapList* types, |
| 770 Handle<String> name); | 771 Handle<String> name); |
| 771 | 772 |
| 773 HStringCharCodeAt* BuildStringCharCodeAt(HValue* string, |
| 774 HValue* index); |
| 772 HInstruction* BuildBinaryOperation(BinaryOperation* expr, | 775 HInstruction* BuildBinaryOperation(BinaryOperation* expr, |
| 773 HValue* left, | 776 HValue* left, |
| 774 HValue* right); | 777 HValue* right); |
| 775 HInstruction* BuildIncrement(HValue* value, bool increment); | 778 HInstruction* BuildIncrement(HValue* value, bool increment); |
| 776 HLoadNamedField* BuildLoadNamedField(HValue* object, | 779 HLoadNamedField* BuildLoadNamedField(HValue* object, |
| 777 Property* expr, | 780 Property* expr, |
| 778 Handle<Map> type, | 781 Handle<Map> type, |
| 779 LookupResult* result, | 782 LookupResult* result, |
| 780 bool smi_and_map_check); | 783 bool smi_and_map_check); |
| 781 HInstruction* BuildLoadNamedGeneric(HValue* object, Property* expr); | 784 HInstruction* BuildLoadNamedGeneric(HValue* object, Property* expr); |
| 782 HInstruction* BuildLoadKeyedFastElement(HValue* object, | 785 HInstruction* BuildLoadKeyedFastElement(HValue* object, |
| 783 HValue* key, | 786 HValue* key, |
| 784 Property* expr); | 787 Property* expr); |
| 788 HInstruction* BuildLoadKeyedPixelArrayElement(HValue* object, |
| 789 HValue* key, |
| 790 Property* expr); |
| 785 HInstruction* BuildLoadKeyedGeneric(HValue* object, | 791 HInstruction* BuildLoadKeyedGeneric(HValue* object, |
| 786 HValue* key); | 792 HValue* key); |
| 787 | 793 |
| 788 HInstruction* BuildLoadNamed(HValue* object, | 794 HInstruction* BuildLoadNamed(HValue* object, |
| 789 Property* prop, | 795 Property* prop, |
| 790 Handle<Map> map, | 796 Handle<Map> map, |
| 791 Handle<String> name); | 797 Handle<String> name); |
| 792 HInstruction* BuildStoreNamed(HValue* object, | 798 HInstruction* BuildStoreNamed(HValue* object, |
| 793 HValue* value, | 799 HValue* value, |
| 794 Expression* expr); | 800 Expression* expr); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 807 | 813 |
| 808 HInstruction* BuildStoreKeyedFastElement(HValue* object, | 814 HInstruction* BuildStoreKeyedFastElement(HValue* object, |
| 809 HValue* key, | 815 HValue* key, |
| 810 HValue* val, | 816 HValue* val, |
| 811 Expression* expr); | 817 Expression* expr); |
| 812 | 818 |
| 813 HCompare* BuildSwitchCompare(HSubgraph* subgraph, | 819 HCompare* BuildSwitchCompare(HSubgraph* subgraph, |
| 814 HValue* switch_value, | 820 HValue* switch_value, |
| 815 CaseClause* clause); | 821 CaseClause* clause); |
| 816 | 822 |
| 823 HValue* BuildContextChainWalk(Variable* var); |
| 824 |
| 817 void AddCheckConstantFunction(Call* expr, | 825 void AddCheckConstantFunction(Call* expr, |
| 818 HValue* receiver, | 826 HValue* receiver, |
| 819 Handle<Map> receiver_map, | 827 Handle<Map> receiver_map, |
| 820 bool smi_and_map_check); | 828 bool smi_and_map_check); |
| 821 | 829 |
| 822 | 830 |
| 823 HBasicBlock* BuildTypeSwitch(ZoneMapList* maps, | 831 HBasicBlock* BuildTypeSwitch(HValue* receiver, |
| 824 ZoneList<HSubgraph*>* subgraphs, | 832 ZoneMapList* maps, |
| 825 HValue* receiver, | 833 ZoneList<HSubgraph*>* body_graphs, |
| 834 HSubgraph* default_graph, |
| 826 int join_id); | 835 int join_id); |
| 827 | 836 |
| 828 TypeFeedbackOracle* oracle_; | 837 TypeFeedbackOracle* oracle_; |
| 829 HGraph* graph_; | 838 HGraph* graph_; |
| 830 HSubgraph* current_subgraph_; | 839 HSubgraph* current_subgraph_; |
| 831 IterationStatement* peeled_statement_; | 840 IterationStatement* peeled_statement_; |
| 832 // Expression context of the currently visited subexpression. NULL when | 841 // Expression context of the currently visited subexpression. NULL when |
| 833 // visiting statements. | 842 // visiting statements. |
| 834 AstContext* ast_context_; | 843 AstContext* ast_context_; |
| 835 | 844 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 HValueMapListElement* array_; // Primary store - contains the first value | 908 HValueMapListElement* array_; // Primary store - contains the first value |
| 900 // with a given hash. Colliding elements are stored in linked lists. | 909 // with a given hash. Colliding elements are stored in linked lists. |
| 901 HValueMapListElement* lists_; // The linked lists containing hash collisions. | 910 HValueMapListElement* lists_; // The linked lists containing hash collisions. |
| 902 int free_list_head_; // Unused elements in lists_ are on the free list. | 911 int free_list_head_; // Unused elements in lists_ are on the free list. |
| 903 }; | 912 }; |
| 904 | 913 |
| 905 | 914 |
| 906 class HStatistics: public Malloced { | 915 class HStatistics: public Malloced { |
| 907 public: | 916 public: |
| 908 void Print(); | 917 void Print(); |
| 909 void SaveTiming(const char* name, int64_t ticks); | 918 void SaveTiming(const char* name, int64_t ticks, unsigned size); |
| 910 static HStatistics* Instance() { | 919 static HStatistics* Instance() { |
| 911 static SetOncePointer<HStatistics> instance; | 920 static SetOncePointer<HStatistics> instance; |
| 912 if (!instance.is_set()) { | 921 if (!instance.is_set()) { |
| 913 instance.set(new HStatistics()); | 922 instance.set(new HStatistics()); |
| 914 } | 923 } |
| 915 return instance.get(); | 924 return instance.get(); |
| 916 } | 925 } |
| 917 | 926 |
| 918 private: | 927 private: |
| 919 | 928 |
| 920 HStatistics() : timing_(5), names_(5), total_(0), full_code_gen_(0) { } | 929 HStatistics() |
| 930 : timing_(5), |
| 931 names_(5), |
| 932 sizes_(5), |
| 933 total_(0), |
| 934 total_size_(0), |
| 935 full_code_gen_(0) { } |
| 921 | 936 |
| 922 List<int64_t> timing_; | 937 List<int64_t> timing_; |
| 923 List<const char*> names_; | 938 List<const char*> names_; |
| 939 List<unsigned> sizes_; |
| 924 int64_t total_; | 940 int64_t total_; |
| 941 unsigned total_size_; |
| 925 int64_t full_code_gen_; | 942 int64_t full_code_gen_; |
| 926 }; | 943 }; |
| 927 | 944 |
| 928 | 945 |
| 929 class HPhase BASE_EMBEDDED { | 946 class HPhase BASE_EMBEDDED { |
| 930 public: | 947 public: |
| 931 static const char* const kFullCodeGen; | 948 static const char* const kFullCodeGen; |
| 932 static const char* const kTotal; | 949 static const char* const kTotal; |
| 933 | 950 |
| 934 explicit HPhase(const char* name) { Begin(name, NULL, NULL, NULL); } | 951 explicit HPhase(const char* name) { Begin(name, NULL, NULL, NULL); } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 951 HGraph* graph, | 968 HGraph* graph, |
| 952 LChunk* chunk, | 969 LChunk* chunk, |
| 953 LAllocator* allocator); | 970 LAllocator* allocator); |
| 954 void End() const; | 971 void End() const; |
| 955 | 972 |
| 956 int64_t start_; | 973 int64_t start_; |
| 957 const char* name_; | 974 const char* name_; |
| 958 HGraph* graph_; | 975 HGraph* graph_; |
| 959 LChunk* chunk_; | 976 LChunk* chunk_; |
| 960 LAllocator* allocator_; | 977 LAllocator* allocator_; |
| 978 unsigned start_allocation_size_; |
| 961 }; | 979 }; |
| 962 | 980 |
| 963 | 981 |
| 964 class HTracer: public Malloced { | 982 class HTracer: public Malloced { |
| 965 public: | 983 public: |
| 966 void TraceCompilation(FunctionLiteral* function); | 984 void TraceCompilation(FunctionLiteral* function); |
| 967 void TraceHydrogen(const char* name, HGraph* graph); | 985 void TraceHydrogen(const char* name, HGraph* graph); |
| 968 void TraceLithium(const char* name, LChunk* chunk); | 986 void TraceLithium(const char* name, LChunk* chunk); |
| 969 void TraceLiveRanges(const char* name, LAllocator* allocator); | 987 void TraceLiveRanges(const char* name, LAllocator* allocator); |
| 970 | 988 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 const char* filename_; | 1066 const char* filename_; |
| 1049 HeapStringAllocator string_allocator_; | 1067 HeapStringAllocator string_allocator_; |
| 1050 StringStream trace_; | 1068 StringStream trace_; |
| 1051 int indent_; | 1069 int indent_; |
| 1052 }; | 1070 }; |
| 1053 | 1071 |
| 1054 | 1072 |
| 1055 } } // namespace v8::internal | 1073 } } // namespace v8::internal |
| 1056 | 1074 |
| 1057 #endif // V8_HYDROGEN_H_ | 1075 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |