Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: runtime/bin/gen_snapshot.cc

Issue 2922913004: Add Dart_Save/LoadCompilationTrace. (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/BUILD.gn ('k') | runtime/bin/main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Generate a snapshot file after loading all the scripts specified on the 5 // Generate a snapshot file after loading all the scripts specified on the
6 // command line. 6 // command line.
7 7
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 static const char* vm_snapshot_instructions_filename = NULL; 78 static const char* vm_snapshot_instructions_filename = NULL;
79 static const char* isolate_snapshot_data_filename = NULL; 79 static const char* isolate_snapshot_data_filename = NULL;
80 static const char* isolate_snapshot_instructions_filename = NULL; 80 static const char* isolate_snapshot_instructions_filename = NULL;
81 static const char* assembly_filename = NULL; 81 static const char* assembly_filename = NULL;
82 static const char* script_snapshot_filename = NULL; 82 static const char* script_snapshot_filename = NULL;
83 static bool dependencies_only = false; 83 static bool dependencies_only = false;
84 static bool print_dependencies = false; 84 static bool print_dependencies = false;
85 static const char* dependencies_filename = NULL; 85 static const char* dependencies_filename = NULL;
86 86
87 87
88 // Value of the --load-compilation-trace flag.
89 // (This pointer points into an argv buffer and does not need to be
90 // free'd.)
91 static const char* load_compilation_trace_filename = NULL;
92
88 // Value of the --package-root flag. 93 // Value of the --package-root flag.
89 // (This pointer points into an argv buffer and does not need to be 94 // (This pointer points into an argv buffer and does not need to be
90 // free'd.) 95 // free'd.)
91 static const char* commandline_package_root = NULL; 96 static const char* commandline_package_root = NULL;
92 97
93 // Value of the --packages flag. 98 // Value of the --packages flag.
94 // (This pointer points into an argv buffer and does not need to be 99 // (This pointer points into an argv buffer and does not need to be
95 // free'd.) 100 // free'd.)
96 static const char* commandline_packages_file = NULL; 101 static const char* commandline_packages_file = NULL;
97 102
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 static bool ProcessEmbedderEntryPointsManifestOption(const char* option) { 356 static bool ProcessEmbedderEntryPointsManifestOption(const char* option) {
352 const char* name = ProcessOption(option, "--embedder_entry_points_manifest="); 357 const char* name = ProcessOption(option, "--embedder_entry_points_manifest=");
353 if (name != NULL) { 358 if (name != NULL) {
354 entry_points_files->AddArgument(name); 359 entry_points_files->AddArgument(name);
355 return true; 360 return true;
356 } 361 }
357 return false; 362 return false;
358 } 363 }
359 364
360 365
366 static bool ProcessLoadCompilationTraceOption(const char* option) {
367 const char* name = ProcessOption(option, "--load_compilation_trace=");
368 if (name != NULL) {
369 load_compilation_trace_filename = name;
370 return true;
371 }
372 return false;
373 }
374
375
361 static bool ProcessPackageRootOption(const char* option) { 376 static bool ProcessPackageRootOption(const char* option) {
362 const char* name = ProcessOption(option, "--package_root="); 377 const char* name = ProcessOption(option, "--package_root=");
363 if (name == NULL) { 378 if (name == NULL) {
364 name = ProcessOption(option, "--package-root="); 379 name = ProcessOption(option, "--package-root=");
365 } 380 }
366 if (name != NULL) { 381 if (name != NULL) {
367 commandline_package_root = name; 382 commandline_package_root = name;
368 return true; 383 return true;
369 } 384 }
370 return false; 385 return false;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 ProcessVmSnapshotDataOption(argv[i]) || 432 ProcessVmSnapshotDataOption(argv[i]) ||
418 ProcessVmSnapshotInstructionsOption(argv[i]) || 433 ProcessVmSnapshotInstructionsOption(argv[i]) ||
419 ProcessIsolateSnapshotDataOption(argv[i]) || 434 ProcessIsolateSnapshotDataOption(argv[i]) ||
420 ProcessIsolateSnapshotInstructionsOption(argv[i]) || 435 ProcessIsolateSnapshotInstructionsOption(argv[i]) ||
421 ProcessAssemblyOption(argv[i]) || 436 ProcessAssemblyOption(argv[i]) ||
422 ProcessScriptSnapshotOption(argv[i]) || 437 ProcessScriptSnapshotOption(argv[i]) ||
423 ProcessDependenciesOption(argv[i]) || 438 ProcessDependenciesOption(argv[i]) ||
424 ProcessDependenciesOnlyOption(argv[i]) || 439 ProcessDependenciesOnlyOption(argv[i]) ||
425 ProcessPrintDependenciesOption(argv[i]) || 440 ProcessPrintDependenciesOption(argv[i]) ||
426 ProcessEmbedderEntryPointsManifestOption(argv[i]) || 441 ProcessEmbedderEntryPointsManifestOption(argv[i]) ||
427 ProcessURLmappingOption(argv[i]) || ProcessPackageRootOption(argv[i]) || 442 ProcessURLmappingOption(argv[i]) ||
428 ProcessPackagesOption(argv[i]) || ProcessEnvironmentOption(argv[i])) { 443 ProcessLoadCompilationTraceOption(argv[i]) ||
444 ProcessPackageRootOption(argv[i]) || ProcessPackagesOption(argv[i]) ||
445 ProcessEnvironmentOption(argv[i])) {
429 i += 1; 446 i += 1;
430 continue; 447 continue;
431 } 448 }
432 vm_options->AddArgument(argv[i]); 449 vm_options->AddArgument(argv[i]);
433 i += 1; 450 i += 1;
434 } 451 }
435 452
436 // Get the script name. 453 // Get the script name.
437 if (i < argc) { 454 if (i < argc) {
438 *script_name = argv[i]; 455 *script_name = argv[i];
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 Log::PrintErr( 533 Log::PrintErr(
517 "Building an AOT snapshot requires at least one embedder " 534 "Building an AOT snapshot requires at least one embedder "
518 "entry points manifest.\n\n"); 535 "entry points manifest.\n\n");
519 return -1; 536 return -1;
520 } 537 }
521 538
522 return 0; 539 return 0;
523 } 540 }
524 541
525 542
526 static void WriteSnapshotFile(const char* filename, 543 static void WriteFile(const char* filename,
527 const uint8_t* buffer, 544 const uint8_t* buffer,
528 const intptr_t size, 545 const intptr_t size) {
529 bool write_magic_number = false) {
530 File* file = File::Open(filename, File::kWriteTruncate); 546 File* file = File::Open(filename, File::kWriteTruncate);
531 if (file == NULL) { 547 if (file == NULL) {
532 Log::PrintErr("Error: Unable to write snapshot file: %s\n\n", filename); 548 Log::PrintErr("Error: Unable to write snapshot file: %s\n\n", filename);
533 Dart_ExitScope(); 549 Dart_ExitScope();
534 Dart_ShutdownIsolate(); 550 Dart_ShutdownIsolate();
535 exit(kErrorExitCode); 551 exit(kErrorExitCode);
536 } 552 }
537 if (write_magic_number) {
538 // Write the magic number to indicate file is a script snapshot.
539 DartUtils::WriteMagicNumber(file);
540 }
541 if (!file->WriteFully(buffer, size)) { 553 if (!file->WriteFully(buffer, size)) {
542 Log::PrintErr("Error: Unable to write snapshot file: %s\n\n", filename); 554 Log::PrintErr("Error: Unable to write snapshot file: %s\n\n", filename);
543 Dart_ExitScope(); 555 Dart_ExitScope();
544 Dart_ShutdownIsolate(); 556 Dart_ShutdownIsolate();
545 exit(kErrorExitCode); 557 exit(kErrorExitCode);
546 } 558 }
547 file->Release(); 559 file->Release();
548 } 560 }
549 561
550 562
563 static void ReadFile(const char* filename, uint8_t** buffer, intptr_t* size) {
564 File* file = File::Open(filename, File::kRead);
565 if (file == NULL) {
566 Log::PrintErr("Unable to open file %s\n", filename);
567 Dart_ExitScope();
568 Dart_ShutdownIsolate();
569 exit(kErrorExitCode);
570 }
571 *size = file->Length();
572 *buffer = reinterpret_cast<uint8_t*>(malloc(*size));
573 if (!file->ReadFully(*buffer, *size)) {
574 Log::PrintErr("Unable to read file %s\n", filename);
575 Dart_ExitScope();
576 Dart_ShutdownIsolate();
577 exit(kErrorExitCode);
578 }
579 file->Release();
580 }
581
582
551 class UriResolverIsolateScope { 583 class UriResolverIsolateScope {
552 public: 584 public:
553 UriResolverIsolateScope() { 585 UriResolverIsolateScope() {
554 ASSERT(isolate != NULL); 586 ASSERT(isolate != NULL);
555 snapshotted_isolate_ = Dart_CurrentIsolate(); 587 snapshotted_isolate_ = Dart_CurrentIsolate();
556 Dart_ExitIsolate(); 588 Dart_ExitIsolate();
557 Dart_EnterIsolate(isolate); 589 Dart_EnterIsolate(isolate);
558 Dart_EnterScope(); 590 Dart_EnterScope();
559 } 591 }
560 592
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 Dart_QualifiedFunctionName* entries = ParseEntryPointsManifestFiles(); 1298 Dart_QualifiedFunctionName* entries = ParseEntryPointsManifestFiles();
1267 if ((entries == NULL) && IsSnapshottingForPrecompilation()) { 1299 if ((entries == NULL) && IsSnapshottingForPrecompilation()) {
1268 Log::PrintErr( 1300 Log::PrintErr(
1269 "Could not find native embedder entry points during precompilation\n"); 1301 "Could not find native embedder entry points during precompilation\n");
1270 exit(kErrorExitCode); 1302 exit(kErrorExitCode);
1271 } 1303 }
1272 return entries; 1304 return entries;
1273 } 1305 }
1274 1306
1275 1307
1308 static void LoadCompilationTrace() {
1309 if ((load_compilation_trace_filename != NULL) &&
1310 (snapshot_kind == kCoreJIT)) {
1311 uint8_t* buffer = NULL;
1312 intptr_t size = 0;
1313 ReadFile(load_compilation_trace_filename, &buffer, &size);
1314 Dart_Handle result = Dart_LoadCompilationTrace(buffer, size);
1315 CHECK_RESULT(result);
1316 }
1317 }
1318
1319
1276 static void CreateAndWriteCoreSnapshot() { 1320 static void CreateAndWriteCoreSnapshot() {
1277 ASSERT(snapshot_kind == kCore); 1321 ASSERT(snapshot_kind == kCore);
1278 ASSERT(vm_snapshot_data_filename != NULL); 1322 ASSERT(vm_snapshot_data_filename != NULL);
1279 ASSERT(isolate_snapshot_data_filename != NULL); 1323 ASSERT(isolate_snapshot_data_filename != NULL);
1280 1324
1281 Dart_Handle result; 1325 Dart_Handle result;
1282 uint8_t* vm_snapshot_data_buffer = NULL; 1326 uint8_t* vm_snapshot_data_buffer = NULL;
1283 intptr_t vm_snapshot_data_size = 0; 1327 intptr_t vm_snapshot_data_size = 0;
1284 uint8_t* isolate_snapshot_data_buffer = NULL; 1328 uint8_t* isolate_snapshot_data_buffer = NULL;
1285 intptr_t isolate_snapshot_data_size = 0; 1329 intptr_t isolate_snapshot_data_size = 0;
1286 1330
1287 // First create a snapshot. 1331 // First create a snapshot.
1288 result = Dart_CreateSnapshot(&vm_snapshot_data_buffer, &vm_snapshot_data_size, 1332 result = Dart_CreateSnapshot(&vm_snapshot_data_buffer, &vm_snapshot_data_size,
1289 &isolate_snapshot_data_buffer, 1333 &isolate_snapshot_data_buffer,
1290 &isolate_snapshot_data_size); 1334 &isolate_snapshot_data_size);
1291 CHECK_RESULT(result); 1335 CHECK_RESULT(result);
1292 1336
1293 // Now write the vm isolate and isolate snapshots out to the 1337 // Now write the vm isolate and isolate snapshots out to the
1294 // specified file and exit. 1338 // specified file and exit.
1295 WriteSnapshotFile(vm_snapshot_data_filename, vm_snapshot_data_buffer, 1339 WriteFile(vm_snapshot_data_filename, vm_snapshot_data_buffer,
1296 vm_snapshot_data_size); 1340 vm_snapshot_data_size);
1297 if (vm_snapshot_instructions_filename != NULL) { 1341 if (vm_snapshot_instructions_filename != NULL) {
1298 WriteSnapshotFile(vm_snapshot_instructions_filename, NULL, 0); 1342 WriteFile(vm_snapshot_instructions_filename, NULL, 0);
1299 } 1343 }
1300 WriteSnapshotFile(isolate_snapshot_data_filename, 1344 WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer,
1301 isolate_snapshot_data_buffer, isolate_snapshot_data_size); 1345 isolate_snapshot_data_size);
1302 if (isolate_snapshot_instructions_filename != NULL) { 1346 if (isolate_snapshot_instructions_filename != NULL) {
1303 WriteSnapshotFile(isolate_snapshot_instructions_filename, NULL, 0); 1347 WriteFile(isolate_snapshot_instructions_filename, NULL, 0);
1304 } 1348 }
1305 } 1349 }
1306 1350
1307 1351
1308 static void CreateAndWriteCoreJITSnapshot() { 1352 static void CreateAndWriteCoreJITSnapshot() {
1309 ASSERT(snapshot_kind == kCoreJIT); 1353 ASSERT(snapshot_kind == kCoreJIT);
1310 ASSERT(vm_snapshot_data_filename != NULL); 1354 ASSERT(vm_snapshot_data_filename != NULL);
1311 ASSERT(vm_snapshot_instructions_filename != NULL); 1355 ASSERT(vm_snapshot_instructions_filename != NULL);
1312 ASSERT(isolate_snapshot_data_filename != NULL); 1356 ASSERT(isolate_snapshot_data_filename != NULL);
1313 ASSERT(isolate_snapshot_instructions_filename != NULL); 1357 ASSERT(isolate_snapshot_instructions_filename != NULL);
(...skipping 12 matching lines...) Expand all
1326 result = Dart_CreateCoreJITSnapshotAsBlobs( 1370 result = Dart_CreateCoreJITSnapshotAsBlobs(
1327 &vm_snapshot_data_buffer, &vm_snapshot_data_size, 1371 &vm_snapshot_data_buffer, &vm_snapshot_data_size,
1328 &vm_snapshot_instructions_buffer, &vm_snapshot_instructions_size, 1372 &vm_snapshot_instructions_buffer, &vm_snapshot_instructions_size,
1329 &isolate_snapshot_data_buffer, &isolate_snapshot_data_size, 1373 &isolate_snapshot_data_buffer, &isolate_snapshot_data_size,
1330 &isolate_snapshot_instructions_buffer, 1374 &isolate_snapshot_instructions_buffer,
1331 &isolate_snapshot_instructions_size); 1375 &isolate_snapshot_instructions_size);
1332 CHECK_RESULT(result); 1376 CHECK_RESULT(result);
1333 1377
1334 // Now write the vm isolate and isolate snapshots out to the 1378 // Now write the vm isolate and isolate snapshots out to the
1335 // specified file and exit. 1379 // specified file and exit.
1336 WriteSnapshotFile(vm_snapshot_data_filename, vm_snapshot_data_buffer, 1380 WriteFile(vm_snapshot_data_filename, vm_snapshot_data_buffer,
1337 vm_snapshot_data_size); 1381 vm_snapshot_data_size);
1338 WriteSnapshotFile(vm_snapshot_instructions_filename, 1382 WriteFile(vm_snapshot_instructions_filename, vm_snapshot_instructions_buffer,
1339 vm_snapshot_instructions_buffer, 1383 vm_snapshot_instructions_size);
1340 vm_snapshot_instructions_size); 1384 WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer,
1341 WriteSnapshotFile(isolate_snapshot_data_filename, 1385 isolate_snapshot_data_size);
1342 isolate_snapshot_data_buffer, isolate_snapshot_data_size); 1386 WriteFile(isolate_snapshot_instructions_filename,
1343 WriteSnapshotFile(isolate_snapshot_instructions_filename, 1387 isolate_snapshot_instructions_buffer,
1344 isolate_snapshot_instructions_buffer, 1388 isolate_snapshot_instructions_size);
1345 isolate_snapshot_instructions_size);
1346 } 1389 }
1347 1390
1348 1391
1349 static void CreateAndWriteScriptSnapshot() { 1392 static void CreateAndWriteScriptSnapshot() {
1350 ASSERT(snapshot_kind == kScript); 1393 ASSERT(snapshot_kind == kScript);
1351 ASSERT(script_snapshot_filename != NULL); 1394 ASSERT(script_snapshot_filename != NULL);
1352 1395
1353 // First create a snapshot. 1396 // First create a snapshot.
1354 uint8_t* buffer = NULL; 1397 uint8_t* buffer = NULL;
1355 intptr_t size = 0; 1398 intptr_t size = 0;
1356 Dart_Handle result = Dart_CreateScriptSnapshot(&buffer, &size); 1399 Dart_Handle result = Dart_CreateScriptSnapshot(&buffer, &size);
1357 CHECK_RESULT(result); 1400 CHECK_RESULT(result);
1358 1401
1359 // Now write it out to the specified file. 1402 // Now write it out to the specified file.
1360 WriteSnapshotFile(script_snapshot_filename, buffer, size, false); 1403 WriteFile(script_snapshot_filename, buffer, size);
1361 } 1404 }
1362 1405
1363 1406
1364 static void CreateAndWritePrecompiledSnapshot( 1407 static void CreateAndWritePrecompiledSnapshot(
1365 Dart_QualifiedFunctionName* standalone_entry_points) { 1408 Dart_QualifiedFunctionName* standalone_entry_points) {
1366 ASSERT(IsSnapshottingForPrecompilation()); 1409 ASSERT(IsSnapshottingForPrecompilation());
1367 Dart_Handle result; 1410 Dart_Handle result;
1368 1411
1369 // Precompile with specified embedder entry points 1412 // Precompile with specified embedder entry points
1370 result = Dart_Precompile(standalone_entry_points, NULL, 0); 1413 result = Dart_Precompile(standalone_entry_points, NULL, 0);
1371 CHECK_RESULT(result); 1414 CHECK_RESULT(result);
1372 1415
1373 // Create a precompiled snapshot. 1416 // Create a precompiled snapshot.
1374 bool as_assembly = assembly_filename != NULL; 1417 bool as_assembly = assembly_filename != NULL;
1375 if (as_assembly) { 1418 if (as_assembly) {
1376 ASSERT(snapshot_kind == kAppAOTAssembly); 1419 ASSERT(snapshot_kind == kAppAOTAssembly);
1377 1420
1378 uint8_t* assembly_buffer = NULL; 1421 uint8_t* assembly_buffer = NULL;
1379 intptr_t assembly_size = 0; 1422 intptr_t assembly_size = 0;
1380 result = 1423 result =
1381 Dart_CreateAppAOTSnapshotAsAssembly(&assembly_buffer, &assembly_size); 1424 Dart_CreateAppAOTSnapshotAsAssembly(&assembly_buffer, &assembly_size);
1382 CHECK_RESULT(result); 1425 CHECK_RESULT(result);
1383 1426
1384 WriteSnapshotFile(assembly_filename, assembly_buffer, assembly_size); 1427 WriteFile(assembly_filename, assembly_buffer, assembly_size);
1385 } else { 1428 } else {
1386 ASSERT(snapshot_kind == kAppAOTBlobs); 1429 ASSERT(snapshot_kind == kAppAOTBlobs);
1387 1430
1388 uint8_t* vm_snapshot_data_buffer = NULL; 1431 uint8_t* vm_snapshot_data_buffer = NULL;
1389 intptr_t vm_snapshot_data_size = 0; 1432 intptr_t vm_snapshot_data_size = 0;
1390 uint8_t* vm_snapshot_instructions_buffer = NULL; 1433 uint8_t* vm_snapshot_instructions_buffer = NULL;
1391 intptr_t vm_snapshot_instructions_size = 0; 1434 intptr_t vm_snapshot_instructions_size = 0;
1392 uint8_t* isolate_snapshot_data_buffer = NULL; 1435 uint8_t* isolate_snapshot_data_buffer = NULL;
1393 intptr_t isolate_snapshot_data_size = 0; 1436 intptr_t isolate_snapshot_data_size = 0;
1394 uint8_t* isolate_snapshot_instructions_buffer = NULL; 1437 uint8_t* isolate_snapshot_instructions_buffer = NULL;
1395 intptr_t isolate_snapshot_instructions_size = 0; 1438 intptr_t isolate_snapshot_instructions_size = 0;
1396 result = Dart_CreateAppAOTSnapshotAsBlobs( 1439 result = Dart_CreateAppAOTSnapshotAsBlobs(
1397 &vm_snapshot_data_buffer, &vm_snapshot_data_size, 1440 &vm_snapshot_data_buffer, &vm_snapshot_data_size,
1398 &vm_snapshot_instructions_buffer, &vm_snapshot_instructions_size, 1441 &vm_snapshot_instructions_buffer, &vm_snapshot_instructions_size,
1399 &isolate_snapshot_data_buffer, &isolate_snapshot_data_size, 1442 &isolate_snapshot_data_buffer, &isolate_snapshot_data_size,
1400 &isolate_snapshot_instructions_buffer, 1443 &isolate_snapshot_instructions_buffer,
1401 &isolate_snapshot_instructions_size); 1444 &isolate_snapshot_instructions_size);
1402 CHECK_RESULT(result); 1445 CHECK_RESULT(result);
1403 1446
1404 WriteSnapshotFile(vm_snapshot_data_filename, vm_snapshot_data_buffer, 1447 WriteFile(vm_snapshot_data_filename, vm_snapshot_data_buffer,
1405 vm_snapshot_data_size); 1448 vm_snapshot_data_size);
1406 WriteSnapshotFile(vm_snapshot_instructions_filename, 1449 WriteFile(vm_snapshot_instructions_filename,
1407 vm_snapshot_instructions_buffer, 1450 vm_snapshot_instructions_buffer, vm_snapshot_instructions_size);
1408 vm_snapshot_instructions_size); 1451 WriteFile(isolate_snapshot_data_filename, isolate_snapshot_data_buffer,
1409 WriteSnapshotFile(isolate_snapshot_data_filename, 1452 isolate_snapshot_data_size);
1410 isolate_snapshot_data_buffer, isolate_snapshot_data_size); 1453 WriteFile(isolate_snapshot_instructions_filename,
1411 WriteSnapshotFile(isolate_snapshot_instructions_filename, 1454 isolate_snapshot_instructions_buffer,
1412 isolate_snapshot_instructions_buffer, 1455 isolate_snapshot_instructions_size);
1413 isolate_snapshot_instructions_size);
1414 } 1456 }
1415 } 1457 }
1416 1458
1417 1459
1418 static void SetupForUriResolution() { 1460 static void SetupForUriResolution() {
1419 // Set up the library tag handler for this isolate. 1461 // Set up the library tag handler for this isolate.
1420 Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler); 1462 Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler);
1421 if (Dart_IsError(result)) { 1463 if (Dart_IsError(result)) {
1422 Log::PrintErr("%s\n", Dart_GetError(result)); 1464 Log::PrintErr("%s\n", Dart_GetError(result));
1423 Dart_ExitScope(); 1465 Dart_ExitScope();
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 library = LoadSnapshotCreationScript(app_script_name); 1762 library = LoadSnapshotCreationScript(app_script_name);
1721 CHECK_RESULT(library); 1763 CHECK_RESULT(library);
1722 1764
1723 ImportNativeEntryPointLibrariesIntoRoot(entry_points); 1765 ImportNativeEntryPointLibrariesIntoRoot(entry_points);
1724 } 1766 }
1725 1767
1726 // Ensure that we mark all libraries as loaded. 1768 // Ensure that we mark all libraries as loaded.
1727 result = Dart_FinalizeLoading(false); 1769 result = Dart_FinalizeLoading(false);
1728 CHECK_RESULT(result); 1770 CHECK_RESULT(result);
1729 1771
1772 LoadCompilationTrace();
1773
1730 if (!dependencies_only) { 1774 if (!dependencies_only) {
1731 switch (snapshot_kind) { 1775 switch (snapshot_kind) {
1732 case kCore: 1776 case kCore:
1733 CreateAndWriteCoreSnapshot(); 1777 CreateAndWriteCoreSnapshot();
1734 break; 1778 break;
1735 case kCoreJIT: 1779 case kCoreJIT:
1736 CreateAndWriteCoreJITSnapshot(); 1780 CreateAndWriteCoreJITSnapshot();
1737 break; 1781 break;
1738 case kScript: 1782 case kScript:
1739 CreateAndWriteScriptSnapshot(); 1783 CreateAndWriteScriptSnapshot();
(...skipping 11 matching lines...) Expand all
1751 1795
1752 Dart_ExitScope(); 1796 Dart_ExitScope();
1753 Dart_ShutdownIsolate(); 1797 Dart_ShutdownIsolate();
1754 1798
1755 CleanupEntryPointsCollection(entry_points); 1799 CleanupEntryPointsCollection(entry_points);
1756 1800
1757 Dart_EnterIsolate(UriResolverIsolateScope::isolate); 1801 Dart_EnterIsolate(UriResolverIsolateScope::isolate);
1758 Dart_ShutdownIsolate(); 1802 Dart_ShutdownIsolate();
1759 } else { 1803 } else {
1760 SetupForGenericSnapshotCreation(); 1804 SetupForGenericSnapshotCreation();
1805 LoadCompilationTrace();
1761 switch (snapshot_kind) { 1806 switch (snapshot_kind) {
1762 case kCore: 1807 case kCore:
1763 CreateAndWriteCoreSnapshot(); 1808 CreateAndWriteCoreSnapshot();
1764 break; 1809 break;
1765 case kCoreJIT: 1810 case kCoreJIT:
1766 CreateAndWriteCoreJITSnapshot(); 1811 CreateAndWriteCoreJITSnapshot();
1767 break; 1812 break;
1768 default: 1813 default:
1769 UNREACHABLE(); 1814 UNREACHABLE();
1770 break; 1815 break;
(...skipping 12 matching lines...) Expand all
1783 delete mapped_isolate_snapshot_data; 1828 delete mapped_isolate_snapshot_data;
1784 return 0; 1829 return 0;
1785 } 1830 }
1786 1831
1787 } // namespace bin 1832 } // namespace bin
1788 } // namespace dart 1833 } // namespace dart
1789 1834
1790 int main(int argc, char** argv) { 1835 int main(int argc, char** argv) {
1791 return dart::bin::main(argc, argv); 1836 return dart::bin::main(argc, argv);
1792 } 1837 }
OLDNEW
« no previous file with comments | « runtime/bin/BUILD.gn ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698