| Index: src/compiler/code-generator.cc
|
| diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
|
| index 8b6c0169cac4caadab141cfc7a5ef2ec06b49cad..643bc8c9fedb4d095c90f1c58489893b4ab07d2c 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);
|
| }
|
| }
|
| @@ -473,25 +474,15 @@ void CodeGenerator::AssembleSourcePosition(Instruction* instr) {
|
| if (!code()->GetSourcePosition(instr, &source_position)) return;
|
| 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);
|
| + if (!source_position.IsKnown()) return;
|
| + 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.InliningStack(info) << " --";
|
| + masm()->RecordComment(StrDup(buffer.str().c_str()));
|
| }
|
| }
|
|
|
| @@ -516,6 +507,26 @@ void CodeGenerator::AssembleGaps(Instruction* instr) {
|
| }
|
| }
|
|
|
| +namespace {
|
| +
|
| +Handle<PodArray<InliningPosition>> CreateInliningPositions(
|
| + CompilationInfo* info) {
|
| + const CompilationInfo::InlinedFunctionList& inlined_functions =
|
| + info->inlined_functions();
|
| + if (inlined_functions.size() == 0) {
|
| + return Handle<PodArray<InliningPosition>>::cast(
|
| + info->isolate()->factory()->empty_byte_array());
|
| + }
|
| + Handle<PodArray<InliningPosition>> inl_positions =
|
| + PodArray<InliningPosition>::New(
|
| + info->isolate(), static_cast<int>(inlined_functions.size()), TENURED);
|
| + for (int i = 0; i < inlined_functions.size(); ++i) {
|
| + inl_positions->set(i, inlined_functions[i].position);
|
| + }
|
| + return inl_positions;
|
| +}
|
| +
|
| +} // namespace
|
|
|
| void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) {
|
| CompilationInfo* info = this->info();
|
| @@ -548,6 +559,8 @@ void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) {
|
| data->SetLiteralArray(*literals);
|
| }
|
|
|
| + data->SetInliningPositions(*CreateInliningPositions(info));
|
| +
|
| if (info->is_osr()) {
|
| DCHECK(osr_pc_offset_ >= 0);
|
| data->SetOsrAstId(Smi::FromInt(info_->osr_ast_id().ToInt()));
|
|
|