Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 73b23cb2fd4c6395a5c1fb21857b6d550af09ae8..3e6af48a410940ab41f080bafa746e2f08644523 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -8119,10 +8119,14 @@ void HOptimizedGraphBuilder::VisitLogicalExpression(BinaryOperation* expr) { |
void HOptimizedGraphBuilder::VisitArithmeticExpression(BinaryOperation* expr) { |
CHECK_ALIVE(VisitForValue(expr->left())); |
CHECK_ALIVE(VisitForValue(expr->right())); |
- if (!FLAG_emit_opt_code_positions) SetSourcePosition(expr->position()); |
+ SetSourcePosition(expr->position()); |
HValue* right = Pop(); |
HValue* left = Pop(); |
HInstruction* instr = BuildBinaryOperation(expr, left, right); |
+ if (FLAG_emit_opt_code_positions && instr->IsBinaryOperation()) { |
+ HBinaryOperation::cast(instr)->SetOperandPositions( |
+ zone(), expr->left()->position(), expr->right()->position()); |
+ } |
return ast_context()->ReturnInstruction(instr, expr->id()); |
} |
@@ -8131,7 +8135,7 @@ void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, |
Expression* sub_expr, |
Handle<String> check) { |
CHECK_ALIVE(VisitForTypeOf(sub_expr)); |
- if (!FLAG_emit_opt_code_positions) SetSourcePosition(expr->position()); |
+ SetSourcePosition(expr->position()); |
HValue* value = Pop(); |
HTypeofIsAndBranch* instr = new(zone()) HTypeofIsAndBranch(value, check); |
return ast_context()->ReturnControl(instr, expr->id()); |
@@ -8194,6 +8198,8 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) { |
CHECK_ALIVE(VisitForValue(expr->left())); |
CHECK_ALIVE(VisitForValue(expr->right())); |
+ if (FLAG_emit_opt_code_positions) SetSourcePosition(expr->position()); |
+ |
HValue* context = environment()->context(); |
HValue* right = Pop(); |
HValue* left = Pop(); |
@@ -8273,6 +8279,10 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) { |
AddCheckMap(right, map); |
HCompareObjectEqAndBranch* result = |
New<HCompareObjectEqAndBranch>(left, right); |
+ if (FLAG_emit_opt_code_positions) { |
+ result->set_operand_position(zone(), 0, expr->left()->position()); |
+ result->set_operand_position(zone(), 1, expr->right()->position()); |
+ } |
return ast_context()->ReturnControl(result, expr->id()); |
} else { |
BuildCheckHeapObject(left); |
@@ -8315,6 +8325,11 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) { |
HCompareNumericAndBranch* result = |
New<HCompareNumericAndBranch>(left, right, op); |
result->set_observed_input_representation(left_rep, right_rep); |
+ if (FLAG_emit_opt_code_positions) { |
+ result->SetOperandPositions(zone(), |
+ expr->left()->position(), |
+ expr->right()->position()); |
+ } |
return ast_context()->ReturnControl(result, expr->id()); |
} |
} |
@@ -9652,7 +9667,8 @@ void HTracer::Trace(const char* name, HGraph* graph, LChunk* chunk) { |
Tag HIR_tag(this, "HIR"); |
for (HInstructionIterator it(current); !it.Done(); it.Advance()) { |
HInstruction* instruction = it.Current(); |
- int bci = 0; |
+ int bci = FLAG_emit_opt_code_positions && instruction->has_position() ? |
+ instruction->position() : 0; |
int uses = instruction->UseCount(); |
PrintIndent(); |
trace_.Add("%d %d ", bci, uses); |
@@ -9677,6 +9693,9 @@ void HTracer::Trace(const char* name, HGraph* graph, LChunk* chunk) { |
trace_.Add("%d ", |
LifetimePosition::FromInstructionIndex(i).Value()); |
linstr->PrintTo(&trace_); |
+ trace_.Add(" [hir:"); |
+ linstr->hydrogen_value()->PrintNameTo(&trace_); |
+ trace_.Add("]"); |
trace_.Add(" <|@\n"); |
} |
} |