Commit ede92883 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[compiler] Remember start source position in pipeline job preparation.

... so that it can be used during off-thread code assembly.

R=bmeurer@chromium.org

Bug: v8:6048
Change-Id: Iaa9b534b23d02da69c2b2395c1eacfdcffb3ac2f
Reviewed-on: https://chromium-review.googlesource.com/561677Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46455}
parent 28cc5dc6
......@@ -37,7 +37,8 @@ class CodeGenerator::JumpTable final : public ZoneObject {
CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
InstructionSequence* code, CompilationInfo* info,
base::Optional<OsrHelper> osr_helper)
base::Optional<OsrHelper> osr_helper,
int start_source_position)
: frame_access_state_(nullptr),
linkage_(linkage),
code_(code),
......@@ -45,6 +46,7 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
info_(info),
labels_(zone()->NewArray<Label>(code->InstructionBlockCount())),
current_block_(RpoNumber::Invalid()),
start_source_position_(start_source_position),
current_source_position_(SourcePosition::Unknown()),
masm_(info->isolate(), nullptr, 0, CodeObjectRequired::kNo),
resolver_(this),
......@@ -87,8 +89,7 @@ void CodeGenerator::AssembleCode() {
FrameScope frame_scope(masm(), StackFrame::MANUAL);
if (info->is_source_positions_enabled()) {
SourcePosition source_position(info->shared_info()->start_position());
AssembleSourcePosition(source_position);
AssembleSourcePosition(start_source_position());
}
// Place function entry hook if requested to do so.
......
......@@ -81,7 +81,8 @@ class CodeGenerator final : public GapResolver::Assembler {
public:
explicit CodeGenerator(Frame* frame, Linkage* linkage,
InstructionSequence* code, CompilationInfo* info,
base::Optional<OsrHelper> osr_helper);
base::Optional<OsrHelper> osr_helper,
int start_source_position);
// Generate native code. After calling AssembleCode, call FinalizeCode to
// produce the actual code object. If an error occurs during either phase,
......@@ -97,8 +98,11 @@ class CodeGenerator final : public GapResolver::Assembler {
Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; }
void AssembleSourcePosition(Instruction* instr);
SourcePosition start_source_position() const {
return start_source_position_;
}
void AssembleSourcePosition(Instruction* instr);
void AssembleSourcePosition(SourcePosition source_position);
// Record a safepoint with the given pointer map.
......@@ -309,6 +313,7 @@ class CodeGenerator final : public GapResolver::Assembler {
Label* const labels_;
Label return_label_;
RpoNumber current_block_;
SourcePosition start_source_position_;
SourcePosition current_source_position_;
MacroAssembler masm_;
GapResolver resolver_;
......
......@@ -325,10 +325,15 @@ class PipelineData {
osr_helper_.emplace(info());
}
void set_start_source_position(int position) {
DCHECK_EQ(start_source_position_, kNoSourcePosition);
start_source_position_ = position;
}
void InitializeCodeGenerator(Linkage* linkage) {
DCHECK_NULL(code_generator_);
code_generator_ =
new CodeGenerator(frame(), linkage, sequence(), info(), osr_helper_);
code_generator_ = new CodeGenerator(frame(), linkage, sequence(), info(),
osr_helper_, start_source_position_);
}
void BeginPhaseKind(const char* phase_kind_name) {
......@@ -355,6 +360,7 @@ class PipelineData {
bool compilation_failed_ = false;
bool verify_graph_ = false;
bool is_asm_ = false;
int start_source_position_ = kNoSourcePosition;
base::Optional<OsrHelper> osr_helper_;
Handle<Code> code_ = Handle<Code>::null();
CodeGenerator* code_generator_ = nullptr;
......@@ -630,6 +636,8 @@ PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl() {
info()->MarkAsInliningEnabled();
}
data_.set_start_source_position(info()->shared_info()->start_position());
linkage_ = new (info()->zone())
Linkage(Linkage::ComputeIncoming(info()->zone(), info()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment