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

Unified Diff: src/compiler/osr.cc

Issue 809333002: [turbofan] Implement OSR for outer loops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/osr.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/osr.cc
diff --git a/src/compiler/osr.cc b/src/compiler/osr.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3360a1a321f81f86259e56523dffea76e161b58f
--- /dev/null
+++ b/src/compiler/osr.cc
@@ -0,0 +1,69 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/compiler.h"
+#include "src/compiler/common-operator.h"
+#include "src/compiler/control-reducer.h"
+#include "src/compiler/frame.h"
+#include "src/compiler/graph.h"
+#include "src/compiler/js-graph.h"
+#include "src/compiler/node.h"
+#include "src/compiler/node-marker.h"
+#include "src/compiler/osr.h"
+#include "src/scopes.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+OsrHelper::OsrHelper(CompilationInfo* info)
+ : parameter_count_(info->scope()->num_parameters()),
+ stack_slot_count_(info->scope()->num_stack_slots()) {}
+
+
+void OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common,
+ Zone* tmp_zone) {
+ NodeDeque queue(tmp_zone);
+ Graph* graph = jsgraph->graph();
+ NodeMarker<bool> marker(graph, 2);
+ queue.push_back(graph->end());
+ marker.Set(graph->end(), true);
+
+ while (!queue.empty()) {
+ Node* node = queue.front();
+ queue.pop_front();
+
+ // Rewrite OSR-related nodes.
+ switch (node->opcode()) {
+ case IrOpcode::kOsrNormalEntry:
+ node->ReplaceUses(graph->NewNode(common->Dead()));
+ break;
+ case IrOpcode::kOsrLoopEntry:
+ node->ReplaceUses(graph->start());
+ break;
+ default:
+ break;
+ }
+ for (Node* const input : node->inputs()) {
+ if (!marker.Get(input)) {
+ marker.Set(input, true);
+ queue.push_back(input);
+ }
+ }
+ }
+
+ ControlReducer::ReduceGraph(tmp_zone, jsgraph, common);
+}
+
+
+void OsrHelper::SetupFrame(Frame* frame) {
+ // The optimized frame will subsume the unoptimized frame. Do so by reserving
+ // the first spill slots.
+ frame->ReserveSpillSlots(UnoptimizedFrameSlots());
+}
+
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
« no previous file with comments | « src/compiler/osr.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698