Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
FPIIM-449
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/src/compiler/schedule.h b/src/compiler/schedule.h
index 0bba689..9624ff5 100644
--- a/src/compiler/schedule.h
+++ b/src/compiler/schedule.h
@@ -6,36 +6,40 @@
#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
// first nodes in the block.
-class BasicBlock FINAL : public ZoneObject {
+class BasicBlock final : public ZoneObject {
public:
// Possible control nodes that can end a block.
enum Control {
- kNone, // Control not initialized yet.
- kGoto, // Goto a single successor block.
- kBranch, // Branch if true to first successor, otherwise second.
- kReturn, // Return a value from this method.
- kThrow // Throw an exception.
+ kNone, // Control not initialized yet.
+ kGoto, // Goto a single successor block.
+ kCall, // Call with continuation as first successor, exception
+ // second.
+ kBranch, // Branch if true to first successor, otherwise second.
+ kSwitch, // Table dispatch to one of the successor blocks.
+ kDeoptimize, // Return a value from this method.
+ kTailCall, // Tail call another method from this method.
+ kReturn, // Return a value from this method.
+ kThrow // Throw an exception.
};
class Id {
@@ -50,72 +54,36 @@
size_t index_;
};
- static const int kInvalidRpoNumber = -1;
- class RpoNumber FINAL {
- public:
- int ToInt() const {
- DCHECK(IsValid());
- return index_;
- }
- size_t ToSize() const {
- DCHECK(IsValid());
- return static_cast<size_t>(index_);
- }
- bool IsValid() const { return index_ >= 0; }
- static RpoNumber FromInt(int index) { return RpoNumber(index); }
- static RpoNumber Invalid() { return RpoNumber(kInvalidRpoNumber); }
-
- bool IsNext(const RpoNumber other) const {
- DCHECK(IsValid());
- return other.index_ == this->index_ + 1;
- }
-
- bool operator==(RpoNumber other) const {
- return this->index_ == other.index_;
- }
-
- private:
- explicit RpoNumber(int32_t index) : index_(index) {}
- int32_t index_;
- };
-
BasicBlock(Zone* zone, Id id);
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(); }
@@ -166,14 +134,17 @@
int32_t loop_number() const { return loop_number_; }
void set_loop_number(int32_t loop_number) { loop_number_ = loop_number; }
- RpoNumber GetRpoNumber() const { return RpoNumber::FromInt(rpo_number_); }
int32_t rpo_number() const { return rpo_number_; }
void set_rpo_number(int32_t rpo_number);
// Loop membership helpers.
- inline bool IsLoopHeader() const { return loop_end_ != NULL; }
+ inline bool IsLoopHeader() const { return loop_end_ != nullptr; }
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.
@@ -182,8 +153,8 @@
BasicBlock* dominator_; // Immediate dominator of the block.
BasicBlock* rpo_next_; // Link to next block in special RPO order.
BasicBlock* loop_header_; // Pointer to dominating loop header basic block,
- // NULL if none. For loop headers, this points to
- // enclosing loop header.
+ // nullptr if none. For loop headers, this points to
+ // enclosing loop header.
BasicBlock* loop_end_; // end of the loop, if this block is a loop header.
int32_t loop_depth_; // loop nesting, 0 is top-level
@@ -191,26 +162,22 @@
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&);
-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,
// a graph has no notion of control flow ordering other than that induced
// by the graph's dependencies. A schedule is required to generate code.
-class Schedule FINAL : public ZoneObject {
+class Schedule final : public ZoneObject {
public:
explicit Schedule(Zone* zone, size_t node_count_hint = 0);
@@ -239,10 +206,24 @@
// BasicBlock building: add a goto to the end of {block}.
void AddGoto(BasicBlock* block, BasicBlock* succ);
+ // BasicBlock building: add a call at the end of {block}.
+ void AddCall(BasicBlock* block, Node* call, BasicBlock* success_block,
+ BasicBlock* exception_block);
+
// BasicBlock building: add a branch at the end of {block}.
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 deoptimize at the end of {block}.
+ void AddDeoptimize(BasicBlock* block, Node* input);
+
+ // BasicBlock building: add a tailcall at the end of {block}.
+ void AddTailCall(BasicBlock* block, Node* input);
+
// BasicBlock building: add a return at the end of {block}.
void AddReturn(BasicBlock* block, Node* input);
@@ -253,6 +234,10 @@
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 +271,7 @@
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