Index: runtime/vm/flow_graph_compiler.cc |
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc |
index b23b034049f402cf3de3b64022eba7cf6257fd6d..f54e104845ffb51785e943366ce9450ff9ce0f17 100644 |
--- a/runtime/vm/flow_graph_compiler.cc |
+++ b/runtime/vm/flow_graph_compiler.cc |
@@ -240,8 +240,10 @@ FlowGraphCompiler::FlowGraphCompiler( |
ASSERT(assembler != NULL); |
ASSERT(!list_class_.IsNull()); |
- code_source_map_builder_ = new (zone_) CodeSourceMapBuilder( |
- caller_inline_id, inline_id_to_token_pos, inline_id_to_function); |
+ bool stack_traces_only = !FLAG_profiler; |
+ code_source_map_builder_ = new (zone_) |
+ CodeSourceMapBuilder(stack_traces_only, caller_inline_id, |
+ inline_id_to_token_pos, inline_id_to_function); |
} |
@@ -681,14 +683,25 @@ void FlowGraphCompiler::SetNeedsStackTrace(intptr_t try_index) { |
} |
+void FlowGraphCompiler::AddDescriptor(RawPcDescriptors::Kind kind, |
+ intptr_t pc_offset, |
+ intptr_t deopt_id, |
+ TokenPosition token_pos, |
+ intptr_t try_index) { |
+ code_source_map_builder_->NoteDescriptor(kind, pc_offset, token_pos); |
+ // When running with optimizations disabled, don't emit deopt-descriptors. |
+ if (!CanOptimize() && (kind == RawPcDescriptors::kDeopt)) return; |
+ pc_descriptors_list_->AddDescriptor(kind, pc_offset, deopt_id, token_pos, |
+ try_index); |
+} |
+ |
+ |
// Uses current pc position and try-index. |
void FlowGraphCompiler::AddCurrentDescriptor(RawPcDescriptors::Kind kind, |
intptr_t deopt_id, |
TokenPosition token_pos) { |
- // When running with optimizations disabled, don't emit deopt-descriptors. |
- if (!CanOptimize() && (kind == RawPcDescriptors::kDeopt)) return; |
- pc_descriptors_list()->AddDescriptor(kind, assembler()->CodeSize(), deopt_id, |
- token_pos, CurrentTryIndex()); |
+ AddDescriptor(kind, assembler()->CodeSize(), deopt_id, token_pos, |
+ CurrentTryIndex()); |
} |
@@ -1027,9 +1040,6 @@ void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) { |
void FlowGraphCompiler::FinalizeCodeSourceMap(const Code& code) { |
-#ifdef PRODUCT |
-// This data is only used by the profiler. |
-#else |
if (FLAG_precompiled_mode) { |
// TODO(rmacnak): Include a filtered verion of this to produce stack traces |
// with inlined frames. |
@@ -1046,7 +1056,6 @@ void FlowGraphCompiler::FinalizeCodeSourceMap(const Code& code) { |
CodeSourceMap::Handle(code_source_map_builder_->Finalize()); |
INC_STAT(Thread::Current(), total_code_size, map.Length() * sizeof(uint8_t)); |
code.set_code_source_map(map); |
-#endif |
#if defined(DEBUG) |
// Force simulation through the last pc offset. This checks we can decode |
@@ -1054,7 +1063,7 @@ void FlowGraphCompiler::FinalizeCodeSourceMap(const Code& code) { |
// etc. |
GrowableArray<const Function*> fs; |
GrowableArray<TokenPosition> tokens; |
- code.GetInlinedFunctionsAt(code.Size() - 1, &fs, &tokens); |
+ code.GetInlinedFunctionsAtInstruction(code.Size() - 1, &fs, &tokens); |
#endif |
} |