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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 ASSERT(public_class_name.Length() > 0); | 893 ASSERT(public_class_name.Length() > 0); |
894 ASSERT(public_class_name.CharAt(0) == '_'); | 894 ASSERT(public_class_name.CharAt(0) == '_'); |
895 String& str = String::Handle(); | 895 String& str = String::Handle(); |
896 str = lib.PrivateName(public_class_name); | 896 str = lib.PrivateName(public_class_name); |
897 cls.set_name(str); | 897 cls.set_name(str); |
898 lib.AddClass(cls); | 898 lib.AddClass(cls); |
899 } | 899 } |
900 | 900 |
901 | 901 |
902 RawError* Object::Init(Isolate* isolate) { | 902 RawError* Object::Init(Isolate* isolate) { |
903 TIMERSCOPE(time_bootstrap); | 903 TIMERSCOPE(isolate, time_bootstrap); |
904 ObjectStore* object_store = isolate->object_store(); | 904 ObjectStore* object_store = isolate->object_store(); |
905 | 905 |
906 Class& cls = Class::Handle(); | 906 Class& cls = Class::Handle(); |
907 Type& type = Type::Handle(); | 907 Type& type = Type::Handle(); |
908 Array& array = Array::Handle(); | 908 Array& array = Array::Handle(); |
909 Library& lib = Library::Handle(); | 909 Library& lib = Library::Handle(); |
910 | 910 |
911 // All RawArray fields will be initialized to an empty array, therefore | 911 // All RawArray fields will be initialized to an empty array, therefore |
912 // initialize array class first. | 912 // initialize array class first. |
913 cls = Class::New<Array>(); | 913 cls = Class::New<Array>(); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 Intrinsifier::InitializeState(); | 1327 Intrinsifier::InitializeState(); |
1328 | 1328 |
1329 // Set up recognized state of all functions (core, math and typed data). | 1329 // Set up recognized state of all functions (core, math and typed data). |
1330 MethodRecognizer::InitializeState(); | 1330 MethodRecognizer::InitializeState(); |
1331 | 1331 |
1332 return Error::null(); | 1332 return Error::null(); |
1333 } | 1333 } |
1334 | 1334 |
1335 | 1335 |
1336 void Object::InitFromSnapshot(Isolate* isolate) { | 1336 void Object::InitFromSnapshot(Isolate* isolate) { |
1337 TIMERSCOPE(time_bootstrap); | 1337 TIMERSCOPE(isolate, time_bootstrap); |
1338 ObjectStore* object_store = isolate->object_store(); | 1338 ObjectStore* object_store = isolate->object_store(); |
1339 | 1339 |
1340 Class& cls = Class::Handle(); | 1340 Class& cls = Class::Handle(); |
1341 | 1341 |
1342 // Set up empty classes in the object store, these will get | 1342 // Set up empty classes in the object store, these will get |
1343 // initialized correctly when we read from the snapshot. | 1343 // initialized correctly when we read from the snapshot. |
1344 // This is done to allow bootstrapping of reading classes from the snapshot. | 1344 // This is done to allow bootstrapping of reading classes from the snapshot. |
1345 cls = Class::New<Instance>(kInstanceCid); | 1345 cls = Class::New<Instance>(kInstanceCid); |
1346 object_store->set_object_class(cls); | 1346 object_store->set_object_class(cls); |
1347 | 1347 |
(...skipping 5939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7287 | 7287 |
7288 | 7288 |
7289 void Script::Tokenize(const String& private_key) const { | 7289 void Script::Tokenize(const String& private_key) const { |
7290 const TokenStream& tkns = TokenStream::Handle(tokens()); | 7290 const TokenStream& tkns = TokenStream::Handle(tokens()); |
7291 if (!tkns.IsNull()) { | 7291 if (!tkns.IsNull()) { |
7292 // Already tokenized. | 7292 // Already tokenized. |
7293 return; | 7293 return; |
7294 } | 7294 } |
7295 | 7295 |
7296 // Get the source, scan and allocate the token stream. | 7296 // Get the source, scan and allocate the token stream. |
7297 TimerScope timer(FLAG_compiler_stats, &CompilerStats::scanner_timer); | 7297 Isolate* isolate = Isolate::Current(); |
7298 const String& src = String::Handle(Source()); | 7298 TimerScope timer(FLAG_compiler_stats, &CompilerStats::scanner_timer, isolate); |
| 7299 const String& src = String::Handle(isolate, Source()); |
7299 Scanner scanner(src, private_key); | 7300 Scanner scanner(src, private_key); |
7300 set_tokens(TokenStream::Handle(TokenStream::New(scanner.GetStream(), | 7301 set_tokens(TokenStream::Handle(isolate, TokenStream::New(scanner.GetStream(), |
7301 private_key))); | 7302 private_key))); |
7302 if (FLAG_compiler_stats) { | 7303 if (FLAG_compiler_stats) { |
7303 CompilerStats::src_length += src.Length(); | 7304 CompilerStats::src_length += src.Length(); |
7304 } | 7305 } |
7305 } | 7306 } |
7306 | 7307 |
7307 | 7308 |
7308 void Script::SetLocationOffset(intptr_t line_offset, | 7309 void Script::SetLocationOffset(intptr_t line_offset, |
7309 intptr_t col_offset) const { | 7310 intptr_t col_offset) const { |
7310 ASSERT(line_offset >= 0); | 7311 ASSERT(line_offset >= 0); |
7311 ASSERT(col_offset >= 0); | 7312 ASSERT(col_offset >= 0); |
(...skipping 10128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17440 return "_MirrorReference"; | 17441 return "_MirrorReference"; |
17441 } | 17442 } |
17442 | 17443 |
17443 | 17444 |
17444 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 17445 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
17445 Instance::PrintToJSONStream(stream, ref); | 17446 Instance::PrintToJSONStream(stream, ref); |
17446 } | 17447 } |
17447 | 17448 |
17448 | 17449 |
17449 } // namespace dart | 17450 } // namespace dart |
OLD | NEW |