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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 1739963002: Remember token position where a function was inlined (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months 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
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_inliner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index 96649898ec6c5818812d051c80b7b685bb183f7d..7263e5fb7cc48531ea18b2a791e31d09a5ef43f2 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -179,6 +179,7 @@ FlowGraphCompiler::FlowGraphCompiler(
const ParsedFunction& parsed_function,
bool is_optimizing,
const GrowableArray<const Function*>& inline_id_to_function,
+ const GrowableArray<TokenPosition>& inline_id_to_token_pos,
const GrowableArray<intptr_t>& caller_inline_id)
: thread_(Thread::Current()),
zone_(Thread::Current()->zone()),
@@ -216,6 +217,7 @@ FlowGraphCompiler::FlowGraphCompiler(
edge_counters_array_(Array::ZoneHandle()),
inlined_code_intervals_(Array::ZoneHandle(Object::empty_array().raw())),
inline_id_to_function_(inline_id_to_function),
+ inline_id_to_token_pos_(inline_id_to_token_pos),
caller_inline_id_(caller_inline_id) {
ASSERT(flow_graph->parsed_function().function().raw() ==
parsed_function.function().raw());
@@ -479,10 +481,13 @@ static void LoopInfoComment(
struct IntervalStruct {
// 'start' and 'end' are pc-offsets.
srdjan 2016/02/25 22:05:32 Adjust comment, there is no 'end; field any longer
Cutch 2016/02/25 22:36:39 Done.
intptr_t start;
+ TokenPosition pos;
intptr_t inlining_id;
- IntervalStruct(intptr_t s, intptr_t id) : start(s), inlining_id(id) {}
+ IntervalStruct(intptr_t s, TokenPosition tp, intptr_t id)
+ : start(s), pos(tp), inlining_id(id) {}
void Dump() {
- THR_Print("start: 0x%" Px " iid: %" Pd " ", start, inlining_id);
+ THR_Print("start: 0x%" Px " iid: %" Pd " pos: %s",
+ start, inlining_id, pos.ToCString());
}
};
@@ -500,6 +505,7 @@ void FlowGraphCompiler::VisitBlocks() {
GrowableArray<IntervalStruct> intervals;
intptr_t prev_offset = 0;
intptr_t prev_inlining_id = 0;
+ TokenPosition prev_inlining_pos = parsed_function_.function().token_pos();
intptr_t max_inlining_id = 0;
for (intptr_t i = 0; i < block_order().length(); ++i) {
// Compile the block entry.
@@ -527,9 +533,11 @@ void FlowGraphCompiler::VisitBlocks() {
// Compose intervals.
if (instr->has_inlining_id() && is_optimizing()) {
if (prev_inlining_id != instr->inlining_id()) {
- intervals.Add(IntervalStruct(prev_offset, prev_inlining_id));
+ intervals.Add(
+ IntervalStruct(prev_offset, prev_inlining_pos, prev_inlining_id));
prev_offset = assembler()->CodeSize();
prev_inlining_id = instr->inlining_id();
+ prev_inlining_pos = inline_id_to_token_pos_[prev_inlining_id];
if (prev_inlining_id > max_inlining_id) {
max_inlining_id = prev_inlining_id;
}
@@ -567,7 +575,8 @@ void FlowGraphCompiler::VisitBlocks() {
if (is_optimizing()) {
LogBlock lb;
- intervals.Add(IntervalStruct(prev_offset, prev_inlining_id));
+ intervals.Add(
+ IntervalStruct(prev_offset, prev_inlining_pos, prev_inlining_id));
inlined_code_intervals_ =
Array::New(intervals.length() * Code::kInlIntNumEntries, Heap::kOld);
Smi& start_h = Smi::Handle();
@@ -1752,6 +1761,21 @@ RawArray* FlowGraphCompiler::InliningIdToFunction() const {
}
+RawArray* FlowGraphCompiler::InliningIdToTokenPos() const {
+ if (inline_id_to_token_pos_.length() == 0) {
+ return Object::empty_array().raw();
+ }
+ const Array& res = Array::Handle(
srdjan 2016/02/25 22:05:32 zone()
Cutch 2016/02/25 22:36:40 Done.
+ Array::New(inline_id_to_token_pos_.length(), Heap::kOld));
+ Smi& smi = Smi::Handle();
srdjan 2016/02/25 22:05:32 zone()
Cutch 2016/02/25 22:36:40 Done.
+ for (intptr_t i = 0; i < inline_id_to_token_pos_.length(); i++) {
+ smi = Smi::New(inline_id_to_token_pos_[i].value());
+ res.SetAt(i, smi);
+ }
+ return res.raw();
+}
+
+
RawArray* FlowGraphCompiler::CallerInliningIdMap() const {
if (caller_inline_id_.length() == 0) {
return Object::empty_array().raw();
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_inliner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698