| 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 24 matching lines...) Expand all  Loading... | 
| 35 #include "compiler.h" | 35 #include "compiler.h" | 
| 36 #include "hydrogen-instructions.h" | 36 #include "hydrogen-instructions.h" | 
| 37 #include "type-info.h" | 37 #include "type-info.h" | 
| 38 #include "zone.h" | 38 #include "zone.h" | 
| 39 | 39 | 
| 40 namespace v8 { | 40 namespace v8 { | 
| 41 namespace internal { | 41 namespace internal { | 
| 42 | 42 | 
| 43 // Forward declarations. | 43 // Forward declarations. | 
| 44 class BitVector; | 44 class BitVector; | 
| 45 class FunctionState; |  | 
| 46 class HEnvironment; | 45 class HEnvironment; | 
| 47 class HGraph; | 46 class HGraph; | 
| 48 class HLoopInformation; | 47 class HLoopInformation; | 
| 49 class HTracer; | 48 class HTracer; | 
| 50 class LAllocator; | 49 class LAllocator; | 
| 51 class LChunk; | 50 class LChunk; | 
| 52 class LiveRange; | 51 class LiveRange; | 
| 53 | 52 | 
| 54 | 53 | 
| 55 class HBasicBlock: public ZoneObject { | 54 class HBasicBlock: public ZoneObject { | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 115     ASSERT(parent_loop_header_ == NULL); | 114     ASSERT(parent_loop_header_ == NULL); | 
| 116     parent_loop_header_ = block; | 115     parent_loop_header_ = block; | 
| 117   } | 116   } | 
| 118 | 117 | 
| 119   bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } | 118   bool HasParentLoopHeader() const { return parent_loop_header_ != NULL; } | 
| 120 | 119 | 
| 121   void SetJoinId(int ast_id); | 120   void SetJoinId(int ast_id); | 
| 122 | 121 | 
| 123   void Finish(HControlInstruction* last); | 122   void Finish(HControlInstruction* last); | 
| 124   void FinishExit(HControlInstruction* instruction); | 123   void FinishExit(HControlInstruction* instruction); | 
| 125   void Goto(HBasicBlock* block, FunctionState* state = NULL); | 124   void Goto(HBasicBlock* block, bool drop_extra = false); | 
| 126 | 125 | 
| 127   int PredecessorIndexOf(HBasicBlock* predecessor) const; | 126   int PredecessorIndexOf(HBasicBlock* predecessor) const; | 
| 128   void AddSimulate(int ast_id) { AddInstruction(CreateSimulate(ast_id)); } | 127   void AddSimulate(int ast_id) { AddInstruction(CreateSimulate(ast_id)); } | 
| 129   void AssignCommonDominator(HBasicBlock* other); | 128   void AssignCommonDominator(HBasicBlock* other); | 
| 130   void AssignLoopSuccessorDominators(); | 129   void AssignLoopSuccessorDominators(); | 
| 131 | 130 | 
| 132   void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) { | 131   void FinishExitWithDeoptimization(HDeoptimize::UseEnvironment has_uses) { | 
| 133     FinishExit(CreateDeoptimize(has_uses)); | 132     FinishExit(CreateDeoptimize(has_uses)); | 
| 134   } | 133   } | 
| 135 | 134 | 
| 136   // Add the inlined function exit sequence, adding an HLeaveInlined | 135   // Add the inlined function exit sequence, adding an HLeaveInlined | 
| 137   // instruction and updating the bailout environment. | 136   // instruction and updating the bailout environment. | 
| 138   void AddLeaveInlined(HValue* return_value, | 137   void AddLeaveInlined(HValue* return_value, | 
| 139                        HBasicBlock* target, | 138                        HBasicBlock* target, | 
| 140                        FunctionState* state = NULL); | 139                        bool drop_extra = false); | 
| 141 | 140 | 
| 142   // If a target block is tagged as an inline function return, all | 141   // If a target block is tagged as an inline function return, all | 
| 143   // predecessors should contain the inlined exit sequence: | 142   // predecessors should contain the inlined exit sequence: | 
| 144   // | 143   // | 
| 145   // LeaveInlined | 144   // LeaveInlined | 
| 146   // Simulate (caller's environment) | 145   // Simulate (caller's environment) | 
| 147   // Goto (target block) | 146   // Goto (target block) | 
| 148   bool IsInlineReturnTarget() const { return is_inline_return_target_; } | 147   bool IsInlineReturnTarget() const { return is_inline_return_target_; } | 
| 149   void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } | 148   void MarkAsInlineReturnTarget() { is_inline_return_target_ = true; } | 
| 150 | 149 | 
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 709   bool is_construct() { return return_handling_ == CONSTRUCT_CALL_RETURN; } | 708   bool is_construct() { return return_handling_ == CONSTRUCT_CALL_RETURN; } | 
| 710   HBasicBlock* function_return() { return function_return_; } | 709   HBasicBlock* function_return() { return function_return_; } | 
| 711   TestContext* test_context() { return test_context_; } | 710   TestContext* test_context() { return test_context_; } | 
| 712   void ClearInlinedTestContext() { | 711   void ClearInlinedTestContext() { | 
| 713     delete test_context_; | 712     delete test_context_; | 
| 714     test_context_ = NULL; | 713     test_context_ = NULL; | 
| 715   } | 714   } | 
| 716 | 715 | 
| 717   FunctionState* outer() { return outer_; } | 716   FunctionState* outer() { return outer_; } | 
| 718 | 717 | 
| 719   HInstruction* entry() { return entry_; } |  | 
| 720   void set_entry(HInstruction* entry) { entry_ = entry; } |  | 
| 721 |  | 
| 722   HInstruction* arguments_elements() { return arguments_elements_; } |  | 
| 723   void set_arguments_elements(HInstruction* arguments_elements) { |  | 
| 724     arguments_elements_ = arguments_elements; |  | 
| 725   } |  | 
| 726 |  | 
| 727   bool arguments_pushed() { return arguments_elements() != NULL; } |  | 
| 728 |  | 
| 729  private: | 718  private: | 
| 730   HGraphBuilder* owner_; | 719   HGraphBuilder* owner_; | 
| 731 | 720 | 
| 732   CompilationInfo* compilation_info_; | 721   CompilationInfo* compilation_info_; | 
| 733   TypeFeedbackOracle* oracle_; | 722   TypeFeedbackOracle* oracle_; | 
| 734 | 723 | 
| 735   // During function inlining, expression context of the call being | 724   // During function inlining, expression context of the call being | 
| 736   // inlined. NULL when not inlining. | 725   // inlined. NULL when not inlining. | 
| 737   AstContext* call_context_; | 726   AstContext* call_context_; | 
| 738 | 727 | 
| 739   // Indicate whether we have to perform special handling on return from | 728   // Indicate whether we have to perform special handling on return from | 
| 740   // inlined functions. | 729   // inlined functions. | 
| 741   // - DROP_EXTRA_ON_RETURN: Drop an extra value from the environment. | 730   // - DROP_EXTRA_ON_RETURN: Drop an extra value from the environment. | 
| 742   // - CONSTRUCT_CALL_RETURN: Either use allocated receiver or return value. | 731   // - CONSTRUCT_CALL_RETURN: Either use allocated receiver or return value. | 
| 743   ReturnHandlingFlag return_handling_; | 732   ReturnHandlingFlag return_handling_; | 
| 744 | 733 | 
| 745   // When inlining in an effect or value context, this is the return block. | 734   // When inlining in an effect or value context, this is the return block. | 
| 746   // It is NULL otherwise.  When inlining in a test context, there are a | 735   // It is NULL otherwise.  When inlining in a test context, there are a | 
| 747   // pair of return blocks in the context.  When not inlining, there is no | 736   // pair of return blocks in the context.  When not inlining, there is no | 
| 748   // local return point. | 737   // local return point. | 
| 749   HBasicBlock* function_return_; | 738   HBasicBlock* function_return_; | 
| 750 | 739 | 
| 751   // When inlining a call in a test context, a context containing a pair of | 740   // When inlining a call in a test context, a context containing a pair of | 
| 752   // return blocks.  NULL in all other cases. | 741   // return blocks.  NULL in all other cases. | 
| 753   TestContext* test_context_; | 742   TestContext* test_context_; | 
| 754 | 743 | 
| 755   // When inlining HEnterInlined instruction corresponding to the function |  | 
| 756   // entry. |  | 
| 757   HInstruction* entry_; |  | 
| 758 |  | 
| 759   HInstruction* arguments_elements_; |  | 
| 760 |  | 
| 761   FunctionState* outer_; | 744   FunctionState* outer_; | 
| 762 }; | 745 }; | 
| 763 | 746 | 
| 764 | 747 | 
| 765 class HGraphBuilder: public AstVisitor { | 748 class HGraphBuilder: public AstVisitor { | 
| 766  public: | 749  public: | 
| 767   enum BreakType { BREAK, CONTINUE }; | 750   enum BreakType { BREAK, CONTINUE }; | 
| 768   enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; | 751   enum SwitchType { UNKNOWN_SWITCH, SMI_SWITCH, STRING_SWITCH }; | 
| 769 | 752 | 
| 770   // A class encapsulating (lazily-allocated) break and continue blocks for | 753   // A class encapsulating (lazily-allocated) break and continue blocks for | 
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1387   const char* filename_; | 1370   const char* filename_; | 
| 1388   HeapStringAllocator string_allocator_; | 1371   HeapStringAllocator string_allocator_; | 
| 1389   StringStream trace_; | 1372   StringStream trace_; | 
| 1390   int indent_; | 1373   int indent_; | 
| 1391 }; | 1374 }; | 
| 1392 | 1375 | 
| 1393 | 1376 | 
| 1394 } }  // namespace v8::internal | 1377 } }  // namespace v8::internal | 
| 1395 | 1378 | 
| 1396 #endif  // V8_HYDROGEN_H_ | 1379 #endif  // V8_HYDROGEN_H_ | 
| OLD | NEW | 
|---|