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

Unified Diff: src/compiler/osr.cc

Issue 930003003: [turbofan] Transfer types from loop phis to OSR values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | src/compiler/typer.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
index 2eccf302f50212f49d44eebd8d27c32193a4aa25..533c293b195bb1831412520d72fcf6d17e04c17b 100644
--- a/src/compiler/osr.cc
+++ b/src/compiler/osr.cc
@@ -174,6 +174,33 @@ static void PeelOuterLoopsForOsr(Graph* graph, CommonOperatorBuilder* common,
}
+static void TransferOsrValueTypesFromLoopPhis(Zone* zone, Node* osr_loop_entry,
+ Node* osr_loop) {
+ // Find the index of the osr loop entry into the loop.
+ int index = 0;
+ for (index = 0; index < osr_loop->InputCount(); index++) {
+ if (osr_loop->InputAt(index) == osr_loop_entry) break;
+ }
+ if (index == osr_loop->InputCount()) return;
+
+ for (Node* osr_value : osr_loop_entry->uses()) {
+ if (osr_value->opcode() != IrOpcode::kOsrValue) continue;
+ bool unknown = true;
+ for (Node* phi : osr_value->uses()) {
+ if (phi->opcode() != IrOpcode::kPhi) continue;
+ if (NodeProperties::GetControlInput(phi) != osr_loop) continue;
+ if (phi->InputAt(index) != osr_value) continue;
+ if (NodeProperties::IsTyped(phi)) {
+ // Transfer the type from the phi to the OSR value itself.
+ NodeProperties::SetBounds(osr_value, NodeProperties::GetBounds(phi));
Jarin 2015/02/16 14:33:03 As discussed offline, we should combine the types
+ unknown = false;
+ }
+ }
+ if (unknown) NodeProperties::SetBounds(osr_value, Bounds::Unbounded(zone));
+ }
+}
+
+
bool OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common,
Zone* tmp_zone) {
Graph* graph = jsgraph->graph();
@@ -204,6 +231,9 @@ bool OsrHelper::Deconstruct(JSGraph* jsgraph, CommonOperatorBuilder* common,
CHECK(osr_loop); // Should have found the OSR loop.
+ // Transfer the types from loop phis to the OSR values which flow into them.
+ TransferOsrValueTypesFromLoopPhis(graph->zone(), osr_loop_entry, osr_loop);
+
// Analyze the graph to determine how deeply nested the OSR loop is.
LoopTree* loop_tree = LoopFinder::BuildLoopTree(graph, tmp_zone);
« no previous file with comments | « no previous file | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698