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

Unified Diff: src/source-position.cc

Issue 2568303008: [source-positions] make the SourcePositionInfo constructor actually compute position info (Closed)
Patch Set: Created 4 years 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 | « src/source-position.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/source-position.cc
diff --git a/src/source-position.cc b/src/source-position.cc
index e9f86db01b3ed21853073aa4a6bf9546a889513d..ff204be73d327b2821646b77019badcff563d78d 100644
--- a/src/source-position.cc
+++ b/src/source-position.cc
@@ -43,29 +43,16 @@ std::ostream& operator<<(std::ostream& out, const SourcePosition& pos) {
return out;
}
-SourcePositionInfo SourcePosition::Info(
- Handle<SharedFunctionInfo> function) const {
- SourcePositionInfo result(*this, function);
- Handle<Script> script(Script::cast(function->script()));
- Script::PositionInfo pos;
- if (Script::GetPositionInfo(script, ScriptOffset(), &pos,
- Script::WITH_OFFSET)) {
- result.line = pos.line;
- result.column = pos.column;
- }
- return result;
-}
-
std::vector<SourcePositionInfo> SourcePosition::InliningStack(
CompilationInfo* cinfo) const {
SourcePosition pos = *this;
std::vector<SourcePositionInfo> stack;
while (pos.isInlined()) {
const auto& inl = cinfo->inlined_functions()[pos.InliningId()];
- stack.push_back(pos.Info(inl.shared_info));
+ stack.push_back(SourcePositionInfo(pos, inl.shared_info));
pos = inl.position.position;
}
- stack.push_back(pos.Info(cinfo->shared_info()));
+ stack.push_back(SourcePositionInfo(pos, cinfo->shared_info()));
return stack;
}
@@ -80,12 +67,12 @@ std::vector<SourcePositionInfo> SourcePosition::InliningStack(
deopt_data->InliningPositions()->get(pos.InliningId());
Handle<SharedFunctionInfo> function(
deopt_data->GetInlinedFunction(inl.inlined_function_id));
- stack.push_back(pos.Info(function));
+ stack.push_back(SourcePositionInfo(pos, function));
pos = inl.position;
}
Handle<SharedFunctionInfo> function(
SharedFunctionInfo::cast(deopt_data->SharedFunctionInfo()));
- stack.push_back(pos.Info(function));
+ stack.push_back(SourcePositionInfo(pos, function));
return stack;
}
@@ -127,5 +114,17 @@ void SourcePosition::Print(std::ostream& out, Code* code) const {
}
}
+SourcePositionInfo::SourcePositionInfo(SourcePosition pos,
+ Handle<SharedFunctionInfo> f)
+ : position(pos), function(f) {
+ Handle<Script> script(Script::cast(function->script()));
+ Script::PositionInfo info;
+ if (Script::GetPositionInfo(script, pos.ScriptOffset(), &info,
+ Script::WITH_OFFSET)) {
+ line = info.line;
+ column = info.column;
+ }
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/source-position.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698