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 { ...@@ -37,7 +37,8 @@ class CodeGenerator::JumpTable final : public ZoneObject {
CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
InstructionSequence* code, CompilationInfo* info, InstructionSequence* code, CompilationInfo* info,
base::Optional<OsrHelper> osr_helper) base::Optional<OsrHelper> osr_helper,
int start_source_position)
: frame_access_state_(nullptr), : frame_access_state_(nullptr),
linkage_(linkage), linkage_(linkage),
code_(code), code_(code),
...@@ -45,6 +46,7 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, ...@@ -45,6 +46,7 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
info_(info), info_(info),
labels_(zone()->NewArray<Label>(code->InstructionBlockCount())), labels_(zone()->NewArray<Label>(code->InstructionBlockCount())),
current_block_(RpoNumber::Invalid()), current_block_(RpoNumber::Invalid()),
start_source_position_(start_source_position),
current_source_position_(SourcePosition::Unknown()), current_source_position_(SourcePosition::Unknown()),
masm_(info->isolate(), nullptr, 0, CodeObjectRequired::kNo), masm_(info->isolate(), nullptr, 0, CodeObjectRequired::kNo),
resolver_(this), resolver_(this),
...@@ -87,8 +89,7 @@ void CodeGenerator::AssembleCode() { ...@@ -87,8 +89,7 @@ void CodeGenerator::AssembleCode() {
FrameScope frame_scope(masm(), StackFrame::MANUAL); FrameScope frame_scope(masm(), StackFrame::MANUAL);
if (info->is_source_positions_enabled()) { if (info->is_source_positions_enabled()) {
SourcePosition source_position(info->shared_info()->start_position()); AssembleSourcePosition(start_source_position());
AssembleSourcePosition(source_position);
} }
// Place function entry hook if requested to do so. // Place function entry hook if requested to do so.
......
...@@ -81,7 +81,8 @@ class CodeGenerator final : public GapResolver::Assembler { ...@@ -81,7 +81,8 @@ class CodeGenerator final : public GapResolver::Assembler {
public: public:
explicit CodeGenerator(Frame* frame, Linkage* linkage, explicit CodeGenerator(Frame* frame, Linkage* linkage,
InstructionSequence* code, CompilationInfo* info, 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 // Generate native code. After calling AssembleCode, call FinalizeCode to
// produce the actual code object. If an error occurs during either phase, // produce the actual code object. If an error occurs during either phase,
...@@ -97,8 +98,11 @@ class CodeGenerator final : public GapResolver::Assembler { ...@@ -97,8 +98,11 @@ class CodeGenerator final : public GapResolver::Assembler {
Label* GetLabel(RpoNumber rpo) { return &labels_[rpo.ToSize()]; } 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); void AssembleSourcePosition(SourcePosition source_position);
// Record a safepoint with the given pointer map. // Record a safepoint with the given pointer map.
...@@ -309,6 +313,7 @@ class CodeGenerator final : public GapResolver::Assembler { ...@@ -309,6 +313,7 @@ class CodeGenerator final : public GapResolver::Assembler {
Label* const labels_; Label* const labels_;
Label return_label_; Label return_label_;
RpoNumber current_block_; RpoNumber current_block_;
SourcePosition start_source_position_;
SourcePosition current_source_position_; SourcePosition current_source_position_;
MacroAssembler masm_; MacroAssembler masm_;
GapResolver resolver_; GapResolver resolver_;
......
...@@ -325,10 +325,15 @@ class PipelineData { ...@@ -325,10 +325,15 @@ class PipelineData {
osr_helper_.emplace(info()); 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) { void InitializeCodeGenerator(Linkage* linkage) {
DCHECK_NULL(code_generator_); DCHECK_NULL(code_generator_);
code_generator_ = code_generator_ = new CodeGenerator(frame(), linkage, sequence(), info(),
new CodeGenerator(frame(), linkage, sequence(), info(), osr_helper_); osr_helper_, start_source_position_);
} }
void BeginPhaseKind(const char* phase_kind_name) { void BeginPhaseKind(const char* phase_kind_name) {
...@@ -355,6 +360,7 @@ class PipelineData { ...@@ -355,6 +360,7 @@ class PipelineData {
bool compilation_failed_ = false; bool compilation_failed_ = false;
bool verify_graph_ = false; bool verify_graph_ = false;
bool is_asm_ = false; bool is_asm_ = false;
int start_source_position_ = kNoSourcePosition;
base::Optional<OsrHelper> osr_helper_; base::Optional<OsrHelper> osr_helper_;
Handle<Code> code_ = Handle<Code>::null(); Handle<Code> code_ = Handle<Code>::null();
CodeGenerator* code_generator_ = nullptr; CodeGenerator* code_generator_ = nullptr;
...@@ -630,6 +636,8 @@ PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl() { ...@@ -630,6 +636,8 @@ PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl() {
info()->MarkAsInliningEnabled(); info()->MarkAsInliningEnabled();
} }
data_.set_start_source_position(info()->shared_info()->start_position());
linkage_ = new (info()->zone()) linkage_ = new (info()->zone())
Linkage(Linkage::ComputeIncoming(info()->zone(), info())); 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