| 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_RUNTIME | 8 #ifndef DART_PRECOMPILED_RUNTIME |
| 9 | 9 |
| 10 #include "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "vm/object_store.h" | 28 #include "vm/object_store.h" |
| 29 #include "vm/os.h" | 29 #include "vm/os.h" |
| 30 #include "vm/regexp_assembler.h" | 30 #include "vm/regexp_assembler.h" |
| 31 #include "vm/resolver.h" | 31 #include "vm/resolver.h" |
| 32 #include "vm/safepoint.h" | 32 #include "vm/safepoint.h" |
| 33 #include "vm/scanner.h" | 33 #include "vm/scanner.h" |
| 34 #include "vm/scopes.h" | 34 #include "vm/scopes.h" |
| 35 #include "vm/stack_frame.h" | 35 #include "vm/stack_frame.h" |
| 36 #include "vm/symbols.h" | 36 #include "vm/symbols.h" |
| 37 #include "vm/tags.h" | 37 #include "vm/tags.h" |
| 38 #include "vm/timeline.h" |
| 38 #include "vm/timer.h" | 39 #include "vm/timer.h" |
| 39 #include "vm/zone.h" | 40 #include "vm/zone.h" |
| 40 | 41 |
| 41 namespace dart { | 42 namespace dart { |
| 42 | 43 |
| 43 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\"."); | 44 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\"."); |
| 44 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); | 45 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations."); |
| 45 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); | 46 DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef."); |
| 46 DEFINE_FLAG(bool, conditional_directives, false, | 47 DEFINE_FLAG(bool, conditional_directives, false, |
| 47 "Enable conditional directives"); | 48 "Enable conditional directives"); |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 492 |
| 492 | 493 |
| 493 void Parser::ParseCompilationUnit(const Library& library, | 494 void Parser::ParseCompilationUnit(const Library& library, |
| 494 const Script& script) { | 495 const Script& script) { |
| 495 Thread* thread = Thread::Current(); | 496 Thread* thread = Thread::Current(); |
| 496 ASSERT(thread->long_jump_base()->IsSafeToJump()); | 497 ASSERT(thread->long_jump_base()->IsSafeToJump()); |
| 497 CSTAT_TIMER_SCOPE(thread, parser_timer); | 498 CSTAT_TIMER_SCOPE(thread, parser_timer); |
| 498 VMTagScope tagScope(thread, VMTag::kCompileTopLevelTagId); | 499 VMTagScope tagScope(thread, VMTag::kCompileTopLevelTagId); |
| 499 #ifndef PRODUCT | 500 #ifndef PRODUCT |
| 500 TimelineDurationScope tds(thread, | 501 TimelineDurationScope tds(thread, |
| 501 thread->isolate()->GetCompilerStream(), | 502 Timeline::GetCompilerStream(), |
| 502 "CompileTopLevel"); | 503 "CompileTopLevel"); |
| 503 if (tds.enabled()) { | 504 if (tds.enabled()) { |
| 504 tds.SetNumArguments(1); | 505 tds.SetNumArguments(1); |
| 505 tds.CopyArgument(0, "script", String::Handle(script.url()).ToCString()); | 506 tds.CopyArgument(0, "script", String::Handle(script.url()).ToCString()); |
| 506 } | 507 } |
| 507 #endif | 508 #endif |
| 508 | 509 |
| 509 Parser parser(script, library, TokenPosition::kMinSource); | 510 Parser parser(script, library, TokenPosition::kMinSource); |
| 510 parser.ParseTopLevel(); | 511 parser.ParseTopLevel(); |
| 511 } | 512 } |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 GrowableArray<const Function*> functions_; | 850 GrowableArray<const Function*> functions_; |
| 850 }; | 851 }; |
| 851 | 852 |
| 852 | 853 |
| 853 void Parser::ParseClass(const Class& cls) { | 854 void Parser::ParseClass(const Class& cls) { |
| 854 Thread* thread = Thread::Current(); | 855 Thread* thread = Thread::Current(); |
| 855 Zone* zone = thread->zone(); | 856 Zone* zone = thread->zone(); |
| 856 const int64_t num_tokes_before = STAT_VALUE(thread, num_tokens_consumed); | 857 const int64_t num_tokes_before = STAT_VALUE(thread, num_tokens_consumed); |
| 857 #ifndef PRODUCT | 858 #ifndef PRODUCT |
| 858 TimelineDurationScope tds(thread, | 859 TimelineDurationScope tds(thread, |
| 859 thread->isolate()->GetCompilerStream(), | 860 Timeline::GetCompilerStream(), |
| 860 "ParseClass"); | 861 "ParseClass"); |
| 861 if (tds.enabled()) { | 862 if (tds.enabled()) { |
| 862 tds.SetNumArguments(1); | 863 tds.SetNumArguments(1); |
| 863 tds.CopyArgument(0, "class", String::Handle(cls.Name()).ToCString()); | 864 tds.CopyArgument(0, "class", String::Handle(cls.Name()).ToCString()); |
| 864 } | 865 } |
| 865 #endif | 866 #endif |
| 866 if (!cls.is_synthesized_class()) { | 867 if (!cls.is_synthesized_class()) { |
| 867 ASSERT(thread->long_jump_base()->IsSafeToJump()); | 868 ASSERT(thread->long_jump_base()->IsSafeToJump()); |
| 868 CSTAT_TIMER_SCOPE(thread, parser_timer); | 869 CSTAT_TIMER_SCOPE(thread, parser_timer); |
| 869 const Script& script = Script::Handle(zone, cls.script()); | 870 const Script& script = Script::Handle(zone, cls.script()); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 void Parser::ParseFunction(ParsedFunction* parsed_function) { | 967 void Parser::ParseFunction(ParsedFunction* parsed_function) { |
| 967 Thread* thread = parsed_function->thread(); | 968 Thread* thread = parsed_function->thread(); |
| 968 ASSERT(thread == Thread::Current()); | 969 ASSERT(thread == Thread::Current()); |
| 969 Zone* zone = thread->zone(); | 970 Zone* zone = thread->zone(); |
| 970 CSTAT_TIMER_SCOPE(thread, parser_timer); | 971 CSTAT_TIMER_SCOPE(thread, parser_timer); |
| 971 INC_STAT(thread, num_functions_parsed, 1); | 972 INC_STAT(thread, num_functions_parsed, 1); |
| 972 VMTagScope tagScope(thread, VMTag::kCompileParseFunctionTagId, | 973 VMTagScope tagScope(thread, VMTag::kCompileParseFunctionTagId, |
| 973 FLAG_profile_vm); | 974 FLAG_profile_vm); |
| 974 #ifndef PRODUCT | 975 #ifndef PRODUCT |
| 975 TimelineDurationScope tds(thread, | 976 TimelineDurationScope tds(thread, |
| 976 thread->isolate()->GetCompilerStream(), | 977 Timeline::GetCompilerStream(), |
| 977 "ParseFunction"); | 978 "ParseFunction"); |
| 978 #endif // !PRODUCT | 979 #endif // !PRODUCT |
| 979 ASSERT(thread->long_jump_base()->IsSafeToJump()); | 980 ASSERT(thread->long_jump_base()->IsSafeToJump()); |
| 980 ASSERT(parsed_function != NULL); | 981 ASSERT(parsed_function != NULL); |
| 981 const Function& func = parsed_function->function(); | 982 const Function& func = parsed_function->function(); |
| 982 const Script& script = Script::Handle(zone, func.script()); | 983 const Script& script = Script::Handle(zone, func.script()); |
| 983 Parser parser(script, parsed_function, func.token_pos()); | 984 Parser parser(script, parsed_function, func.token_pos()); |
| 984 #ifndef PRODUCT | 985 #ifndef PRODUCT |
| 985 if (tds.enabled()) { | 986 if (tds.enabled()) { |
| 986 tds.SetNumArguments(1); | 987 tds.SetNumArguments(1); |
| (...skipping 13457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14444 const ArgumentListNode& function_args, | 14445 const ArgumentListNode& function_args, |
| 14445 const LocalVariable* temp_for_last_arg, | 14446 const LocalVariable* temp_for_last_arg, |
| 14446 bool is_super_invocation) { | 14447 bool is_super_invocation) { |
| 14447 UNREACHABLE(); | 14448 UNREACHABLE(); |
| 14448 return NULL; | 14449 return NULL; |
| 14449 } | 14450 } |
| 14450 | 14451 |
| 14451 } // namespace dart | 14452 } // namespace dart |
| 14452 | 14453 |
| 14453 #endif // DART_PRECOMPILED_RUNTIME | 14454 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |