diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-03-27 12:04:12 +0100 |
---|---|---|
committer | Chris Dickinson <christopher.s.dickinson@gmail.com> | 2015-04-28 14:38:16 -0700 |
commit | 36cd5fb9d27b830320e57213f5b8829ffbb93324 (patch) | |
tree | bbab4215d26f8597019135206426fccf27a3089e /deps/v8/src/compiler/schedule.h | |
parent | b57cc51d8d3f4ad279591ae8fa6584ee22773b97 (diff) | |
download | node-new-36cd5fb9d27b830320e57213f5b8829ffbb93324.tar.gz |
deps: upgrade v8 to 4.2.77.13
This commit applies some secondary changes in order to make `make test`
pass cleanly:
* disable broken postmortem debugging in common.gypi
* drop obsolete strict mode test in parallel/test-repl
* drop obsolete test parallel/test-v8-features
PR-URL: https://github.com/iojs/io.js/pull/1232
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'deps/v8/src/compiler/schedule.h')
-rw-r--r-- | deps/v8/src/compiler/schedule.h | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/deps/v8/src/compiler/schedule.h b/deps/v8/src/compiler/schedule.h index 0bba689785..d4d64533b5 100644 --- a/deps/v8/src/compiler/schedule.h +++ b/deps/v8/src/compiler/schedule.h @@ -6,23 +6,22 @@ #define V8_COMPILER_SCHEDULE_H_ #include <iosfwd> -#include <vector> -#include "src/v8.h" - -#include "src/compiler/node.h" -#include "src/compiler/opcodes.h" -#include "src/zone.h" +#include "src/zone-containers.h" namespace v8 { namespace internal { namespace compiler { +// Forward declarations. class BasicBlock; class BasicBlockInstrumentor; -class Graph; -class ConstructScheduleData; -class CodeGenerator; // Because of a namespace bug in clang. +class Node; + + +typedef ZoneVector<BasicBlock*> BasicBlockVector; +typedef ZoneVector<Node*> NodeVector; + // A basic block contains an ordered list of nodes and ends with a control // node. Note that if a basic block has phis, then all phis must appear as the @@ -34,6 +33,7 @@ class BasicBlock FINAL : public ZoneObject { kNone, // Control not initialized yet. kGoto, // Goto a single successor block. kBranch, // Branch if true to first successor, otherwise second. + kSwitch, // Table dispatch to one of the successor blocks. kReturn, // Return a value from this method. kThrow // Throw an exception. }; @@ -83,39 +83,32 @@ class BasicBlock FINAL : public ZoneObject { Id id() const { return id_; } - // Predecessors and successors. - typedef ZoneVector<BasicBlock*> Predecessors; - Predecessors::iterator predecessors_begin() { return predecessors_.begin(); } - Predecessors::iterator predecessors_end() { return predecessors_.end(); } - Predecessors::const_iterator predecessors_begin() const { - return predecessors_.begin(); - } - Predecessors::const_iterator predecessors_end() const { - return predecessors_.end(); - } + // Predecessors. + BasicBlockVector& predecessors() { return predecessors_; } + const BasicBlockVector& predecessors() const { return predecessors_; } size_t PredecessorCount() const { return predecessors_.size(); } BasicBlock* PredecessorAt(size_t index) { return predecessors_[index]; } void ClearPredecessors() { predecessors_.clear(); } void AddPredecessor(BasicBlock* predecessor); - typedef ZoneVector<BasicBlock*> Successors; - Successors::iterator successors_begin() { return successors_.begin(); } - Successors::iterator successors_end() { return successors_.end(); } - Successors::const_iterator successors_begin() const { - return successors_.begin(); - } - Successors::const_iterator successors_end() const { - return successors_.end(); - } + // Successors. + BasicBlockVector& successors() { return successors_; } + const BasicBlockVector& successors() const { return successors_; } size_t SuccessorCount() const { return successors_.size(); } BasicBlock* SuccessorAt(size_t index) { return successors_[index]; } void ClearSuccessors() { successors_.clear(); } void AddSuccessor(BasicBlock* successor); // Nodes in the basic block. + typedef Node* value_type; + bool empty() const { return nodes_.empty(); } + size_t size() const { return nodes_.size(); } Node* NodeAt(size_t index) { return nodes_[index]; } size_t NodeCount() const { return nodes_.size(); } + value_type& front() { return nodes_.front(); } + value_type const& front() const { return nodes_.front(); } + typedef NodeVector::iterator iterator; iterator begin() { return nodes_.begin(); } iterator end() { return nodes_.end(); } @@ -174,6 +167,10 @@ class BasicBlock FINAL : public ZoneObject { inline bool IsLoopHeader() const { return loop_end_ != NULL; } bool LoopContains(BasicBlock* block) const; + // Computes the immediate common dominator of {b1} and {b2}. The worst time + // complexity is O(N) where N is the height of the dominator tree. + static BasicBlock* GetCommonDominator(BasicBlock* b1, BasicBlock* b2); + private: int32_t loop_number_; // loop number of the block. int32_t rpo_number_; // special RPO number of the block. @@ -191,20 +188,17 @@ class BasicBlock FINAL : public ZoneObject { Node* control_input_; // Input value for control. NodeVector nodes_; // nodes of this block in forward order. - Successors successors_; - Predecessors predecessors_; + BasicBlockVector successors_; + BasicBlockVector predecessors_; Id id_; DISALLOW_COPY_AND_ASSIGN(BasicBlock); }; -std::ostream& operator<<(std::ostream& os, const BasicBlock::Control& c); -std::ostream& operator<<(std::ostream& os, const BasicBlock::Id& id); -std::ostream& operator<<(std::ostream& os, const BasicBlock::RpoNumber& rpo); +std::ostream& operator<<(std::ostream&, const BasicBlock::Control&); +std::ostream& operator<<(std::ostream&, const BasicBlock::Id&); +std::ostream& operator<<(std::ostream&, const BasicBlock::RpoNumber&); -typedef ZoneVector<BasicBlock*> BasicBlockVector; -typedef BasicBlockVector::iterator BasicBlockVectorIter; -typedef BasicBlockVector::reverse_iterator BasicBlockVectorRIter; // A schedule represents the result of assigning nodes to basic blocks // and ordering them within basic blocks. Prior to computing a schedule, @@ -243,6 +237,10 @@ class Schedule FINAL : public ZoneObject { void AddBranch(BasicBlock* block, Node* branch, BasicBlock* tblock, BasicBlock* fblock); + // BasicBlock building: add a switch at the end of {block}. + void AddSwitch(BasicBlock* block, Node* sw, BasicBlock** succ_blocks, + size_t succ_count); + // BasicBlock building: add a return at the end of {block}. void AddReturn(BasicBlock* block, Node* input); @@ -253,6 +251,10 @@ class Schedule FINAL : public ZoneObject { void InsertBranch(BasicBlock* block, BasicBlock* end, Node* branch, BasicBlock* tblock, BasicBlock* fblock); + // BasicBlock mutation: insert a switch into the end of {block}. + void InsertSwitch(BasicBlock* block, BasicBlock* end, Node* sw, + BasicBlock** succ_blocks, size_t succ_count); + // Exposed publicly for testing only. void AddSuccessorForTesting(BasicBlock* block, BasicBlock* succ) { return AddSuccessor(block, succ); @@ -286,7 +288,7 @@ class Schedule FINAL : public ZoneObject { DISALLOW_COPY_AND_ASSIGN(Schedule); }; -std::ostream& operator<<(std::ostream& os, const Schedule& s); +std::ostream& operator<<(std::ostream&, const Schedule&); } // namespace compiler } // namespace internal |