Index: src/compiler/simplified-lowering.cc |
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
index de33f9611ee25831b5669c8439f6446de46e4713..217e5a5bd055d0dc02830163ae703ee708c92119 100644 |
--- a/src/compiler/simplified-lowering.cc |
+++ b/src/compiler/simplified-lowering.cc |
@@ -17,6 +17,7 @@ |
#include "src/compiler/representation-change.h" |
#include "src/compiler/simplified-lowering.h" |
#include "src/compiler/simplified-operator.h" |
+#include "src/compiler/source-position.h" |
#include "src/objects.h" |
namespace v8 { |
@@ -65,7 +66,8 @@ class RepresentationSelector { |
}; |
RepresentationSelector(JSGraph* jsgraph, Zone* zone, |
- RepresentationChanger* changer) |
+ RepresentationChanger* changer, |
+ SourcePositionTable* source_positions) |
: jsgraph_(jsgraph), |
count_(jsgraph->graph()->NodeCount()), |
info_(zone->NewArray<NodeInfo>(count_)), |
@@ -73,7 +75,8 @@ class RepresentationSelector { |
replacements_(zone), |
phase_(PROPAGATE), |
changer_(changer), |
- queue_(zone) { |
+ queue_(zone), |
+ source_positions_(source_positions) { |
memset(info_, 0, sizeof(NodeInfo) * count_); |
safe_int_additive_range_ = |
@@ -92,6 +95,8 @@ class RepresentationSelector { |
queue_.pop(); |
info->queued = false; |
TRACE((" visit #%d: %s\n", node->id(), node->op()->mnemonic())); |
+ SourcePositionTable::Scope scope( |
titzer
2015/02/04 13:23:44
You shouldn't need the scope during the propagatio
danno
2015/02/04 13:42:17
Done.
|
+ source_positions_, source_positions_->GetSourcePosition(node)); |
VisitNode(node, info->use, NULL); |
TRACE((" ==> output ")); |
PrintInfo(info->output); |
@@ -454,10 +459,21 @@ class RepresentationSelector { |
return (use & (kTypeInt32 | kTypeNumber | kTypeAny)) != 0; |
} |
- // Dispatching routine for visiting the node {node} with the usage {use}. |
- // Depending on the operator, propagate new usage info to the inputs. |
void VisitNode(Node* node, MachineTypeUnion use, |
titzer
2015/02/04 13:23:44
I'd rather see this inlined into the second loop (
danno
2015/02/04 13:42:17
Done.
|
SimplifiedLowering* lowering) { |
+ if (FLAG_turbo_source_positions) { |
+ SourcePositionTable::Scope scope( |
+ source_positions_, source_positions_->GetSourcePosition(node)); |
+ VisitNodeDispatch(node, use, lowering); |
+ } else { |
+ VisitNodeDispatch(node, use, lowering); |
+ } |
+ } |
+ |
+ // Dispatching routine for visiting the node {node} with the usage {use}. |
+ // Depending on the operator, propagate new usage info to the inputs. |
+ void VisitNodeDispatch(Node* node, MachineTypeUnion use, |
+ SimplifiedLowering* lowering) { |
switch (node->opcode()) { |
//------------------------------------------------------------------ |
// Common operators. |
@@ -1071,6 +1087,12 @@ class RepresentationSelector { |
Phase phase_; // current phase of algorithm |
RepresentationChanger* changer_; // for inserting representation changes |
ZoneQueue<Node*> queue_; // queue for traversing the graph |
+ // TODO(danno): RepresentationSelector shouldn't know anything about the |
+ // source positions table, but must for now since there currently is no other |
+ // way to pass down source position information to nodes created during |
+ // lowering. Once this phase becomes a vanilla reducer, it should get source |
+ // position information via the SourcePositionWrapper like all other reducers. |
+ SourcePositionTable* source_positions_; |
Type* safe_int_additive_range_; |
NodeInfo* GetInfo(Node* node) { |
@@ -1094,7 +1116,8 @@ Node* SimplifiedLowering::IsTagged(Node* node) { |
void SimplifiedLowering::LowerAllNodes() { |
SimplifiedOperatorBuilder simplified(graph()->zone()); |
RepresentationChanger changer(jsgraph(), &simplified, jsgraph()->isolate()); |
- RepresentationSelector selector(jsgraph(), zone_, &changer); |
+ RepresentationSelector selector(jsgraph(), zone_, &changer, |
+ source_positions_); |
selector.Run(this); |
} |