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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "lib/invocation_mirror.h" 5 #include "lib/invocation_mirror.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 const Function& func = Function::Handle(ref.GetFunctionReferent()); 2038 const Function& func = Function::Handle(ref.GetFunctionReferent());
2039 if (func.IsImplicitConstructor() || func.IsSignatureFunction()) { 2039 if (func.IsImplicitConstructor() || func.IsSignatureFunction()) {
2040 // We may need to handle more cases when the restrictions on mixins are 2040 // We may need to handle more cases when the restrictions on mixins are
2041 // relaxed. In particular we might start associating some source with the 2041 // relaxed. In particular we might start associating some source with the
2042 // forwarding constructors when it becomes possible to specify a particular 2042 // forwarding constructors when it becomes possible to specify a particular
2043 // constructor from the mixin to use. 2043 // constructor from the mixin to use.
2044 return Instance::null(); 2044 return Instance::null();
2045 } 2045 }
2046 const Script& script = Script::Handle(func.script()); 2046 const Script& script = Script::Handle(func.script());
2047 const TokenStream& stream = TokenStream::Handle(script.tokens()); 2047 const TokenStream& stream = TokenStream::Handle(script.tokens());
2048 if (!script.HasSource()) {
2049 // When source is not available, avoid printing the whole token stream and
2050 // doing expensive position calculations.
hausner 2014/02/10 16:49:53 Maybe mention in the comment why it makes no sense
2051 return stream.GenerateSource(func.token_pos(), func.end_token_pos() + 1);
2052 }
2053
2048 const TokenStream::Iterator tkit(stream, func.end_token_pos()); 2054 const TokenStream::Iterator tkit(stream, func.end_token_pos());
2049 intptr_t from_line; 2055 intptr_t from_line;
2050 intptr_t from_col; 2056 intptr_t from_col;
2051 intptr_t to_line; 2057 intptr_t to_line;
2052 intptr_t to_col; 2058 intptr_t to_col;
2053 script.GetTokenLocation(func.token_pos(), &from_line, &from_col); 2059 script.GetTokenLocation(func.token_pos(), &from_line, &from_col);
2054 script.GetTokenLocation(func.end_token_pos(), &to_line, &to_col); 2060 script.GetTokenLocation(func.end_token_pos(), &to_line, &to_col);
2055 intptr_t last_tok_len = String::Handle(tkit.CurrentLiteral()).Length(); 2061 intptr_t last_tok_len = String::Handle(tkit.CurrentLiteral()).Length();
2056 // Handle special cases for end tokens of closures (where we exclude the last 2062 // Handle special cases for end tokens of closures (where we exclude the last
2057 // token): 2063 // token):
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 2104
2099 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) { 2105 DEFINE_NATIVE_ENTRY(VariableMirror_type, 2) {
2100 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0)); 2106 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
2101 const Field& field = Field::Handle(ref.GetFieldReferent()); 2107 const Field& field = Field::Handle(ref.GetFieldReferent());
2102 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1)); 2108 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
2103 const AbstractType& type = AbstractType::Handle(field.type()); 2109 const AbstractType& type = AbstractType::Handle(field.type());
2104 return InstantiateType(type, instantiator); 2110 return InstantiateType(type, instantiator);
2105 } 2111 }
2106 2112
2107 } // namespace dart 2113 } // namespace dart
OLDNEW
« 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