Index: src/compiler/bytecode-graph-builder.cc |
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc |
index 0195f94030500c9806e5f3752a1307641d6f9f00..26deb67ff396c9d4be489b7a30b726f7db4a5caa 100644 |
--- a/src/compiler/bytecode-graph-builder.cc |
+++ b/src/compiler/bytecode-graph-builder.cc |
@@ -587,10 +587,9 @@ bool BytecodeGraphBuilder::Environment::StateValuesAreUpToDate( |
1, output_poke_start, output_poke_end); |
} |
-BytecodeGraphBuilder::BytecodeGraphBuilder(Zone* local_zone, |
- CompilationInfo* info, |
- JSGraph* jsgraph, |
- float invocation_frequency) |
+BytecodeGraphBuilder::BytecodeGraphBuilder( |
+ Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph, |
+ float invocation_frequency, SourcePositionTable* source_positions) |
: local_zone_(local_zone), |
jsgraph_(jsgraph), |
invocation_frequency_(invocation_frequency), |
@@ -613,8 +612,8 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(Zone* local_zone, |
info->is_deoptimization_enabled()), |
state_values_cache_(jsgraph), |
liveness_analyzer_( |
- static_cast<size_t>(bytecode_array()->register_count()), local_zone) { |
-} |
+ static_cast<size_t>(bytecode_array()->register_count()), local_zone), |
+ source_positions_(source_positions) {} |
Node* BytecodeGraphBuilder::GetNewTarget() { |
if (!new_target_.is_set()) { |
@@ -714,11 +713,16 @@ void BytecodeGraphBuilder::VisitBytecodes() { |
loop_analysis.Analyze(); |
set_branch_analysis(&analysis); |
set_loop_analysis(&loop_analysis); |
+ |
interpreter::BytecodeArrayIterator iterator(bytecode_array()); |
set_bytecode_iterator(&iterator); |
+ SourcePositionTableIterator source_position_iterator( |
+ bytecode_array()->source_position_table()); |
+ |
BuildOSRNormalEntryPoint(); |
while (!iterator.done()) { |
int current_offset = iterator.current_offset(); |
+ UpdateCurrentSourcePosition(&source_position_iterator, current_offset); |
EnterAndExitExceptionHandlers(current_offset); |
SwitchToMergeEnvironment(current_offset); |
if (environment() != nullptr) { |
@@ -736,6 +740,7 @@ void BytecodeGraphBuilder::VisitBytecodes() { |
} |
iterator.Advance(); |
} |
+ |
set_branch_analysis(nullptr); |
set_bytecode_iterator(nullptr); |
DCHECK(exception_handlers_.empty()); |
@@ -2256,6 +2261,21 @@ Node* BytecodeGraphBuilder::MergeValue(Node* value, Node* other, |
return value; |
} |
+void BytecodeGraphBuilder::UpdateCurrentSourcePosition( |
+ SourcePositionTableIterator* it, int offset) { |
+ // TODO(neis): Remove this once inlining supports source positions. |
+ if (source_positions_ == nullptr) return; |
+ |
+ if (it->done()) return; |
+ |
+ if (it->code_offset() == offset) { |
+ source_positions_->set_current_position(it->source_position()); |
+ it->Advance(); |
+ } else { |
+ DCHECK_GT(it->code_offset(), offset); |
+ } |
+} |
+ |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |