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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 ASSERT(public_class_name.Length() > 0); | 878 ASSERT(public_class_name.Length() > 0); |
879 ASSERT(public_class_name.CharAt(0) == '_'); | 879 ASSERT(public_class_name.CharAt(0) == '_'); |
880 String& str = String::Handle(); | 880 String& str = String::Handle(); |
881 str = lib.PrivateName(public_class_name); | 881 str = lib.PrivateName(public_class_name); |
882 cls.set_name(str); | 882 cls.set_name(str); |
883 lib.AddClass(cls); | 883 lib.AddClass(cls); |
884 } | 884 } |
885 | 885 |
886 | 886 |
887 RawError* Object::Init(Isolate* isolate) { | 887 RawError* Object::Init(Isolate* isolate) { |
888 TIMERSCOPE(time_bootstrap); | 888 TIMERSCOPE(isolate, time_bootstrap); |
889 ObjectStore* object_store = isolate->object_store(); | 889 ObjectStore* object_store = isolate->object_store(); |
890 | 890 |
891 Class& cls = Class::Handle(); | 891 Class& cls = Class::Handle(); |
892 Type& type = Type::Handle(); | 892 Type& type = Type::Handle(); |
893 Array& array = Array::Handle(); | 893 Array& array = Array::Handle(); |
894 Library& lib = Library::Handle(); | 894 Library& lib = Library::Handle(); |
895 | 895 |
896 // All RawArray fields will be initialized to an empty array, therefore | 896 // All RawArray fields will be initialized to an empty array, therefore |
897 // initialize array class first. | 897 // initialize array class first. |
898 cls = Class::New<Array>(); | 898 cls = Class::New<Array>(); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 Intrinsifier::InitializeState(); | 1312 Intrinsifier::InitializeState(); |
1313 | 1313 |
1314 // Set up recognized state of all functions (core, math and typed data). | 1314 // Set up recognized state of all functions (core, math and typed data). |
1315 MethodRecognizer::InitializeState(); | 1315 MethodRecognizer::InitializeState(); |
1316 | 1316 |
1317 return Error::null(); | 1317 return Error::null(); |
1318 } | 1318 } |
1319 | 1319 |
1320 | 1320 |
1321 void Object::InitFromSnapshot(Isolate* isolate) { | 1321 void Object::InitFromSnapshot(Isolate* isolate) { |
1322 TIMERSCOPE(time_bootstrap); | 1322 TIMERSCOPE(isolate, time_bootstrap); |
1323 ObjectStore* object_store = isolate->object_store(); | 1323 ObjectStore* object_store = isolate->object_store(); |
1324 | 1324 |
1325 Class& cls = Class::Handle(); | 1325 Class& cls = Class::Handle(); |
1326 | 1326 |
1327 // Set up empty classes in the object store, these will get | 1327 // Set up empty classes in the object store, these will get |
1328 // initialized correctly when we read from the snapshot. | 1328 // initialized correctly when we read from the snapshot. |
1329 // This is done to allow bootstrapping of reading classes from the snapshot. | 1329 // This is done to allow bootstrapping of reading classes from the snapshot. |
1330 cls = Class::New<Instance>(kInstanceCid); | 1330 cls = Class::New<Instance>(kInstanceCid); |
1331 object_store->set_object_class(cls); | 1331 object_store->set_object_class(cls); |
1332 | 1332 |
(...skipping 6045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7378 | 7378 |
7379 | 7379 |
7380 void Script::Tokenize(const String& private_key) const { | 7380 void Script::Tokenize(const String& private_key) const { |
7381 const TokenStream& tkns = TokenStream::Handle(tokens()); | 7381 const TokenStream& tkns = TokenStream::Handle(tokens()); |
7382 if (!tkns.IsNull()) { | 7382 if (!tkns.IsNull()) { |
7383 // Already tokenized. | 7383 // Already tokenized. |
7384 return; | 7384 return; |
7385 } | 7385 } |
7386 | 7386 |
7387 // Get the source, scan and allocate the token stream. | 7387 // Get the source, scan and allocate the token stream. |
7388 TimerScope timer(FLAG_compiler_stats, &CompilerStats::scanner_timer); | 7388 Isolate* isolate = Isolate::Current(); |
7389 const String& src = String::Handle(Source()); | 7389 TimerScope timer(FLAG_compiler_stats, &CompilerStats::scanner_timer, isolate); |
| 7390 const String& src = String::Handle(isolate, Source()); |
7390 Scanner scanner(src, private_key); | 7391 Scanner scanner(src, private_key); |
7391 set_tokens(TokenStream::Handle(TokenStream::New(scanner.GetStream(), | 7392 set_tokens(TokenStream::Handle(isolate, TokenStream::New(scanner.GetStream(), |
7392 private_key))); | 7393 private_key))); |
7393 if (FLAG_compiler_stats) { | 7394 if (FLAG_compiler_stats) { |
7394 CompilerStats::src_length += src.Length(); | 7395 CompilerStats::src_length += src.Length(); |
7395 } | 7396 } |
7396 } | 7397 } |
7397 | 7398 |
7398 | 7399 |
7399 void Script::SetLocationOffset(intptr_t line_offset, | 7400 void Script::SetLocationOffset(intptr_t line_offset, |
7400 intptr_t col_offset) const { | 7401 intptr_t col_offset) const { |
7401 ASSERT(line_offset >= 0); | 7402 ASSERT(line_offset >= 0); |
7402 ASSERT(col_offset >= 0); | 7403 ASSERT(col_offset >= 0); |
(...skipping 9924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17327 return "_MirrorReference"; | 17328 return "_MirrorReference"; |
17328 } | 17329 } |
17329 | 17330 |
17330 | 17331 |
17331 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 17332 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
17332 Instance::PrintToJSONStream(stream, ref); | 17333 Instance::PrintToJSONStream(stream, ref); |
17333 } | 17334 } |
17334 | 17335 |
17335 | 17336 |
17336 } // namespace dart | 17337 } // namespace dart |
OLD | NEW |