Version 2.18.0-165.0.dev
Merge commit 'cd4cc0d577ed961a32eb29d12feac4feeb772ad8' into 'dev'
diff --git a/DEPS b/DEPS
index 7ed2184..b6c119a 100644
--- a/DEPS
+++ b/DEPS
@@ -113,7 +113,6 @@
"fixnum_rev": "3bfc2ed1eea7e7acb79ad4f17392f92c816fc5ce",
"glob_rev": "e10eb2407c58427144004458ef85c9bbf7286e56",
"html_rev": "f108bce59d136c584969fd24a5006914796cf213",
- "http_io_rev": "405fc79233b4a3d4bb079ebf438bb2caf2f49355",
"http_multi_server_rev": "35a3b947256768426090e3b1f5132e4fc23c175d",
"http_parser_rev": "9126ee04e77fd8e4e2e6435b503ee4dd708d7ddc",
"http_rev": "2993ea5dff5ffb066b4a35c707e7a2b8dcfa17c2",
@@ -340,8 +339,6 @@
Var("dart_git") + "html.git" + "@" + Var("html_rev"),
Var("dart_root") + "/third_party/pkg/http":
Var("dart_git") + "http.git" + "@" + Var("http_rev"),
- Var("dart_root") + "/third_party/pkg_tested/http_io":
- Var("dart_git") + "http_io.git" + "@" + Var("http_io_rev"),
Var("dart_root") + "/third_party/pkg/http_multi_server":
Var("dart_git") + "http_multi_server.git" +
"@" + Var("http_multi_server_rev"),
diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
index 3b94d9b..4c83abd 100644
--- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
+++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart
@@ -12,6 +12,7 @@
import 'package:analyzer/source/line_info.dart';
import 'package:analyzer/src/analysis_options/analysis_options_provider.dart';
import 'package:analyzer/src/context/packages.dart';
+import 'package:analyzer/src/dart/analysis/cache.dart';
import 'package:analyzer/src/dart/analysis/context_root.dart';
import 'package:analyzer/src/dart/analysis/driver.dart' show ErrorEncoding;
import 'package:analyzer/src/dart/analysis/experiments.dart';
@@ -126,6 +127,10 @@
@visibleForTesting
final Map<String, ResolvedLibraryResult> cachedResults = {};
+ /// The cache of error results.
+ final Cache<String, Uint8List> _errorResultsCache =
+ Cache(128 * 1024, (bytes) => bytes.length);
+
FileResolver({
required this.logger,
required this.resourceProvider,
@@ -250,30 +255,28 @@
var errorsSignatureBuilder = ApiSignature();
errorsSignatureBuilder.addBytes(file.libraryCycle.signature);
errorsSignatureBuilder.addBytes(file.digest);
- var errorsSignature = errorsSignatureBuilder.toByteList();
+ final errorsKey = '${errorsSignatureBuilder.toHex()}.errors';
- var errorsKey = '${file.path}.errors';
- var bytes = byteStore.get(errorsKey, errorsSignature)?.bytes;
- List<AnalysisError>? errors;
+ final List<AnalysisError> errors;
+ final bytes = _errorResultsCache.get(errorsKey);
if (bytes != null) {
var data = CiderUnitErrors.fromBuffer(bytes);
errors = data.errors.map((error) {
return ErrorEncoding.decode(file.source, error)!;
}).toList();
- }
-
- if (errors == null) {
+ } else {
var unitResult = await resolve2(
path: path,
performance: performance,
);
errors = unitResult.errors;
- bytes = CiderUnitErrorsBuilder(
- signature: errorsSignature,
- errors: errors.map(ErrorEncoding.encode).toList(),
- ).toBuffer();
- bytes = byteStore.putGet(errorsKey, errorsSignature, bytes).bytes;
+ _errorResultsCache.put(
+ errorsKey,
+ CiderUnitErrorsBuilder(
+ errors: errors.map(ErrorEncoding.encode).toList(),
+ ).toBuffer(),
+ );
}
return ErrorsResultImpl(
diff --git a/pkg/analyzer/lib/src/summary/format.dart b/pkg/analyzer/lib/src/summary/format.dart
index 34f8996..8718728 100644
--- a/pkg/analyzer/lib/src/summary/format.dart
+++ b/pkg/analyzer/lib/src/summary/format.dart
@@ -3217,7 +3217,6 @@
with _CiderUnitErrorsMixin
implements idl.CiderUnitErrors {
List<AnalysisDriverUnitErrorBuilder>? _errors;
- List<int>? _signature;
@override
List<AnalysisDriverUnitErrorBuilder> get errors =>
@@ -3227,19 +3226,8 @@
this._errors = value;
}
- @override
- List<int> get signature => _signature ??= <int>[];
-
- /// The hash signature of this data.
- set signature(List<int> value) {
- assert(value.every((e) => e >= 0));
- this._signature = value;
- }
-
- CiderUnitErrorsBuilder(
- {List<AnalysisDriverUnitErrorBuilder>? errors, List<int>? signature})
- : _errors = errors,
- _signature = signature;
+ CiderUnitErrorsBuilder({List<AnalysisDriverUnitErrorBuilder>? errors})
+ : _errors = errors;
/// Flush [informative] data recursively.
void flushInformative() {
@@ -3248,15 +3236,6 @@
/// Accumulate non-[informative] data into [signature].
void collectApiSignature(api_sig.ApiSignature signatureSink) {
- var signature = this._signature;
- if (signature == null) {
- signatureSink.addInt(0);
- } else {
- signatureSink.addInt(signature.length);
- for (var x in signature) {
- signatureSink.addInt(x);
- }
- }
var errors = this._errors;
if (errors == null) {
signatureSink.addInt(0);
@@ -3275,22 +3254,14 @@
fb.Offset finish(fb.Builder fbBuilder) {
fb.Offset? offset_errors;
- fb.Offset? offset_signature;
var errors = _errors;
if (!(errors == null || errors.isEmpty)) {
offset_errors =
fbBuilder.writeList(errors.map((b) => b.finish(fbBuilder)).toList());
}
- var signature = _signature;
- if (!(signature == null || signature.isEmpty)) {
- offset_signature = fbBuilder.writeListUint32(signature);
- }
fbBuilder.startTable();
if (offset_errors != null) {
- fbBuilder.addOffset(1, offset_errors);
- }
- if (offset_signature != null) {
- fbBuilder.addOffset(0, offset_signature);
+ fbBuilder.addOffset(0, offset_errors);
}
return fbBuilder.endTable();
}
@@ -3318,19 +3289,12 @@
_CiderUnitErrorsImpl(this._bc, this._bcOffset);
List<idl.AnalysisDriverUnitError>? _errors;
- List<int>? _signature;
@override
List<idl.AnalysisDriverUnitError> get errors {
return _errors ??= const fb.ListReader<idl.AnalysisDriverUnitError>(
_AnalysisDriverUnitErrorReader())
- .vTableGet(_bc, _bcOffset, 1, const <idl.AnalysisDriverUnitError>[]);
- }
-
- @override
- List<int> get signature {
- return _signature ??=
- const fb.Uint32ListReader().vTableGet(_bc, _bcOffset, 0, const <int>[]);
+ .vTableGet(_bc, _bcOffset, 0, const <idl.AnalysisDriverUnitError>[]);
}
}
@@ -3342,17 +3306,12 @@
if (local_errors.isNotEmpty) {
result["errors"] = local_errors.map((value) => value.toJson()).toList();
}
- var local_signature = signature;
- if (local_signature.isNotEmpty) {
- result["signature"] = local_signature;
- }
return result;
}
@override
Map<String, Object?> toMap() => {
"errors": errors,
- "signature": signature,
};
@override
diff --git a/pkg/analyzer/lib/src/summary/format.fbs b/pkg/analyzer/lib/src/summary/format.fbs
index 5d58b75..8db2631 100644
--- a/pkg/analyzer/lib/src/summary/format.fbs
+++ b/pkg/analyzer/lib/src/summary/format.fbs
@@ -403,10 +403,7 @@
/// Errors for a single unit.
table CiderUnitErrors {
- errors:[AnalysisDriverUnitError] (id: 1);
-
- /// The hash signature of this data.
- signature:[uint] (id: 0);
+ errors:[AnalysisDriverUnitError] (id: 0);
}
table DiagnosticMessage {
diff --git a/pkg/analyzer/lib/src/summary/idl.dart b/pkg/analyzer/lib/src/summary/idl.dart
index b5f6b8f..13be95e 100644
--- a/pkg/analyzer/lib/src/summary/idl.dart
+++ b/pkg/analyzer/lib/src/summary/idl.dart
@@ -427,12 +427,8 @@
factory CiderUnitErrors.fromBuffer(List<int> buffer) =>
generated.readCiderUnitErrors(buffer);
- @Id(1)
- List<AnalysisDriverUnitError> get errors;
-
- /// The hash signature of this data.
@Id(0)
- List<int> get signature;
+ List<AnalysisDriverUnitError> get errors;
}
abstract class DiagnosticMessage extends base.SummaryClass {
diff --git a/pkg/analyzer/test/src/dart/micro/file_resolution.dart b/pkg/analyzer/test/src/dart/micro/file_resolution.dart
index d9c67b6..f664ce3 100644
--- a/pkg/analyzer/test/src/dart/micro/file_resolution.dart
+++ b/pkg/analyzer/test/src/dart/micro/file_resolution.dart
@@ -35,6 +35,11 @@
Folder get sdkRoot => newFolder('/sdk');
+ File get testFile => getFile(testFilePath);
+
+ @override
+ String get testFilePath => _testFile;
+
@override
void addTestFile(String content) {
newFile(_testFile, content);
diff --git a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
index ffc3b74..4f726b3 100644
--- a/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
+++ b/pkg/analyzer/test/src/dart/micro/simple_file_resolver_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/source/line_info.dart';
import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
@@ -691,79 +692,56 @@
}
test_getErrors_reuse() async {
- addTestFile('var a = b;');
-
- var path = convertPath('/workspace/dart/test/lib/test.dart');
+ newFile(testFilePath, 'var a = b;');
// No resolved files yet.
- expect(fileResolver.testView!.resolvedLibraries, isEmpty);
+ _assertResolvedFiles([]);
// No cached, will resolve once.
expect((await getTestErrors()).errors, hasLength(1));
- expect(fileResolver.testView!.resolvedLibraries, [path]);
+ _assertResolvedFiles([testFile]);
// Has cached, will be not resolved again.
expect((await getTestErrors()).errors, hasLength(1));
- expect(fileResolver.testView!.resolvedLibraries, [path]);
+ _assertResolvedFiles([]);
- // New resolver.
- // Still has cached, will be not resolved.
- createFileResolver();
+ // Change the file, will be resolved again.
+ newFile(testFilePath, 'var a = c;');
+ fileResolver.changeFile(testFile.path);
expect((await getTestErrors()).errors, hasLength(1));
- expect(fileResolver.testView!.resolvedLibraries, <Object>[]);
-
- // Change the file, new resolver.
- // With changed file the previously cached result cannot be used.
- addTestFile('var a = c;');
- createFileResolver();
- expect((await getTestErrors()).errors, hasLength(1));
- expect(fileResolver.testView!.resolvedLibraries, [path]);
-
- // New resolver.
- // Still has cached, will be not resolved.
- createFileResolver();
- expect((await getTestErrors()).errors, hasLength(1));
- expect(fileResolver.testView!.resolvedLibraries, <Object>[]);
+ _assertResolvedFiles([testFile]);
}
test_getErrors_reuse_changeDependency() async {
- newFile('/workspace/dart/test/lib/a.dart', r'''
+ final a = newFile('/workspace/dart/test/lib/a.dart', r'''
var a = 0;
''');
- addTestFile(r'''
+ newFile(testFilePath, r'''
import 'a.dart';
var b = a.foo;
''');
- var path = convertPath('/workspace/dart/test/lib/test.dart');
-
// No resolved files yet.
- expect(fileResolver.testView!.resolvedLibraries, isEmpty);
+ _assertResolvedFiles([]);
// No cached, will resolve once.
expect((await getTestErrors()).errors, hasLength(1));
- expect(fileResolver.testView!.resolvedLibraries, [path]);
+ _assertResolvedFiles([testFile]);
// Has cached, will be not resolved again.
expect((await getTestErrors()).errors, hasLength(1));
- expect(fileResolver.testView!.resolvedLibraries, [path]);
+ _assertResolvedFiles([]);
- // Change the dependency, new resolver.
+ // Change the dependency.
// The signature of the result is different.
// The previously cached result cannot be used.
- newFile('/workspace/dart/test/lib/a.dart', r'''
+ newFile(a.path, r'''
var a = 4.2;
''');
- createFileResolver();
+ fileResolver.changeFile(a.path);
expect((await getTestErrors()).errors, hasLength(1));
- expect(fileResolver.testView!.resolvedLibraries, [path]);
-
- // New resolver.
- // Still has cached, will be not resolved.
- createFileResolver();
- expect((await getTestErrors()).errors, hasLength(1));
- expect(fileResolver.testView!.resolvedLibraries, <Object>[]);
+ _assertResolvedFiles([testFile]);
}
test_getFilesWithTopLevelDeclarations_cached() async {
@@ -1097,25 +1075,23 @@
}
test_resolveFile_cache() async {
- var path = convertPath('/workspace/dart/test/lib/test.dart');
- newFile(path, 'var a = 0;');
+ newFile(testFilePath, 'var a = 0;');
// No resolved files yet.
- var testView = fileResolver.testView!;
- expect(testView.resolvedLibraries, isEmpty);
+ _assertResolvedFiles([]);
- await resolveFile2(path);
+ await resolveFile2(testFile.path);
var result1 = result;
// The file was resolved.
- expect(testView.resolvedLibraries, [path]);
+ _assertResolvedFiles([testFile]);
// The result is cached.
- expect(fileResolver.cachedResults, contains(path));
+ expect(fileResolver.cachedResults, contains(testFile.path));
// Ask again, no changes, not resolved.
- await resolveFile2(path);
- expect(testView.resolvedLibraries, [path]);
+ await resolveFile2(testFile.path);
+ _assertResolvedFiles([]);
// The same result was returned.
expect(result, same(result1));
@@ -1125,36 +1101,33 @@
fileResolver.changeFile(a_path);
// The was a change to a file, no matter which, resolve again.
- await resolveFile2(path);
- expect(testView.resolvedLibraries, [path, path]);
+ await resolveFile2(testFile.path);
+ _assertResolvedFiles([testFile]);
// Get should get a new result.
expect(result, isNot(same(result1)));
}
test_resolveFile_dontCache_whenForCompletion() async {
- var a_path = convertPath('/workspace/dart/test/lib/a.dart');
- newFile(a_path, r'''
+ final a = newFile('/workspace/dart/test/lib/a.dart', r'''
part 'b.dart';
''');
- var b_path = convertPath('/workspace/dart/test/lib/b.dart');
- newFile(b_path, r'''
+ final b = newFile('/workspace/dart/test/lib/b.dart', r'''
part of 'a.dart';
''');
// No resolved files yet.
- var testView = fileResolver.testView!;
- expect(testView.resolvedLibraries, isEmpty);
+ _assertResolvedFiles([]);
await fileResolver.resolve2(
- path: b_path,
+ path: b.path,
completionLine: 0,
completionColumn: 0,
);
- // The file was resolved.
- expect(testView.resolvedLibraries, [a_path]);
+ // The library was resolved.
+ _assertResolvedFiles([a]);
// The completion location was set, so not units are resolved.
// So, the result should not be cached.
@@ -1281,6 +1254,17 @@
expect(fileResolver.fsState!.testView.removedPaths, matcher);
}
+ void _assertResolvedFiles(
+ List<File> expected, {
+ bool andClear = true,
+ }) {
+ final actual = fileResolver.testView!.resolvedLibraries;
+ expect(actual, expected.map((e) => e.path).toList());
+ if (andClear) {
+ actual.clear();
+ }
+ }
+
Future<Element> _findElement(int offset, String filePath) async {
var resolvedUnit = await fileResolver.resolve2(path: filePath);
var node = NodeLocator(offset).searchWithin(resolvedUnit.unit);
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index 53269b2..a72f199 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -829,52 +829,55 @@
return pass(result);
}
- FolderOptions folderOptions =
- context.computeFolderOptions(result.description);
- Map<ExperimentalFlag, bool> experimentalFlags = folderOptions
- .computeExplicitExperimentalFlags(context.explicitExperimentalFlags);
- switch (folderOptions.target) {
- case "vm":
- if (context._platforms.isEmpty) {
- throw "Executed `Run` step before initializing the context.";
- }
- File generated = new File.fromUri(result.outputUri!);
- StdioProcess process;
- try {
- var args = <String>[];
+ File generated = new File.fromUri(result.outputUri!);
+ try {
+ FolderOptions folderOptions =
+ context.computeFolderOptions(result.description);
+ Map<ExperimentalFlag, bool> experimentalFlags = folderOptions
+ .computeExplicitExperimentalFlags(context.explicitExperimentalFlags);
+ switch (folderOptions.target) {
+ case "vm":
+ if (context._platforms.isEmpty) {
+ throw "Executed `Run` step before initializing the context.";
+ }
+ List<String> args = <String>[];
if (experimentalFlags[ExperimentalFlag.nonNullable] == true) {
if (context.soundNullSafety) {
args.add("--sound-null-safety");
}
}
args.add(generated.path);
- process = await StdioProcess.run(context.vm.toFilePath(), args);
+ StdioProcess process =
+ await StdioProcess.run(context.vm.toFilePath(), args);
print(process.output);
- } finally {
- await generated.parent.delete(recursive: true);
- }
- Result<int> runResult = process.toResult();
- if (result.component.mode == NonNullableByDefaultCompiledMode.Invalid) {
- // In this case we expect and want a runtime error.
- if (runResult.outcome == ExpectationSet.Default["RuntimeError"]) {
- // We convert this to pass because that's exactly what we'd expect.
- return pass(result);
- } else {
- // Different outcome - that's a failure!
- return new Result<ComponentResult>(result,
- ExpectationSet.Default["MissingRuntimeError"], runResult.error);
+ Result<int> runResult = process.toResult();
+ if (result.component.mode ==
+ NonNullableByDefaultCompiledMode.Invalid) {
+ // In this case we expect and want a runtime error.
+ if (runResult.outcome == ExpectationSet.Default["RuntimeError"]) {
+ // We convert this to pass because that's exactly what we'd expect.
+ return pass(result);
+ } else {
+ // Different outcome - that's a failure!
+ return new Result<ComponentResult>(
+ result,
+ ExpectationSet.Default["MissingRuntimeError"],
+ runResult.error);
+ }
}
- }
- return new Result<ComponentResult>(
- result, runResult.outcome, runResult.error);
- case "none":
- case "dart2js":
- case "dartdevc":
- // TODO(johnniwinther): Support running dart2js and/or dartdevc.
- return pass(result);
- default:
- throw new ArgumentError(
- "Unsupported run target '${folderOptions.target}'.");
+ return new Result<ComponentResult>(
+ result, runResult.outcome, runResult.error);
+ case "none":
+ case "dart2js":
+ case "dartdevc":
+ // TODO(johnniwinther): Support running dart2js and/or dartdevc.
+ return pass(result);
+ default:
+ throw new ArgumentError(
+ "Unsupported run target '${folderOptions.target}'.");
+ }
+ } finally {
+ await generated.parent.delete(recursive: true);
}
}
}
diff --git a/pkg/front_end/test/utils/kernel_chain.dart b/pkg/front_end/test/utils/kernel_chain.dart
index 93beea1..b0941a1 100644
--- a/pkg/front_end/test/utils/kernel_chain.dart
+++ b/pkg/front_end/test/utils/kernel_chain.dart
@@ -455,8 +455,28 @@
ByteSink sink = new ByteSink();
bool good = false;
try {
- // TODO(johnniwinther,jensj): Avoid serializing the sdk.
- new BinaryPrinter(sink).writeComponentFile(component);
+ // Avoid serializing the sdk.
+ component.computeCanonicalNames();
+ Component userCode = new Component(
+ nameRoot: component.root,
+ uriToSource: new Map<Uri, Source>.from(component.uriToSource));
+ userCode.setMainMethodAndMode(
+ component.mainMethodName, true, component.mode);
+ for (Library library in component.libraries) {
+ if (library.importUri.isScheme("dart")) {
+ if (result.isUserLibrary(library)) {
+ // dart:test, test:extra etc as used will say yes to being a user
+ // library.
+ } else if (library.isSynthetic) {
+ // OK --- serialize that.
+ } else {
+ // Skip serialization of "real" platform libraries.
+ continue;
+ }
+ }
+ userCode.libraries.add(library);
+ }
+ new BinaryPrinter(sink).writeComponentFile(userCode);
good = true;
} catch (e, s) {
return fail(result, e, s);
diff --git a/runtime/vm/app_snapshot.cc b/runtime/vm/app_snapshot.cc
index 2b20b44..c88a31f 100644
--- a/runtime/vm/app_snapshot.cc
+++ b/runtime/vm/app_snapshot.cc
@@ -1027,12 +1027,33 @@
if (kind != Snapshot::kFullAOT) {
NOT_IN_PRECOMPILED(
WriteCompressedField(func, positional_parameter_names));
+ }
+
+#if defined(DART_PRECOMPILER) && !defined(PRODUCT)
+ TokenPosition token_pos = func->untag()->token_pos_;
+ if (kind == Snapshot::kFullAOT) {
+ // We use then token_pos property to store the line number
+ // in AOT snapshots.
+ intptr_t line = -1;
+ const Function& function = Function::Handle(func);
+ const Script& script = Script::Handle(function.script());
+ if (!script.IsNull()) {
+ script.GetTokenLocation(token_pos, &line, nullptr);
+ }
+ token_pos = line == -1 ? TokenPosition::kNoSource
+ : TokenPosition::Deserialize(line);
+ }
+ s->WriteTokenPosition(token_pos);
+#else
+ if (kind != Snapshot::kFullAOT) {
s->WriteTokenPosition(func->untag()->token_pos_);
+ }
+#endif
+ if (kind != Snapshot::kFullAOT) {
s->WriteTokenPosition(func->untag()->end_token_pos_);
s->Write<uint32_t>(func->untag()->kernel_offset_);
s->Write<uint32_t>(func->untag()->packed_fields_);
}
-
s->Write<uint32_t>(func->untag()->kind_tag_);
}
}
@@ -1188,12 +1209,18 @@
ASSERT(kind != Snapshot::kFullAOT);
func->untag()->positional_parameter_names_ =
static_cast<ArrayPtr>(d.ReadRef());
+#endif
+#if !defined(DART_PRECOMPILED_RUNTIME) || \
+ (defined(DART_PRECOMPILED_RUNTIME) && !defined(PRODUCT))
func->untag()->token_pos_ = d.ReadTokenPosition();
+#endif
+#if !defined(DART_PRECOMPILED_RUNTIME)
func->untag()->end_token_pos_ = d.ReadTokenPosition();
func->untag()->kernel_offset_ = d.Read<uint32_t>();
func->untag()->unboxed_parameters_info_.Reset();
func->untag()->packed_fields_ = d.Read<uint32_t>();
#endif
+
func->untag()->kind_tag_ = d.Read<uint32_t>();
#if !defined(DART_PRECOMPILED_RUNTIME)
func->untag()->usage_counter_ = 0;
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index 39650ff..c3a19ca 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -10102,7 +10102,7 @@
static constexpr dart::compiler::target::word AOT_Function_data_offset = 24;
static constexpr dart::compiler::target::word
AOT_Function_entry_point_offset[] = {4, 8};
-static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 36;
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 40;
static constexpr dart::compiler::target::word AOT_Function_signature_offset =
20;
static constexpr dart::compiler::target::word
@@ -10563,7 +10563,7 @@
24;
static constexpr dart::compiler::target::word AOT_Float32x4_InstanceSize = 24;
static constexpr dart::compiler::target::word AOT_Float64x2_InstanceSize = 24;
-static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 44;
static constexpr dart::compiler::target::word AOT_FunctionType_InstanceSize =
40;
static constexpr dart::compiler::target::word AOT_FutureOr_InstanceSize = 8;
@@ -10798,7 +10798,7 @@
static constexpr dart::compiler::target::word AOT_Function_data_offset = 48;
static constexpr dart::compiler::target::word
AOT_Function_entry_point_offset[] = {8, 16};
-static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 72;
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 76;
static constexpr dart::compiler::target::word AOT_Function_signature_offset =
40;
static constexpr dart::compiler::target::word
@@ -11500,7 +11500,7 @@
static constexpr dart::compiler::target::word AOT_Function_data_offset = 48;
static constexpr dart::compiler::target::word
AOT_Function_entry_point_offset[] = {8, 16};
-static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 72;
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 76;
static constexpr dart::compiler::target::word AOT_Function_signature_offset =
40;
static constexpr dart::compiler::target::word
@@ -12199,7 +12199,7 @@
static constexpr dart::compiler::target::word AOT_Function_data_offset = 36;
static constexpr dart::compiler::target::word
AOT_Function_entry_point_offset[] = {8, 16};
-static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 48;
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 52;
static constexpr dart::compiler::target::word AOT_Function_signature_offset =
32;
static constexpr dart::compiler::target::word
@@ -12897,7 +12897,7 @@
static constexpr dart::compiler::target::word AOT_Function_data_offset = 36;
static constexpr dart::compiler::target::word
AOT_Function_entry_point_offset[] = {8, 16};
-static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 48;
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 52;
static constexpr dart::compiler::target::word AOT_Function_signature_offset =
32;
static constexpr dart::compiler::target::word
@@ -13596,7 +13596,7 @@
static constexpr dart::compiler::target::word AOT_Function_data_offset = 24;
static constexpr dart::compiler::target::word
AOT_Function_entry_point_offset[] = {4, 8};
-static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 36;
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 40;
static constexpr dart::compiler::target::word AOT_Function_signature_offset =
20;
static constexpr dart::compiler::target::word
@@ -14059,7 +14059,7 @@
24;
static constexpr dart::compiler::target::word AOT_Float32x4_InstanceSize = 24;
static constexpr dart::compiler::target::word AOT_Float64x2_InstanceSize = 24;
-static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 40;
+static constexpr dart::compiler::target::word AOT_Function_InstanceSize = 44;
static constexpr dart::compiler::target::word AOT_FunctionType_InstanceSize =
40;
static constexpr dart::compiler::target::word AOT_FutureOr_InstanceSize = 8;
@@ -14294,7 +14294,7 @@
static constexpr dart::compiler::target::word AOT_Function_data_offset = 48;
static constexpr dart::compiler::target::word
AOT_Function_entry_point_offset[] = {8, 16};
-static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 72;
+static constexpr dart::compiler::target::word AOT_Function_kind_tag_offset = 76;
static constexpr dart::compiler::target::word AOT_Function_signature_offset =
40;
static constexpr dart::compiler::target::word
diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc
index 1d6e8ac..5e3fe1e 100644
--- a/runtime/vm/json_stream.cc
+++ b/runtime/vm/json_stream.cc
@@ -542,6 +542,16 @@
AddLocation(script, token_pos);
}
+void JSONObject::AddLocationLine(const Script& script, intptr_t line) const {
+ JSONObject location(this, "location");
+ location.AddProperty("type", "SourceLocation");
+ location.AddProperty("script", script);
+ location.AddProperty("tokenPos", TokenPosition::kNoSource);
+ if (line > 0) {
+ location.AddProperty("line", line);
+ }
+}
+
void JSONObject::AddUnresolvedLocation(
const BreakpointLocation* bpt_loc) const {
ASSERT(!bpt_loc->IsResolved());
diff --git a/runtime/vm/json_stream.h b/runtime/vm/json_stream.h
index 3a6b523..21e0064 100644
--- a/runtime/vm/json_stream.h
+++ b/runtime/vm/json_stream.h
@@ -376,6 +376,7 @@
TokenPosition end_token_pos = TokenPosition::kNoSource) const;
void AddLocation(const BreakpointLocation* bpt_loc) const;
+ void AddLocationLine(const Script& script, intptr_t line) const;
void AddUnresolvedLocation(const BreakpointLocation* bpt_loc) const;
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 52de6b1..3526a5c 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -9693,7 +9693,7 @@
}
if (IsImplicitGetterOrSetter()) {
const auto& field = Field::Handle(accessor_field());
- return field.Script();
+ return field.IsNull() ? Script::null() : field.Script();
}
Object& data = Object::Handle(this->data());
if (data.IsArray()) {
@@ -9716,9 +9716,7 @@
}
if (IsClosureFunction()) {
const Function& function = Function::Handle(parent_function());
-#if defined(DART_PRECOMPILED_RUNTIME)
if (function.IsNull()) return Script::null();
-#endif
return function.script();
}
ASSERT(obj.IsClass());
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 17080ec..06fae2d 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -3138,6 +3138,17 @@
#endif
}
+#if !defined(PRODUCT) && \
+ (defined(DART_PRECOMPILER) || defined(DART_PRECOMPILED_RUNTIME))
+ int32_t line() const {
+ return untag()->token_pos_.Serialize();
+ }
+
+ void set_line(int32_t line) const {
+ StoreNonPointer(&untag()->token_pos_, TokenPosition::Deserialize(line));
+ }
+#endif
+
// Returns the size of the source for this function.
intptr_t SourceSize() const;
diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc
index 0653fe4..fd957bc 100644
--- a/runtime/vm/object_service.cc
+++ b/runtime/vm/object_service.cc
@@ -346,7 +346,13 @@
const Script& script = Script::Handle(this->script());
if (!script.IsNull()) {
+#if defined(DART_PRECOMPILED_RUNTIME)
+ // Token position information is stripped in AOT snapshots, but the line
+ // number is still included.
+ jsobj.AddLocationLine(script, line());
+#else
jsobj.AddLocation(script, token_pos(), end_token_pos());
+#endif // defined(DART_PRECOMPILED_RUNTIME)
}
if (ref) {
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index d590114..eb60d27 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -1325,7 +1325,14 @@
VISIT_TO(unoptimized_code);
UnboxedParameterBitmap unboxed_parameters_info_;
+#endif
+
+#if !defined(DART_PRECOMPILED_RUNTIME) || \
+ (defined(DART_PRECOMPILED_RUNTIME) && !defined(PRODUCT))
TokenPosition token_pos_;
+#endif
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
TokenPosition end_token_pos_;
#endif
diff --git a/tools/VERSION b/tools/VERSION
index 01fed72..9d216f3 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 164
+PRERELEASE 165
PRERELEASE_PATCH 0
\ No newline at end of file