| 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 3653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3664 | 3664 |
| 3665 | 3665 |
| 3666 void Script::Tokenize(const String& private_key) const { | 3666 void Script::Tokenize(const String& private_key) const { |
| 3667 const TokenStream& tkns = TokenStream::Handle(tokens()); | 3667 const TokenStream& tkns = TokenStream::Handle(tokens()); |
| 3668 if (!tkns.IsNull()) { | 3668 if (!tkns.IsNull()) { |
| 3669 // Already tokenized. | 3669 // Already tokenized. |
| 3670 return; | 3670 return; |
| 3671 } | 3671 } |
| 3672 | 3672 |
| 3673 // Get the source, scan and allocate the token stream. | 3673 // Get the source, scan and allocate the token stream. |
| 3674 if (FLAG_compiler_stats) { | 3674 TimerScope timer(FLAG_compiler_stats, &CompilerStats::scanner_timer); |
| 3675 CompilerStats::scanner_timer.Start(); | |
| 3676 } | |
| 3677 const String& src = String::Handle(source()); | 3675 const String& src = String::Handle(source()); |
| 3678 Scanner scanner(src, private_key); | 3676 Scanner scanner(src, private_key); |
| 3679 set_tokens(TokenStream::Handle(TokenStream::New(scanner.GetStream()))); | 3677 set_tokens(TokenStream::Handle(TokenStream::New(scanner.GetStream()))); |
| 3680 if (FLAG_compiler_stats) { | 3678 if (FLAG_compiler_stats) { |
| 3681 CompilerStats::scanner_timer.Stop(); | |
| 3682 CompilerStats::src_length += src.Length(); | 3679 CompilerStats::src_length += src.Length(); |
| 3683 } | 3680 } |
| 3684 } | 3681 } |
| 3685 | 3682 |
| 3686 | 3683 |
| 3687 void Script::GetTokenLocation(intptr_t token_index, | 3684 void Script::GetTokenLocation(intptr_t token_index, |
| 3688 intptr_t* line, | 3685 intptr_t* line, |
| 3689 intptr_t* column) const { | 3686 intptr_t* column) const { |
| 3690 const String& src = String::Handle(source()); | 3687 const String& src = String::Handle(source()); |
| 3691 const String& dummy_key = String::Handle(String::New("")); | 3688 const String& dummy_key = String::Handle(String::New("")); |
| (...skipping 4019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7711 const String& str = String::Handle(pattern()); | 7708 const String& str = String::Handle(pattern()); |
| 7712 const char* format = "JSRegExp: pattern=%s flags=%s"; | 7709 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 7713 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 7710 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 7714 char* chars = reinterpret_cast<char*>( | 7711 char* chars = reinterpret_cast<char*>( |
| 7715 Isolate::Current()->current_zone()->Allocate(len + 1)); | 7712 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 7716 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 7713 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 7717 return chars; | 7714 return chars; |
| 7718 } | 7715 } |
| 7719 | 7716 |
| 7720 } // namespace dart | 7717 } // namespace dart |
| OLD | NEW |