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

Unified Diff: runtime/lib/mirrors.cc

Issue 133813008: Avoid printing the full token stream and doing line/column position calculations when extracting th… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: unmark standalone and content shell as slow Created 6 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 | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors.cc
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index e98997a2e1476e9f497b0f94fe38a5e1ecab81d7..f8cc5c8b2082a5734a4f6156cb0300c0fa644d38 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -2045,6 +2045,12 @@ DEFINE_NATIVE_ENTRY(MethodMirror_source, 1) {
}
const Script& script = Script::Handle(func.script());
const TokenStream& stream = TokenStream::Handle(script.tokens());
+ if (!script.HasSource()) {
+ // When source is not available, avoid printing the whole token stream and
+ // doing expensive position calculations.
hausner 2014/02/10 16:49:53 Maybe mention in the comment why it makes no sense
+ return stream.GenerateSource(func.token_pos(), func.end_token_pos() + 1);
+ }
+
const TokenStream::Iterator tkit(stream, func.end_token_pos());
intptr_t from_line;
intptr_t from_col;
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698