| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 class HBasicBlock: public ZoneObject { | 55 class HBasicBlock: public ZoneObject { |
| 56 public: | 56 public: |
| 57 explicit HBasicBlock(HGraph* graph); | 57 explicit HBasicBlock(HGraph* graph); |
| 58 virtual ~HBasicBlock() { } | 58 virtual ~HBasicBlock() { } |
| 59 | 59 |
| 60 // Simple accessors. | 60 // Simple accessors. |
| 61 int block_id() const { return block_id_; } | 61 int block_id() const { return block_id_; } |
| 62 void set_block_id(int id) { block_id_ = id; } | 62 void set_block_id(int id) { block_id_ = id; } |
| 63 HGraph* graph() const { return graph_; } | 63 HGraph* graph() const { return graph_; } |
| 64 Isolate* isolate() const; |
| 64 const ZoneList<HPhi*>* phis() const { return &phis_; } | 65 const ZoneList<HPhi*>* phis() const { return &phis_; } |
| 65 HInstruction* first() const { return first_; } | 66 HInstruction* first() const { return first_; } |
| 66 HInstruction* last() const { return last_; } | 67 HInstruction* last() const { return last_; } |
| 67 void set_last(HInstruction* instr) { last_ = instr; } | 68 void set_last(HInstruction* instr) { last_ = instr; } |
| 68 HInstruction* GetLastInstruction(); | 69 HInstruction* GetLastInstruction(); |
| 69 HControlInstruction* end() const { return end_; } | 70 HControlInstruction* end() const { return end_; } |
| 70 HLoopInformation* loop_information() const { return loop_information_; } | 71 HLoopInformation* loop_information() const { return loop_information_; } |
| 71 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } | 72 const ZoneList<HBasicBlock*>* predecessors() const { return &predecessors_; } |
| 72 bool HasPredecessor() const { return predecessors_.length() > 0; } | 73 bool HasPredecessor() const { return predecessors_.length() > 0; } |
| 73 const ZoneList<HBasicBlock*>* dominated_blocks() const { | 74 const ZoneList<HBasicBlock*>* dominated_blocks() const { |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 explicit HGraphBuilder(CompilationInfo* info) | 864 explicit HGraphBuilder(CompilationInfo* info) |
| 864 : info_(info), graph_(NULL), current_block_(NULL) {} | 865 : info_(info), graph_(NULL), current_block_(NULL) {} |
| 865 virtual ~HGraphBuilder() {} | 866 virtual ~HGraphBuilder() {} |
| 866 | 867 |
| 867 HBasicBlock* current_block() const { return current_block_; } | 868 HBasicBlock* current_block() const { return current_block_; } |
| 868 void set_current_block(HBasicBlock* block) { current_block_ = block; } | 869 void set_current_block(HBasicBlock* block) { current_block_ = block; } |
| 869 HEnvironment* environment() const { | 870 HEnvironment* environment() const { |
| 870 return current_block()->last_environment(); | 871 return current_block()->last_environment(); |
| 871 } | 872 } |
| 872 Zone* zone() const { return info_->zone(); } | 873 Zone* zone() const { return info_->zone(); } |
| 873 HGraph* graph() { return graph_; } | 874 HGraph* graph() const { return graph_; } |
| 875 Isolate* isolate() const { return graph_->isolate(); } |
| 874 | 876 |
| 875 HGraph* CreateGraph(); | 877 HGraph* CreateGraph(); |
| 876 | 878 |
| 877 // Adding instructions. | 879 // Adding instructions. |
| 878 HInstruction* AddInstruction(HInstruction* instr); | 880 HInstruction* AddInstruction(HInstruction* instr); |
| 879 void AddSimulate(BailoutId id, | 881 void AddSimulate(BailoutId id, |
| 880 RemovableSimulate removable = FIXED_SIMULATE); | 882 RemovableSimulate removable = FIXED_SIMULATE); |
| 881 HBoundsCheck* AddBoundsCheck( | 883 HBoundsCheck* AddBoundsCheck( |
| 882 HValue* index, | 884 HValue* index, |
| 883 HValue* length, | 885 HValue* length, |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 inline HInstruction* at(int i) const { return operator[](i); } | 1529 inline HInstruction* at(int i) const { return operator[](i); } |
| 1528 | 1530 |
| 1529 private: | 1531 private: |
| 1530 int count_; | 1532 int count_; |
| 1531 HInstruction* data_[kNumberOfTrackedSideEffects]; | 1533 HInstruction* data_[kNumberOfTrackedSideEffects]; |
| 1532 }; | 1534 }; |
| 1533 | 1535 |
| 1534 | 1536 |
| 1535 class HStatistics: public Malloced { | 1537 class HStatistics: public Malloced { |
| 1536 public: | 1538 public: |
| 1539 HStatistics() |
| 1540 : timing_(5), |
| 1541 names_(5), |
| 1542 sizes_(5), |
| 1543 create_graph_(0), |
| 1544 optimize_graph_(0), |
| 1545 generate_code_(0), |
| 1546 total_size_(0), |
| 1547 full_code_gen_(0), |
| 1548 source_size_(0) { } |
| 1549 |
| 1537 void Initialize(CompilationInfo* info); | 1550 void Initialize(CompilationInfo* info); |
| 1538 void Print(); | 1551 void Print(); |
| 1539 void SaveTiming(const char* name, int64_t ticks, unsigned size); | 1552 void SaveTiming(const char* name, int64_t ticks, unsigned size); |
| 1540 static HStatistics* Instance() { | |
| 1541 static SetOncePointer<HStatistics> instance; | |
| 1542 if (!instance.is_set()) { | |
| 1543 instance.set(new HStatistics()); | |
| 1544 } | |
| 1545 return instance.get(); | |
| 1546 } | |
| 1547 | 1553 |
| 1548 void IncrementSubtotals(int64_t create_graph, | 1554 void IncrementSubtotals(int64_t create_graph, |
| 1549 int64_t optimize_graph, | 1555 int64_t optimize_graph, |
| 1550 int64_t generate_code) { | 1556 int64_t generate_code) { |
| 1551 create_graph_ += create_graph; | 1557 create_graph_ += create_graph; |
| 1552 optimize_graph_ += optimize_graph; | 1558 optimize_graph_ += optimize_graph; |
| 1553 generate_code_ += generate_code; | 1559 generate_code_ += generate_code; |
| 1554 } | 1560 } |
| 1555 | 1561 |
| 1556 private: | 1562 private: |
| 1557 HStatistics() | |
| 1558 : timing_(5), | |
| 1559 names_(5), | |
| 1560 sizes_(5), | |
| 1561 create_graph_(0), | |
| 1562 optimize_graph_(0), | |
| 1563 generate_code_(0), | |
| 1564 total_size_(0), | |
| 1565 full_code_gen_(0), | |
| 1566 source_size_(0) { } | |
| 1567 | |
| 1568 List<int64_t> timing_; | 1563 List<int64_t> timing_; |
| 1569 List<const char*> names_; | 1564 List<const char*> names_; |
| 1570 List<unsigned> sizes_; | 1565 List<unsigned> sizes_; |
| 1571 int64_t create_graph_; | 1566 int64_t create_graph_; |
| 1572 int64_t optimize_graph_; | 1567 int64_t optimize_graph_; |
| 1573 int64_t generate_code_; | 1568 int64_t generate_code_; |
| 1574 unsigned total_size_; | 1569 unsigned total_size_; |
| 1575 int64_t full_code_gen_; | 1570 int64_t full_code_gen_; |
| 1576 double source_size_; | 1571 double source_size_; |
| 1577 }; | 1572 }; |
| 1578 | 1573 |
| 1579 | 1574 |
| 1580 class HPhase BASE_EMBEDDED { | 1575 class HPhase BASE_EMBEDDED { |
| 1581 public: | 1576 public: |
| 1582 static const char* const kFullCodeGen; | 1577 static const char* const kFullCodeGen; |
| 1583 | 1578 |
| 1584 HPhase(const char* name, Isolate* isolate); | 1579 HPhase(const char* name, Isolate* isolate); |
| 1585 HPhase(const char* name, HGraph* graph); | 1580 HPhase(const char* name, HGraph* graph); |
| 1586 HPhase(const char* name, LChunk* chunk); | 1581 HPhase(const char* name, LChunk* chunk); |
| 1587 HPhase(const char* name, LAllocator* allocator); | 1582 HPhase(const char* name, LAllocator* allocator); |
| 1588 ~HPhase(); | 1583 ~HPhase(); |
| 1589 | 1584 |
| 1590 private: | 1585 private: |
| 1591 void Init(Isolate* isolate, | 1586 void Init(Isolate* isolate, |
| 1592 const char* name, | 1587 const char* name, |
| 1593 HGraph* graph, | 1588 HGraph* graph, |
| 1594 LChunk* chunk, | 1589 LChunk* chunk, |
| 1595 LAllocator* allocator); | 1590 LAllocator* allocator); |
| 1596 | 1591 |
| 1597 Isolate* isolate_; | 1592 Isolate* isolate_; |
| 1598 const char* name_; | 1593 const char* name_; |
| 1599 HGraph* graph_; | 1594 HGraph* graph_; |
| 1600 LChunk* chunk_; | 1595 LChunk* chunk_; |
| 1601 LAllocator* allocator_; | 1596 LAllocator* allocator_; |
| 1602 int64_t start_ticks_; | 1597 int64_t start_ticks_; |
| 1603 unsigned start_allocation_size_; | 1598 unsigned start_allocation_size_; |
| 1604 }; | 1599 }; |
| 1605 | 1600 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1682 EmbeddedVector<char, 64> filename_; | 1677 EmbeddedVector<char, 64> filename_; |
| 1683 HeapStringAllocator string_allocator_; | 1678 HeapStringAllocator string_allocator_; |
| 1684 StringStream trace_; | 1679 StringStream trace_; |
| 1685 int indent_; | 1680 int indent_; |
| 1686 }; | 1681 }; |
| 1687 | 1682 |
| 1688 | 1683 |
| 1689 } } // namespace v8::internal | 1684 } } // namespace v8::internal |
| 1690 | 1685 |
| 1691 #endif // V8_HYDROGEN_H_ | 1686 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |