| 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 "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "vm/intrinsifier.h" | 33 #include "vm/intrinsifier.h" |
| 34 #include "vm/longjump.h" | 34 #include "vm/longjump.h" |
| 35 #include "vm/object_id_ring.h" | 35 #include "vm/object_id_ring.h" |
| 36 #include "vm/object_store.h" | 36 #include "vm/object_store.h" |
| 37 #include "vm/parser.h" | 37 #include "vm/parser.h" |
| 38 #include "vm/reusable_handles.h" | 38 #include "vm/reusable_handles.h" |
| 39 #include "vm/runtime_entry.h" | 39 #include "vm/runtime_entry.h" |
| 40 #include "vm/scopes.h" | 40 #include "vm/scopes.h" |
| 41 #include "vm/stack_frame.h" | 41 #include "vm/stack_frame.h" |
| 42 #include "vm/symbols.h" | 42 #include "vm/symbols.h" |
| 43 #include "vm/tags.h" |
| 43 #include "vm/timer.h" | 44 #include "vm/timer.h" |
| 44 #include "vm/unicode.h" | 45 #include "vm/unicode.h" |
| 45 | 46 |
| 46 namespace dart { | 47 namespace dart { |
| 47 | 48 |
| 48 DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000, | 49 DEFINE_FLAG(int, huge_method_cutoff_in_code_size, 200000, |
| 49 "Huge method cutoff in unoptimized code size (in bytes)."); | 50 "Huge method cutoff in unoptimized code size (in bytes)."); |
| 50 DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000, | 51 DEFINE_FLAG(int, huge_method_cutoff_in_tokens, 20000, |
| 51 "Huge method cutoff in tokens: Disables optimizations for huge methods."); | 52 "Huge method cutoff in tokens: Disables optimizations for huge methods."); |
| 52 DEFINE_FLAG(bool, overlap_type_arguments, true, | 53 DEFINE_FLAG(bool, overlap_type_arguments, true, |
| (...skipping 7304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7357 raw_ptr()->kind_ = value; | 7358 raw_ptr()->kind_ = value; |
| 7358 } | 7359 } |
| 7359 | 7360 |
| 7360 | 7361 |
| 7361 void Script::set_tokens(const TokenStream& value) const { | 7362 void Script::set_tokens(const TokenStream& value) const { |
| 7362 StorePointer(&raw_ptr()->tokens_, value.raw()); | 7363 StorePointer(&raw_ptr()->tokens_, value.raw()); |
| 7363 } | 7364 } |
| 7364 | 7365 |
| 7365 | 7366 |
| 7366 void Script::Tokenize(const String& private_key) const { | 7367 void Script::Tokenize(const String& private_key) const { |
| 7367 const TokenStream& tkns = TokenStream::Handle(tokens()); | 7368 Isolate* isolate = Isolate::Current(); |
| 7369 const TokenStream& tkns = TokenStream::Handle(isolate, tokens()); |
| 7368 if (!tkns.IsNull()) { | 7370 if (!tkns.IsNull()) { |
| 7369 // Already tokenized. | 7371 // Already tokenized. |
| 7370 return; | 7372 return; |
| 7371 } | 7373 } |
| 7372 | |
| 7373 // Get the source, scan and allocate the token stream. | 7374 // Get the source, scan and allocate the token stream. |
| 7375 VMTagScope tagScope(isolate, VMTag::kCompileTagId); |
| 7374 TimerScope timer(FLAG_compiler_stats, &CompilerStats::scanner_timer); | 7376 TimerScope timer(FLAG_compiler_stats, &CompilerStats::scanner_timer); |
| 7375 const String& src = String::Handle(Source()); | 7377 const String& src = String::Handle(isolate, Source()); |
| 7376 Scanner scanner(src, private_key); | 7378 Scanner scanner(src, private_key); |
| 7377 set_tokens(TokenStream::Handle(TokenStream::New(scanner.GetStream(), | 7379 set_tokens(TokenStream::Handle(isolate, |
| 7380 TokenStream::New(scanner.GetStream(), |
| 7378 private_key))); | 7381 private_key))); |
| 7379 if (FLAG_compiler_stats) { | 7382 if (FLAG_compiler_stats) { |
| 7380 CompilerStats::src_length += src.Length(); | 7383 CompilerStats::src_length += src.Length(); |
| 7381 } | 7384 } |
| 7382 } | 7385 } |
| 7383 | 7386 |
| 7384 | 7387 |
| 7385 void Script::SetLocationOffset(intptr_t line_offset, | 7388 void Script::SetLocationOffset(intptr_t line_offset, |
| 7386 intptr_t col_offset) const { | 7389 intptr_t col_offset) const { |
| 7387 ASSERT(line_offset >= 0); | 7390 ASSERT(line_offset >= 0); |
| (...skipping 10309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17697 return "_MirrorReference"; | 17700 return "_MirrorReference"; |
| 17698 } | 17701 } |
| 17699 | 17702 |
| 17700 | 17703 |
| 17701 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 17704 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 17702 Instance::PrintToJSONStream(stream, ref); | 17705 Instance::PrintToJSONStream(stream, ref); |
| 17703 } | 17706 } |
| 17704 | 17707 |
| 17705 | 17708 |
| 17706 } // namespace dart | 17709 } // namespace dart |
| OLD | NEW |