OLD | NEW |
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 "vm/parser.h" | 5 #include "vm/parser.h" |
6 #include "vm/flags.h" | 6 #include "vm/flags.h" |
7 | 7 |
8 #ifndef DART_PRECOMPILED | 8 #ifndef DART_PRECOMPILED |
9 | 9 |
10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 Zone* zone_; | 810 Zone* zone_; |
811 GrowableArray<const Field*> fields_; | 811 GrowableArray<const Field*> fields_; |
812 GrowableArray<const Function*> functions_; | 812 GrowableArray<const Function*> functions_; |
813 }; | 813 }; |
814 | 814 |
815 | 815 |
816 void Parser::ParseClass(const Class& cls) { | 816 void Parser::ParseClass(const Class& cls) { |
817 Thread* thread = Thread::Current(); | 817 Thread* thread = Thread::Current(); |
818 Zone* zone = thread->zone(); | 818 Zone* zone = thread->zone(); |
819 const int64_t num_tokes_before = STAT_VALUE(thread, num_tokens_consumed); | 819 const int64_t num_tokes_before = STAT_VALUE(thread, num_tokens_consumed); |
| 820 TimelineDurationScope tds(thread, |
| 821 thread->isolate()->GetCompilerStream(), |
| 822 "ParseClass"); |
| 823 if (tds.enabled()) { |
| 824 tds.SetNumArguments(1); |
| 825 tds.CopyArgument( |
| 826 0, |
| 827 "class", |
| 828 const_cast<char*>(String::Handle(cls.Name()).ToCString())); |
| 829 } |
820 if (!cls.is_synthesized_class()) { | 830 if (!cls.is_synthesized_class()) { |
821 ASSERT(thread->long_jump_base()->IsSafeToJump()); | 831 ASSERT(thread->long_jump_base()->IsSafeToJump()); |
822 CSTAT_TIMER_SCOPE(thread, parser_timer); | 832 CSTAT_TIMER_SCOPE(thread, parser_timer); |
823 const Script& script = Script::Handle(zone, cls.script()); | 833 const Script& script = Script::Handle(zone, cls.script()); |
824 const Library& lib = Library::Handle(zone, cls.library()); | 834 const Library& lib = Library::Handle(zone, cls.library()); |
825 Parser parser(script, lib, cls.token_pos()); | 835 Parser parser(script, lib, cls.token_pos()); |
826 parser.ParseClassDefinition(cls); | 836 parser.ParseClassDefinition(cls); |
827 } else if (cls.is_enum_class()) { | 837 } else if (cls.is_enum_class()) { |
828 ASSERT(thread->long_jump_base()->IsSafeToJump()); | 838 ASSERT(thread->long_jump_base()->IsSafeToJump()); |
829 CSTAT_TIMER_SCOPE(thread, parser_timer); | 839 CSTAT_TIMER_SCOPE(thread, parser_timer); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 929 |
920 | 930 |
921 void Parser::ParseFunction(ParsedFunction* parsed_function) { | 931 void Parser::ParseFunction(ParsedFunction* parsed_function) { |
922 Thread* thread = parsed_function->thread(); | 932 Thread* thread = parsed_function->thread(); |
923 ASSERT(thread == Thread::Current()); | 933 ASSERT(thread == Thread::Current()); |
924 Zone* zone = thread->zone(); | 934 Zone* zone = thread->zone(); |
925 CSTAT_TIMER_SCOPE(thread, parser_timer); | 935 CSTAT_TIMER_SCOPE(thread, parser_timer); |
926 INC_STAT(thread, num_functions_parsed, 1); | 936 INC_STAT(thread, num_functions_parsed, 1); |
927 VMTagScope tagScope(thread, VMTag::kCompileParseFunctionTagId, | 937 VMTagScope tagScope(thread, VMTag::kCompileParseFunctionTagId, |
928 FLAG_profile_vm); | 938 FLAG_profile_vm); |
929 | 939 TimelineDurationScope tds(thread, |
| 940 thread->isolate()->GetCompilerStream(), |
| 941 "ParseFunction"); |
930 ASSERT(thread->long_jump_base()->IsSafeToJump()); | 942 ASSERT(thread->long_jump_base()->IsSafeToJump()); |
931 ASSERT(parsed_function != NULL); | 943 ASSERT(parsed_function != NULL); |
932 const Function& func = parsed_function->function(); | 944 const Function& func = parsed_function->function(); |
933 const Script& script = Script::Handle(zone, func.script()); | 945 const Script& script = Script::Handle(zone, func.script()); |
934 Parser parser(script, parsed_function, func.token_pos()); | 946 Parser parser(script, parsed_function, func.token_pos()); |
| 947 if (tds.enabled()) { |
| 948 tds.SetNumArguments(1); |
| 949 tds.CopyArgument( |
| 950 0, |
| 951 "function", |
| 952 const_cast<char*>(String::Handle(func.name()).ToCString())); |
| 953 } |
935 SequenceNode* node_sequence = NULL; | 954 SequenceNode* node_sequence = NULL; |
936 switch (func.kind()) { | 955 switch (func.kind()) { |
937 case RawFunction::kClosureFunction: | 956 case RawFunction::kClosureFunction: |
938 if (func.IsImplicitClosureFunction()) { | 957 if (func.IsImplicitClosureFunction()) { |
939 node_sequence = | 958 node_sequence = |
940 parser.ParseImplicitClosure(func); | 959 parser.ParseImplicitClosure(func); |
941 break; | 960 break; |
942 } | 961 } |
943 if (func.IsConstructorClosureFunction()) { | 962 if (func.IsConstructorClosureFunction()) { |
944 node_sequence = | 963 node_sequence = |
(...skipping 13518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14463 const ArgumentListNode& function_args, | 14482 const ArgumentListNode& function_args, |
14464 const LocalVariable* temp_for_last_arg, | 14483 const LocalVariable* temp_for_last_arg, |
14465 bool is_super_invocation) { | 14484 bool is_super_invocation) { |
14466 UNREACHABLE(); | 14485 UNREACHABLE(); |
14467 return NULL; | 14486 return NULL; |
14468 } | 14487 } |
14469 | 14488 |
14470 } // namespace dart | 14489 } // namespace dart |
14471 | 14490 |
14472 #endif // DART_PRECOMPILED | 14491 #endif // DART_PRECOMPILED |
OLD | NEW |