| 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 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/ast_transformer.h" | 9 #include "vm/ast_transformer.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 438 |
| 439 | 439 |
| 440 void Parser::SetPosition(intptr_t position) { | 440 void Parser::SetPosition(intptr_t position) { |
| 441 tokens_iterator_.SetCurrentPosition(position); | 441 tokens_iterator_.SetCurrentPosition(position); |
| 442 token_kind_ = Token::kILLEGAL; | 442 token_kind_ = Token::kILLEGAL; |
| 443 } | 443 } |
| 444 | 444 |
| 445 | 445 |
| 446 void Parser::ParseCompilationUnit(const Library& library, | 446 void Parser::ParseCompilationUnit(const Library& library, |
| 447 const Script& script) { | 447 const Script& script) { |
| 448 Isolate* isolate = Isolate::Current(); | 448 Thread* thread = Thread::Current(); |
| 449 ASSERT(isolate->long_jump_base()->IsSafeToJump()); | 449 ASSERT(thread->isolate()->long_jump_base()->IsSafeToJump()); |
| 450 CSTAT_TIMER_SCOPE(isolate, parser_timer); | 450 CSTAT_TIMER_SCOPE(thread->isolate(), parser_timer); |
| 451 VMTagScope tagScope(isolate, VMTag::kCompileTopLevelTagId); | 451 VMTagScope tagScope(thread, VMTag::kCompileTopLevelTagId); |
| 452 Parser parser(script, library, 0); | 452 Parser parser(script, library, 0); |
| 453 parser.ParseTopLevel(); | 453 parser.ParseTopLevel(); |
| 454 } | 454 } |
| 455 | 455 |
| 456 | 456 |
| 457 void Parser::ComputeCurrentToken() { | 457 void Parser::ComputeCurrentToken() { |
| 458 ASSERT(token_kind_ == Token::kILLEGAL); | 458 ASSERT(token_kind_ == Token::kILLEGAL); |
| 459 token_kind_ = tokens_iterator_.CurrentTokenKind(); | 459 token_kind_ = tokens_iterator_.CurrentTokenKind(); |
| 460 if (token_kind_ == Token::kERROR) { | 460 if (token_kind_ == Token::kERROR) { |
| 461 ReportError(TokenPos(), "%s", CurrentLiteral()->ToCString()); | 461 ReportError(TokenPos(), "%s", CurrentLiteral()->ToCString()); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 Thread::Current()->isolate()->object_store()->clear_sticky_error(); | 865 Thread::Current()->isolate()->object_store()->clear_sticky_error(); |
| 866 params->Clear(); | 866 params->Clear(); |
| 867 return false; | 867 return false; |
| 868 } | 868 } |
| 869 UNREACHABLE(); | 869 UNREACHABLE(); |
| 870 return false; | 870 return false; |
| 871 } | 871 } |
| 872 | 872 |
| 873 | 873 |
| 874 void Parser::ParseFunction(ParsedFunction* parsed_function) { | 874 void Parser::ParseFunction(ParsedFunction* parsed_function) { |
| 875 Isolate* isolate = parsed_function->isolate(); | 875 Thread* thread = parsed_function->thread(); |
| 876 Zone* zone = parsed_function->zone(); | 876 ASSERT(thread == Thread::Current()); |
| 877 Isolate* isolate = thread->isolate(); |
| 878 Zone* zone = thread->zone(); |
| 877 CSTAT_TIMER_SCOPE(isolate, parser_timer); | 879 CSTAT_TIMER_SCOPE(isolate, parser_timer); |
| 878 INC_STAT(isolate, num_functions_compiled, 1); | 880 INC_STAT(isolate, num_functions_compiled, 1); |
| 879 VMTagScope tagScope(isolate, VMTag::kCompileParseFunctionTagId, | 881 VMTagScope tagScope(thread, VMTag::kCompileParseFunctionTagId, |
| 880 FLAG_profile_vm); | 882 FLAG_profile_vm); |
| 881 | 883 |
| 882 ASSERT(isolate->long_jump_base()->IsSafeToJump()); | 884 ASSERT(isolate->long_jump_base()->IsSafeToJump()); |
| 883 ASSERT(parsed_function != NULL); | 885 ASSERT(parsed_function != NULL); |
| 884 const Function& func = parsed_function->function(); | 886 const Function& func = parsed_function->function(); |
| 885 const Script& script = Script::Handle(zone, func.script()); | 887 const Script& script = Script::Handle(zone, func.script()); |
| 886 Parser parser(script, parsed_function, func.token_pos()); | 888 Parser parser(script, parsed_function, func.token_pos()); |
| 887 SequenceNode* node_sequence = NULL; | 889 SequenceNode* node_sequence = NULL; |
| 888 Array& default_parameter_values = Array::ZoneHandle(zone, Array::null()); | 890 Array& default_parameter_values = Array::ZoneHandle(zone, Array::null()); |
| 889 switch (func.kind()) { | 891 switch (func.kind()) { |
| (...skipping 13172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14062 void Parser::SkipQualIdent() { | 14064 void Parser::SkipQualIdent() { |
| 14063 ASSERT(IsIdentifier()); | 14065 ASSERT(IsIdentifier()); |
| 14064 ConsumeToken(); | 14066 ConsumeToken(); |
| 14065 if (CurrentToken() == Token::kPERIOD) { | 14067 if (CurrentToken() == Token::kPERIOD) { |
| 14066 ConsumeToken(); // Consume the kPERIOD token. | 14068 ConsumeToken(); // Consume the kPERIOD token. |
| 14067 ExpectIdentifier("identifier expected after '.'"); | 14069 ExpectIdentifier("identifier expected after '.'"); |
| 14068 } | 14070 } |
| 14069 } | 14071 } |
| 14070 | 14072 |
| 14071 } // namespace dart | 14073 } // namespace dart |
| OLD | NEW |