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

Side by Side Diff: runtime/vm/parser.cc

Issue 177733002: Revert r32930 (Add more timing information in the VM to track time...) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 | « runtime/vm/object.cc ('k') | runtime/vm/runtime_entry.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 "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/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 if (position < TokenPos() && position != 0) { 346 if (position < TokenPos() && position != 0) {
347 CompilerStats::num_tokens_rewind += (TokenPos() - position); 347 CompilerStats::num_tokens_rewind += (TokenPos() - position);
348 } 348 }
349 tokens_iterator_.SetCurrentPosition(position); 349 tokens_iterator_.SetCurrentPosition(position);
350 token_kind_ = Token::kILLEGAL; 350 token_kind_ = Token::kILLEGAL;
351 } 351 }
352 352
353 353
354 void Parser::ParseCompilationUnit(const Library& library, 354 void Parser::ParseCompilationUnit(const Library& library,
355 const Script& script) { 355 const Script& script) {
356 Isolate* isolate = Isolate::Current(); 356 ASSERT(Isolate::Current()->long_jump_base()->IsSafeToJump());
357 ASSERT(isolate->long_jump_base()->IsSafeToJump()); 357 TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer);
358 TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer, isolate);
359 Parser parser(script, library, 0); 358 Parser parser(script, library, 0);
360 parser.ParseTopLevel(); 359 parser.ParseTopLevel();
361 } 360 }
362 361
363 362
364 Token::Kind Parser::CurrentToken() { 363 Token::Kind Parser::CurrentToken() {
365 if (token_kind_ == Token::kILLEGAL) { 364 if (token_kind_ == Token::kILLEGAL) {
366 token_kind_ = tokens_iterator_.CurrentTokenKind(); 365 token_kind_ = tokens_iterator_.CurrentTokenKind();
367 if (token_kind_ == Token::kERROR) { 366 if (token_kind_ == Token::kERROR) {
368 ErrorMsg(TokenPos(), "%s", CurrentLiteral()->ToCString()); 367 ErrorMsg(TokenPos(), "%s", CurrentLiteral()->ToCString());
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 (seq->NodeAt(seq->length() - 1)->IsSequenceNode())) { 695 (seq->NodeAt(seq->length() - 1)->IsSequenceNode())) {
697 return HasReturnNode(seq->NodeAt(seq->length() - 1)->AsSequenceNode()); 696 return HasReturnNode(seq->NodeAt(seq->length() - 1)->AsSequenceNode());
698 } else { 697 } else {
699 return seq->NodeAt(seq->length() - 1)->IsReturnNode(); 698 return seq->NodeAt(seq->length() - 1)->IsReturnNode();
700 } 699 }
701 } 700 }
702 701
703 702
704 void Parser::ParseClass(const Class& cls) { 703 void Parser::ParseClass(const Class& cls) {
705 if (!cls.is_synthesized_class()) { 704 if (!cls.is_synthesized_class()) {
705 TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer);
706 Isolate* isolate = Isolate::Current(); 706 Isolate* isolate = Isolate::Current();
707 TimerScope timer(FLAG_compiler_stats,
708 &CompilerStats::parser_timer,
709 isolate);
710 ASSERT(isolate->long_jump_base()->IsSafeToJump()); 707 ASSERT(isolate->long_jump_base()->IsSafeToJump());
711 const Script& script = Script::Handle(isolate, cls.script()); 708 const Script& script = Script::Handle(isolate, cls.script());
712 const Library& lib = Library::Handle(isolate, cls.library()); 709 const Library& lib = Library::Handle(isolate, cls.library());
713 Parser parser(script, lib, cls.token_pos()); 710 Parser parser(script, lib, cls.token_pos());
714 parser.ParseClassDefinition(cls); 711 parser.ParseClassDefinition(cls);
715 } 712 }
716 } 713 }
717 714
718 715
719 RawObject* Parser::ParseFunctionParameters(const Function& func) { 716 RawObject* Parser::ParseFunctionParameters(const Function& func) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 error = isolate->object_store()->sticky_error(); 753 error = isolate->object_store()->sticky_error();
757 isolate->object_store()->clear_sticky_error(); 754 isolate->object_store()->clear_sticky_error();
758 return error.raw(); 755 return error.raw();
759 } 756 }
760 UNREACHABLE(); 757 UNREACHABLE();
761 return Object::null(); 758 return Object::null();
762 } 759 }
763 760
764 761
765 void Parser::ParseFunction(ParsedFunction* parsed_function) { 762 void Parser::ParseFunction(ParsedFunction* parsed_function) {
763 TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer);
766 Isolate* isolate = Isolate::Current(); 764 Isolate* isolate = Isolate::Current();
767 TimerScope timer(FLAG_compiler_stats, &CompilerStats::parser_timer, isolate);
768 ASSERT(isolate->long_jump_base()->IsSafeToJump()); 765 ASSERT(isolate->long_jump_base()->IsSafeToJump());
769 ASSERT(parsed_function != NULL); 766 ASSERT(parsed_function != NULL);
770 const Function& func = parsed_function->function(); 767 const Function& func = parsed_function->function();
771 const Script& script = Script::Handle(isolate, func.script()); 768 const Script& script = Script::Handle(isolate, func.script());
772 Parser parser(script, parsed_function, func.token_pos()); 769 Parser parser(script, parsed_function, func.token_pos());
773 SequenceNode* node_sequence = NULL; 770 SequenceNode* node_sequence = NULL;
774 Array& default_parameter_values = Array::ZoneHandle(isolate, Array::null()); 771 Array& default_parameter_values = Array::ZoneHandle(isolate, Array::null());
775 switch (func.kind()) { 772 switch (func.kind()) {
776 case RawFunction::kRegularFunction: 773 case RawFunction::kRegularFunction:
777 case RawFunction::kClosureFunction: 774 case RawFunction::kClosureFunction:
(...skipping 4102 matching lines...) Expand 10 before | Expand all | Expand 10 after
4880 if (url.StartsWith(Symbols::DartScheme())) { 4877 if (url.StartsWith(Symbols::DartScheme())) {
4881 if (tag == Dart_kCanonicalizeUrl) { 4878 if (tag == Dart_kCanonicalizeUrl) {
4882 return url.raw(); 4879 return url.raw();
4883 } 4880 }
4884 return Object::null(); 4881 return Object::null();
4885 } 4882 }
4886 ErrorMsg(token_pos, "no library handler registered"); 4883 ErrorMsg(token_pos, "no library handler registered");
4887 } 4884 }
4888 // Block class finalization attempts when calling into the library 4885 // Block class finalization attempts when calling into the library
4889 // tag handler. 4886 // tag handler.
4890 VmToNativeTimerScope timer(isolate());
4891 isolate()->BlockClassFinalization(); 4887 isolate()->BlockClassFinalization();
4892 DartApiScope api_scope(isolate()); 4888 DartApiScope api_scope(isolate());
4893 Dart_Handle result = handler(tag, 4889 Dart_Handle result = handler(tag,
4894 Api::NewHandle(isolate(), library_.raw()), 4890 Api::NewHandle(isolate(), library_.raw()),
4895 Api::NewHandle(isolate(), url.raw())); 4891 Api::NewHandle(isolate(), url.raw()));
4896 isolate()->UnblockClassFinalization(); 4892 isolate()->UnblockClassFinalization();
4897 if (Dart_IsError(result)) { 4893 if (Dart_IsError(result)) {
4898 // In case of an error we append an explanatory error message to the 4894 // In case of an error we append an explanatory error message to the
4899 // error obtained from the library tag handler. 4895 // error obtained from the library tag handler.
4900 Error& prev_error = Error::Handle(); 4896 Error& prev_error = Error::Handle();
(...skipping 5879 matching lines...) Expand 10 before | Expand all | Expand 10 after
10780 void Parser::SkipQualIdent() { 10776 void Parser::SkipQualIdent() {
10781 ASSERT(IsIdentifier()); 10777 ASSERT(IsIdentifier());
10782 ConsumeToken(); 10778 ConsumeToken();
10783 if (CurrentToken() == Token::kPERIOD) { 10779 if (CurrentToken() == Token::kPERIOD) {
10784 ConsumeToken(); // Consume the kPERIOD token. 10780 ConsumeToken(); // Consume the kPERIOD token.
10785 ExpectIdentifier("identifier expected after '.'"); 10781 ExpectIdentifier("identifier expected after '.'");
10786 } 10782 }
10787 } 10783 }
10788 10784
10789 } // namespace dart 10785 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/runtime_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698