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/bootstrap.h" | 5 #include "vm/bootstrap.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/bootstrap_natives.h" | 9 #include "vm/bootstrap_natives.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 // Create library objects for all the bootstrap libraries. | 294 // Create library objects for all the bootstrap libraries. |
295 for (intptr_t i = 0; | 295 for (intptr_t i = 0; |
296 bootstrap_libraries[i].index_ != ObjectStore::kNone; | 296 bootstrap_libraries[i].index_ != ObjectStore::kNone; |
297 ++i) { | 297 ++i) { |
298 #ifdef PRODUCT | 298 #ifdef PRODUCT |
299 if (bootstrap_libraries[i].index_ == ObjectStore::kMirrors) { | 299 if (bootstrap_libraries[i].index_ == ObjectStore::kMirrors) { |
300 continue; | 300 continue; |
301 } | 301 } |
302 #endif // !PRODUCT | 302 #endif // !PRODUCT |
303 uri = Symbols::New(bootstrap_libraries[i].uri_); | 303 uri = Symbols::New(thread, bootstrap_libraries[i].uri_); |
304 lib = Library::LookupLibrary(uri); | 304 lib = Library::LookupLibrary(uri); |
305 if (lib.IsNull()) { | 305 if (lib.IsNull()) { |
306 lib = Library::NewLibraryHelper(uri, false); | 306 lib = Library::NewLibraryHelper(uri, false); |
307 lib.SetLoadRequested(); | 307 lib.SetLoadRequested(); |
308 lib.Register(); | 308 lib.Register(); |
309 } | 309 } |
310 isolate->object_store()->set_bootstrap_library( | 310 isolate->object_store()->set_bootstrap_library( |
311 bootstrap_libraries[i].index_, lib); | 311 bootstrap_libraries[i].index_, lib); |
312 } | 312 } |
313 | 313 |
314 // Load, compile and patch bootstrap libraries. | 314 // Load, compile and patch bootstrap libraries. |
315 for (intptr_t i = 0; | 315 for (intptr_t i = 0; |
316 bootstrap_libraries[i].index_ != ObjectStore::kNone; | 316 bootstrap_libraries[i].index_ != ObjectStore::kNone; |
317 ++i) { | 317 ++i) { |
318 #ifdef PRODUCT | 318 #ifdef PRODUCT |
319 if (bootstrap_libraries[i].index_ == ObjectStore::kMirrors) { | 319 if (bootstrap_libraries[i].index_ == ObjectStore::kMirrors) { |
320 continue; | 320 continue; |
321 } | 321 } |
322 #endif // PRODUCT | 322 #endif // PRODUCT |
323 uri = Symbols::New(bootstrap_libraries[i].uri_); | 323 uri = Symbols::New(thread, bootstrap_libraries[i].uri_); |
324 lib = Library::LookupLibrary(uri); | 324 lib = Library::LookupLibrary(uri); |
325 ASSERT(!lib.IsNull()); | 325 ASSERT(!lib.IsNull()); |
326 source = GetLibrarySource(lib, uri, false); | 326 source = GetLibrarySource(lib, uri, false); |
327 if (source.IsNull()) { | 327 if (source.IsNull()) { |
328 const String& message = String::Handle( | 328 const String& message = String::Handle( |
329 String::NewFormatted("Unable to find dart source for %s", | 329 String::NewFormatted("Unable to find dart source for %s", |
330 uri.ToCString())); | 330 uri.ToCString())); |
331 error ^= ApiError::New(message); | 331 error ^= ApiError::New(message); |
332 break; | 332 break; |
333 } | 333 } |
334 script = Script::New(uri, source, RawScript::kLibraryTag); | 334 script = Script::New(uri, source, RawScript::kLibraryTag); |
335 error = Compile(lib, script); | 335 error = Compile(lib, script); |
336 if (!error.IsNull()) { | 336 if (!error.IsNull()) { |
337 break; | 337 break; |
338 } | 338 } |
339 // If a patch exists, load and patch the script. | 339 // If a patch exists, load and patch the script. |
340 if (bootstrap_libraries[i].patch_paths_ != NULL) { | 340 if (bootstrap_libraries[i].patch_paths_ != NULL) { |
341 patch_uri = Symbols::New(bootstrap_libraries[i].patch_uri_); | 341 patch_uri = Symbols::New(thread, bootstrap_libraries[i].patch_uri_); |
342 error = LoadPatchFiles(zone, | 342 error = LoadPatchFiles(zone, |
343 lib, | 343 lib, |
344 patch_uri, | 344 patch_uri, |
345 bootstrap_libraries[i].patch_paths_); | 345 bootstrap_libraries[i].patch_paths_); |
346 if (!error.IsNull()) { | 346 if (!error.IsNull()) { |
347 break; | 347 break; |
348 } | 348 } |
349 } | 349 } |
350 } | 350 } |
351 if (error.IsNull()) { | 351 if (error.IsNull()) { |
(...skipping 11 matching lines...) Expand all Loading... |
363 Compiler::CompileClass(cls); | 363 Compiler::CompileClass(cls); |
364 } | 364 } |
365 | 365 |
366 // Restore the library tag handler for the isolate. | 366 // Restore the library tag handler for the isolate. |
367 isolate->set_library_tag_handler(saved_tag_handler); | 367 isolate->set_library_tag_handler(saved_tag_handler); |
368 | 368 |
369 return error.raw(); | 369 return error.raw(); |
370 } | 370 } |
371 | 371 |
372 } // namespace dart | 372 } // namespace dart |
OLD | NEW |