Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/src/compiler/graph.h b/src/compiler/graph.h
index 958a15d..a694a0b 100644
--- a/src/compiler/graph.h
+++ b/src/compiler/graph.h
@@ -28,11 +28,30 @@
// 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);