forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ VM / CLI ] Run DartDev isolate from snapshot when possible
This change tries to run from dartdev.dart.snapshot and falls back to running from dartdev.dill if incompatible VM flags are provided. Fixes dart-lang/sdk#43969 Performance results: dart test.dart (no CLI isolate): 0.167s dart run test (from snapshot): 0.208s dart run test (from kernel): 0.326s TEST=pkg/dartdev/test/load_from_dill_test.dart Change-Id: I3195886b86676580ef2a0221f0284328964ef061 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178300 Commit-Queue: Ben Konyi <bkonyi@google.com> Reviewed-by: Siva Annamalai <asiva@google.com>
- Loading branch information
Showing
6 changed files
with
131 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:io'; | ||
|
||
import 'package:test/test.dart'; | ||
|
||
import 'utils.dart'; | ||
|
||
void main() { | ||
TestProject p; | ||
|
||
tearDown(() => p?.dispose()); | ||
|
||
test("Fallback to dartdev.dill from dartdev.dart.snapshot for 'Hello World'", | ||
() { | ||
p = project(mainSrc: "void main() { print('Hello World'); }"); | ||
// The DartDev snapshot includes the --use-bare-instructions flag. If | ||
// --no-use-bare-instructions is passed, the VM will fail to load the | ||
// snapshot and should fall back to using the DartDev dill file. | ||
ProcessResult result = | ||
p.runSync(['--no-use-bare-instructions', 'run', p.relativeFilePath]); | ||
|
||
expect(result.stdout, contains('Hello World')); | ||
expect(result.stderr, isEmpty); | ||
expect(result.exitCode, 0); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters