Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Unified Diff: src/compiler/graph.h

Issue 2006353003: [turbofan] Avoid unnecessary copying of nodes during inlining. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Don't use one EmptyFrameState cross functions, that gets mutated during inlining. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/js-graph.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/graph.h
diff --git a/src/compiler/graph.h b/src/compiler/graph.h
index 958a15d282c01b03ad7402b97e89e937541800a0..a694a0b414a578b24b9e0f4f2cc6edb29c8472c6 100644
--- a/src/compiler/graph.h
+++ b/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);
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/js-graph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698