From b28c4664c007e7790a9e88ae1b59aee13204cdf6 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Tue, 13 Mar 2018 22:24:19 +0000 Subject: [PATCH] Revert "[VM] Move runtime/lib/{developer,profiler,timeline}.dart -> ..._patch.dart, fix owner of constructors" This reverts commit 60a2cfa2191bd52f799af538b84e77a5895b23c9. Change-Id: I6d83653c72d5e8576952a631d23be5be5d9c71f6 Reviewed-on: https://dart-review.googlesource.com/46384 Reviewed-by: Ben Konyi Reviewed-by: Zach Anderson Commit-Queue: Ben Konyi --- pkg/kernel/lib/clone.dart | 4 - .../{developer_patch.dart => developer.dart} | 4 +- runtime/lib/developer_sources.gni | 8 +- .../{profiler_patch.dart => profiler.dart} | 2 +- .../{timeline_patch.dart => timeline.dart} | 2 +- .../observatory/tests/service/service.status | 1 - .../service/valid_source_locations_test.dart | 79 ------------------- runtime/vm/kernel_loader.cc | 12 +-- sdk/lib/libraries.json | 6 +- sdk/lib/libraries.yaml | 6 +- 10 files changed, 15 insertions(+), 109 deletions(-) rename runtime/lib/{developer_patch.dart => developer.dart} (98%) rename runtime/lib/{profiler_patch.dart => profiler.dart} (95%) rename runtime/lib/{timeline_patch.dart => timeline.dart} (96%) delete mode 100644 runtime/observatory/tests/service/valid_source_locations_test.dart diff --git a/pkg/kernel/lib/clone.dart b/pkg/kernel/lib/clone.dart index 556a1e8b2e5..0d4982d5c8d 100644 --- a/pkg/kernel/lib/clone.dart +++ b/pkg/kernel/lib/clone.dart @@ -391,7 +391,6 @@ class CloneVisitor implements TreeVisitor { isSynthetic: node.isSynthetic, initializers: node.initializers.map(clone).toList(), transformerFlags: node.transformerFlags) - ..fileOffset = node.fileOffset ..fileEndOffset = node.fileEndOffset; } @@ -407,7 +406,6 @@ class CloneVisitor implements TreeVisitor { fileUri: node.fileUri, forwardingStubSuperTarget: node.forwardingStubSuperTarget, forwardingStubInterfaceTarget: node.forwardingStubInterfaceTarget) - ..fileOffset = node.fileOffset ..fileEndOffset = node.fileEndOffset ..isGenericContravariant = node.isGenericContravariant; } @@ -424,7 +422,6 @@ class CloneVisitor implements TreeVisitor { hasImplicitSetter: node.hasImplicitSetter, transformerFlags: node.transformerFlags, fileUri: node.fileUri) - ..fileOffset = node.fileOffset ..fileEndOffset = node.fileEndOffset ..flags = node.flags ..flags2 = node.flags2; @@ -464,7 +461,6 @@ class CloneVisitor implements TreeVisitor { returnType: visitType(node.returnType), asyncMarker: node.asyncMarker, dartAsyncMarker: node.dartAsyncMarker) - ..fileOffset = node.fileOffset ..fileEndOffset = node.fileEndOffset; } diff --git a/runtime/lib/developer_patch.dart b/runtime/lib/developer.dart similarity index 98% rename from runtime/lib/developer_patch.dart rename to runtime/lib/developer.dart index 8846fe9ea4d..f9ef5410f99 100644 --- a/runtime/lib/developer_patch.dart +++ b/runtime/lib/developer.dart @@ -14,8 +14,8 @@ import "dart:async" show Future, Zone; import "dart:isolate" show SendPort; /// These are the additional parts of this patch library: -// part "profiler_patch.dart" -// part "timeline_patch.dart" +// part "profiler.dart" +// part "timeline.dart" @patch bool debugger({bool when: true, String message}) native "Developer_debugger"; diff --git a/runtime/lib/developer_sources.gni b/runtime/lib/developer_sources.gni index d26ffe951fd..c6f3c292cef 100644 --- a/runtime/lib/developer_sources.gni +++ b/runtime/lib/developer_sources.gni @@ -6,11 +6,11 @@ developer_runtime_sources = [ "developer.cc", - # developer_patch.dart needs to be the first dart file because it contains + # developer.dart needs to be the first dart file because it contains # imports. - "developer_patch.dart", + "developer.dart", "profiler.cc", - "profiler_patch.dart", + "profiler.dart", "timeline.cc", - "timeline_patch.dart", + "timeline.dart", ] diff --git a/runtime/lib/profiler_patch.dart b/runtime/lib/profiler.dart similarity index 95% rename from runtime/lib/profiler_patch.dart rename to runtime/lib/profiler.dart index dc6aa55e4fe..40295a4413e 100644 --- a/runtime/lib/profiler_patch.dart +++ b/runtime/lib/profiler.dart @@ -2,7 +2,7 @@ // 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. -// part of "developer_patch.dart"; +// part of "developer.dart"; @patch class UserTag { diff --git a/runtime/lib/timeline_patch.dart b/runtime/lib/timeline.dart similarity index 96% rename from runtime/lib/timeline_patch.dart rename to runtime/lib/timeline.dart index 20a0684a3b7..fc9e698b779 100644 --- a/runtime/lib/timeline_patch.dart +++ b/runtime/lib/timeline.dart @@ -2,7 +2,7 @@ // 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. -// part of "developer_patch.dart"; +// part of "developer.dart"; @patch bool _isDartStreamEnabled() native "Timeline_isDartStreamEnabled"; diff --git a/runtime/observatory/tests/service/service.status b/runtime/observatory/tests/service/service.status index d33272ba007..65d32b9185f 100644 --- a/runtime/observatory/tests/service/service.status +++ b/runtime/observatory/tests/service/service.status @@ -48,7 +48,6 @@ add_breakpoint_rpc_kernel_test: SkipByDesign # kernel specific version of add_br [ $mode == debug ] debugger_location_second_test: Pass, Slow debugger_location_test: Pass, Slow -valid_source_locations_test: Pass, Slow # Service protocol is not supported in product mode. [ $mode == product ] diff --git a/runtime/observatory/tests/service/valid_source_locations_test.dart b/runtime/observatory/tests/service/valid_source_locations_test.dart deleted file mode 100644 index ef18e611ebe..00000000000 --- a/runtime/observatory/tests/service/valid_source_locations_test.dart +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2018, 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. -// VMOptions=--error_on_bad_type --error_on_bad_override - -import 'dart:async'; -import 'dart:convert'; -import 'dart:developer'; - -import 'package:observatory/service_io.dart'; -import 'package:unittest/unittest.dart'; - -import 'service_test_common.dart'; -import 'test_helper.dart'; - -void testFunction() { - debugger(); -} - -Future validateLocation(Location location) async { - if (location == null) return; - if (location.tokenPos == -1) return; - - // Ensure the script is loaded. - final Script script = await location.script.load(); - - // Use the more low-level functions. - script.getLine(script.tokenToLine(location.tokenPos)); - script.tokenToCol(location.tokenPos); - - // Use the helper functions. - await location.getLine(); - await location.getColumn(); -} - -Future validateFieldLocation(Field field) async { - // TODO(http://dartbug.com/32503): We should `field = await field.load()` - // here, but it causes all kinds of strong-mode errors. - await validateLocation(field.location); -} - -Future validateFunctionLocation(ServiceFunction fun) async { - fun = await fun.load(); - await validateLocation(fun.location); -} - -Future validateClassLocation(Class klass) async { - klass = await klass.load(); - await validateLocation(klass.location); - - for (Field field in klass.fields) { - await validateFieldLocation(field); - } - for (ServiceFunction fun in klass.functions) { - await validateFunctionLocation(fun); - } -} - -var tests = [ - hasStoppedAtBreakpoint, - (Isolate isolate) async { - // Loop over all libraries, classes, functions and fields to ensure . - for (Library lib in isolate.libraries) { - lib = await lib.load(); - - for (Field field in lib.variables) { - await validateFieldLocation(field); - } - for (ServiceFunction fun in lib.functions) { - await validateFunctionLocation(fun); - } - for (Class klass in lib.classes) { - await validateClassLocation(klass); - } - } - }, -]; - -main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc index e6e18828e6f..c95abf04190 100644 --- a/runtime/vm/kernel_loader.cc +++ b/runtime/vm/kernel_loader.cc @@ -1153,16 +1153,6 @@ void KernelLoader::FinishClassLoading(const Class& klass, const String& name = H.DartConstructorName(constructor_helper.canonical_name_); - - // We can have synthetic constructors, which will not have a source uri - // attached to them (which means the index into the source uri table is 0, - // see `package:kernel/binary/ast_to_binary::writeUriReference`. - const Object* owner = &klass; - const intptr_t source_uri_index = constructor_helper.source_uri_index_; - if (source_uri_index != 0) { - owner = &ClassForScriptAt(klass, source_uri_index); - } - Function& function = Function::ZoneHandle( Z, Function::New(name, RawFunction::kConstructor, false, // is_static @@ -1170,7 +1160,7 @@ void KernelLoader::FinishClassLoading(const Class& klass, false, // is_abstract constructor_helper.IsExternal(), false, // is_native - *owner, constructor_helper.position_)); + klass, constructor_helper.position_)); function.set_end_token_pos(constructor_helper.end_position_); functions_.Add(&function); function.set_kernel_offset(constructor_offset); diff --git a/sdk/lib/libraries.json b/sdk/lib/libraries.json index a9e77148144..c2b21b0b56d 100644 --- a/sdk/lib/libraries.json +++ b/sdk/lib/libraries.json @@ -73,9 +73,9 @@ }, "developer": { "patches": [ - "../../runtime/lib/developer_patch.dart", - "../../runtime/lib/profiler_patch.dart", - "../../runtime/lib/timeline_patch.dart" + "../../runtime/lib/developer.dart", + "../../runtime/lib/profiler.dart", + "../../runtime/lib/timeline.dart" ], "uri": "developer/developer.dart" }, diff --git a/sdk/lib/libraries.yaml b/sdk/lib/libraries.yaml index 2e41c70bda8..c9596749c06 100644 --- a/sdk/lib/libraries.yaml +++ b/sdk/lib/libraries.yaml @@ -81,9 +81,9 @@ vm: developer: uri: "developer/developer.dart" patches: - - "../../runtime/lib/developer_patch.dart" - - "../../runtime/lib/profiler_patch.dart" - - "../../runtime/lib/timeline_patch.dart" + - "../../runtime/lib/developer.dart" + - "../../runtime/lib/profiler.dart" + - "../../runtime/lib/timeline.dart" _http: uri: "_http/http.dart"