Chromium Code Reviews

Unified Diff: src/compiler/bytecode-graph-builder.cc

Issue 2451853002: Uniform and precise source positions for inlining (Closed)
Patch Set: addressed comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index ab7db8079b69fd99590931e62890f12226094a6f..4472139d0645267030ec746b3d3ad0262be25858 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -8,6 +8,7 @@
#include "src/ast/scopes.h"
#include "src/compilation-info.h"
#include "src/compiler/bytecode-branch-analysis.h"
+#include "src/compiler/compiler-source-position-table.h"
#include "src/compiler/linkage.h"
#include "src/compiler/operator-properties.h"
#include "src/interpreter/bytecodes.h"
@@ -491,7 +492,8 @@ Node* BytecodeGraphBuilder::Environment::Checkpoint(
BytecodeGraphBuilder::BytecodeGraphBuilder(
Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph,
- float invocation_frequency, SourcePositionTable* source_positions)
+ float invocation_frequency, SourcePositionTable* source_positions,
+ int inlining_id)
: local_zone_(local_zone),
jsgraph_(jsgraph),
invocation_frequency_(invocation_frequency),
@@ -516,7 +518,9 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
liveness_analyzer_(
static_cast<size_t>(bytecode_array()->register_count()), true,
local_zone),
- source_positions_(source_positions) {}
+ source_positions_(source_positions),
+ start_position_(info->shared_info()->start_position(), inlining_id),
+ inlining_id_(inlining_id) {}
Node* BytecodeGraphBuilder::GetNewTarget() {
if (!new_target_.is_set()) {
@@ -570,6 +574,8 @@ VectorSlotPair BytecodeGraphBuilder::CreateVectorSlotPair(int slot_id) {
}
bool BytecodeGraphBuilder::CreateGraph(bool stack_check) {
+ SourcePositionTable::Scope pos_scope(source_positions_, start_position_);
+
// Set up the basic structure of the graph. Outputs for {Start} are the formal
// parameters (including the receiver) plus new target, number of arguments,
// context and closure.
@@ -2231,13 +2237,11 @@ Node* BytecodeGraphBuilder::MergeValue(Node* value, Node* other,
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());
+ source_positions_->SetCurrentPosition(
+ SourcePosition(it->source_position().ScriptOffset(), inlining_id_));
it->Advance();
} else {
DCHECK_GT(it->code_offset(), offset);

Powered by Google App Engine