Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: src/compiler/code-generator.cc

Issue 2451853002: Uniform and precise source positions for inlining (Closed)
Patch Set: fixed PodArray::copy_out Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/compiler/code-generator.cc
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
index 8b6c0169cac4caadab141cfc7a5ef2ec06b49cad..ac0302783b19bd6c130c4cdf7aa20a48883df3b4 100644
--- a/src/compiler/code-generator.cc
+++ b/src/compiler/code-generator.cc
@@ -88,9 +88,10 @@ Handle<Code> CodeGenerator::GenerateCode() {
// Define deoptimization literals for all inlined functions.
DCHECK_EQ(0u, deoptimization_literals_.size());
- for (const CompilationInfo::InlinedFunctionHolder& inlined :
+ for (CompilationInfo::InlinedFunctionHolder& inlined :
info->inlined_functions()) {
if (!inlined.shared_info.is_identical_to(info->shared_info())) {
+ inlined.RegisterInlinedFunctionId(deoptimization_literals_.size());
DefineDeoptimizationLiteral(inlined.shared_info);
}
}
@@ -474,24 +475,14 @@ void CodeGenerator::AssembleSourcePosition(Instruction* instr) {
if (source_position == current_source_position_) return;
current_source_position_ = source_position;
if (source_position.IsUnknown()) return;
- int code_pos = source_position.raw();
- source_position_table_builder_.AddPosition(masm()->pc_offset(), code_pos,
- false);
+ source_position_table_builder_.AddPosition(masm()->pc_offset(),
+ source_position, false);
if (FLAG_code_comments) {
CompilationInfo* info = this->info();
if (!info->parse_info()) return;
- Vector<char> buffer = Vector<char>::New(256);
- int ln = Script::GetLineNumber(info->script(), code_pos);
- int cn = Script::GetColumnNumber(info->script(), code_pos);
- if (info->script()->name()->IsString()) {
- Handle<String> file(String::cast(info->script()->name()));
- base::OS::SNPrintF(buffer.start(), buffer.length(), "-- %s:%d:%d --",
- file->ToCString().get(), ln, cn);
- } else {
- base::OS::SNPrintF(buffer.start(), buffer.length(),
- "-- <unknown>:%d:%d --", ln, cn);
- }
- masm()->RecordComment(buffer.start());
+ std::ostringstream buffer;
+ buffer << "-- " << source_position.Info(info) << " --";
+ masm()->RecordComment(buffer.str().c_str());
Michael Starzinger 2016/11/03 12:41:44 Won't the underlying string be freed by the destru
}
}
@@ -548,6 +539,8 @@ void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) {
data->SetLiteralArray(*literals);
}
+ data->SetInliningPositions(*info->CreateInliningPositions());
+
if (info->is_osr()) {
DCHECK(osr_pc_offset_ >= 0);
data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id().ToInt()));

Powered by Google App Engine
This is Rietveld 408576698