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 8482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8493 StoreNonPointer(&raw_ptr()->kind_, value); | 8493 StoreNonPointer(&raw_ptr()->kind_, value); |
8494 } | 8494 } |
8495 | 8495 |
8496 | 8496 |
8497 void Script::set_tokens(const TokenStream& value) const { | 8497 void Script::set_tokens(const TokenStream& value) const { |
8498 StorePointer(&raw_ptr()->tokens_, value.raw()); | 8498 StorePointer(&raw_ptr()->tokens_, value.raw()); |
8499 } | 8499 } |
8500 | 8500 |
8501 | 8501 |
8502 void Script::Tokenize(const String& private_key) const { | 8502 void Script::Tokenize(const String& private_key) const { |
8503 Isolate* isolate = Isolate::Current(); | 8503 Thread* thread = Thread::Current(); |
8504 const TokenStream& tkns = TokenStream::Handle(isolate, tokens()); | 8504 Zone* zone = thread->zone(); |
| 8505 Isolate* isolate = thread->isolate(); |
| 8506 const TokenStream& tkns = TokenStream::Handle(zone, tokens()); |
8505 if (!tkns.IsNull()) { | 8507 if (!tkns.IsNull()) { |
8506 // Already tokenized. | 8508 // Already tokenized. |
8507 return; | 8509 return; |
8508 } | 8510 } |
8509 // Get the source, scan and allocate the token stream. | 8511 // Get the source, scan and allocate the token stream. |
8510 VMTagScope tagScope(isolate, VMTag::kCompileScannerTagId); | 8512 VMTagScope tagScope(thread, VMTag::kCompileScannerTagId); |
8511 CSTAT_TIMER_SCOPE(isolate, scanner_timer); | 8513 CSTAT_TIMER_SCOPE(isolate, scanner_timer); |
8512 const String& src = String::Handle(isolate, Source()); | 8514 const String& src = String::Handle(zone, Source()); |
8513 Scanner scanner(src, private_key); | 8515 Scanner scanner(src, private_key); |
8514 set_tokens(TokenStream::Handle(isolate, | 8516 set_tokens(TokenStream::Handle(zone, |
8515 TokenStream::New(scanner.GetStream(), | 8517 TokenStream::New(scanner.GetStream(), |
8516 private_key))); | 8518 private_key))); |
8517 INC_STAT(isolate, src_length, src.Length()); | 8519 INC_STAT(isolate, src_length, src.Length()); |
8518 } | 8520 } |
8519 | 8521 |
8520 | 8522 |
8521 void Script::SetLocationOffset(intptr_t line_offset, | 8523 void Script::SetLocationOffset(intptr_t line_offset, |
8522 intptr_t col_offset) const { | 8524 intptr_t col_offset) const { |
8523 ASSERT(line_offset >= 0); | 8525 ASSERT(line_offset >= 0); |
8524 ASSERT(col_offset >= 0); | 8526 ASSERT(col_offset >= 0); |
(...skipping 12818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21343 return tag_label.ToCString(); | 21345 return tag_label.ToCString(); |
21344 } | 21346 } |
21345 | 21347 |
21346 | 21348 |
21347 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21349 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21348 Instance::PrintJSONImpl(stream, ref); | 21350 Instance::PrintJSONImpl(stream, ref); |
21349 } | 21351 } |
21350 | 21352 |
21351 | 21353 |
21352 } // namespace dart | 21354 } // namespace dart |
OLD | NEW |