summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/graph.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/compiler/graph.h')
-rw-r--r--deps/v8/src/compiler/graph.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/deps/v8/src/compiler/graph.h b/deps/v8/src/compiler/graph.h
index 958a15d282..a694a0b414 100644
--- a/deps/v8/src/compiler/graph.h
+++ b/deps/v8/src/compiler/graph.h
@@ -28,11 +28,30 @@ typedef uint32_t Mark;
// out-of-line data associated with each node.
typedef uint32_t NodeId;
-
-class Graph : public ZoneObject {
+class Graph final : public ZoneObject {
public:
explicit Graph(Zone* zone);
+ // Scope used when creating a subgraph for inlining. Automatically preserves
+ // the original start and end nodes of the graph, and resets them when you
+ // leave the scope.
+ class SubgraphScope final {
+ public:
+ explicit SubgraphScope(Graph* graph)
+ : graph_(graph), start_(graph->start()), end_(graph->end()) {}
+ ~SubgraphScope() {
+ graph_->SetStart(start_);
+ graph_->SetEnd(end_);
+ }
+
+ private:
+ Graph* const graph_;
+ Node* const start_;
+ Node* const end_;
+
+ DISALLOW_COPY_AND_ASSIGN(SubgraphScope);
+ };
+
// Base implementation used by all factory methods.
Node* NewNodeUnchecked(const Operator* op, int input_count,
Node* const* inputs, bool incomplete = false);