Version 3.4.0-177.0.dev Merge e07a14d590fc0499dff6d289f666d8767ac1d536 into dev
diff --git a/DEPS b/DEPS index edc9e12..286b2340 100644 --- a/DEPS +++ b/DEPS
@@ -57,7 +57,7 @@ "co19_rev": "867d139b3169fc131488e893ec1133dc98cc3aa0", # The internal benchmarks to use. See go/dart-benchmarks-internal - "benchmarks_internal_rev": "175974d2b43dae39c380fc5f7f583a377cd3c11d", + "benchmarks_internal_rev": "a7c23b2422492dcc515d1ba4abe3609b50e2a139", "checkout_benchmarks_internal": False, # Checkout the flute benchmark only when benchmarking.
diff --git a/pkg/dart2wasm/bin/run_wasm.js b/pkg/dart2wasm/bin/run_wasm.js index f6886bb..e51890b 100644 --- a/pkg/dart2wasm/bin/run_wasm.js +++ b/pkg/dart2wasm/bin/run_wasm.js
@@ -57,6 +57,13 @@ const isJSC = (typeof readFile === "function"); const isJSShell = (typeof readRelativeToScript === "function"); +if (isD8) { + // D8's performance.measure is API incompatible with the browser version. + // + // (see also dart2js's `sdk/**/js_runtime/lib/preambles/d8.js`) + delete performance.measure; +} + // d8's `setTimeout` doesn't work as expected (it doesn't wait before calling // the callback), and d8 also doesn't have `setInterval` and `queueMicrotask`. // So we define our own event loop with these functions.
diff --git a/pkg/dart2wasm/lib/compile.dart b/pkg/dart2wasm/lib/compile.dart index b4581d2..318f725 100644 --- a/pkg/dart2wasm/lib/compile.dart +++ b/pkg/dart2wasm/lib/compile.dart
@@ -28,6 +28,8 @@ import 'package:vm/transformations/type_flow/transformer.dart' as globalTypeFlow show transformComponent; +import 'package:vm/transformations/mixin_deduplication.dart' + as mixin_deduplication show transformComponent; import 'package:dart2wasm/compiler_options.dart' as compiler; import 'package:dart2wasm/js/runtime_generator.dart' as js; @@ -123,6 +125,8 @@ writeComponentToText(component, path: options.dumpKernelBeforeTfa!); } + mixin_deduplication.transformComponent(component); + globalTypeFlow.transformComponent(target, coreTypes, component, treeShakeSignatures: true, treeShakeWriteOnlyFields: true,
diff --git a/pkg/dart2wasm/lib/js/runtime_blob.dart b/pkg/dart2wasm/lib/js/runtime_blob.dart index 5da0782..721d2cb 100644 --- a/pkg/dart2wasm/lib/js/runtime_blob.dart +++ b/pkg/dart2wasm/lib/js/runtime_blob.dart
@@ -69,6 +69,10 @@ const jsRuntimeBlobPart3 = r''' // Prints to the console function printToConsole(value) { + if (typeof dartPrint == "function") { + dartPrint(value); + return; + } if (typeof console == "object" && typeof console.log != "undefined") { console.log(value); return;
diff --git a/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart b/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart index 3d9b15c..d6b66eb 100644 --- a/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart +++ b/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart
@@ -7,12 +7,9 @@ import 'package:kernel/ast.dart'; import '../denylisted_classes.dart' show denylistedCoreClasses; - import '../fasta_codes.dart' show Message, templateTypeOrigin, templateTypeOriginWithFileUri; -import '../problems.dart' show unsupported; - /// A pretty-printer for Kernel types and constants with the ability to label /// raw types with numeric markers in Dart comments (e.g. `/*1*/`) to /// distinguish different types with the same name. This is used in diagnostic @@ -527,7 +524,7 @@ @override void visitUnevaluatedConstant(UnevaluatedConstant node) { - unsupported('printing unevaluated constants', -1, null); + throw new UnsupportedError('printing unevaluated constants'); } @override
diff --git a/sdk/lib/_internal/js_runtime/lib/developer_patch.dart b/sdk/lib/_internal/js_runtime/lib/developer_patch.dart index 2e17b8c..2c5e01e 100644 --- a/sdk/lib/_internal/js_runtime/lib/developer_patch.dart +++ b/sdk/lib/_internal/js_runtime/lib/developer_patch.dart
@@ -5,8 +5,9 @@ // Patch file for dart:developer library. import 'dart:_internal' show patch; -import 'dart:_foreign_helper' show JS; + import 'dart:async' show Zone; +import 'dart:js_interop'; import 'dart:isolate'; // These values must be kept in sync with developer/timeline.dart. @@ -18,12 +19,55 @@ const int _flowStepPatch = 10; const int _flowEndPatch = 11; +@JS('debugger') +external void _jsDebugger(); + +@JS('performance') +external JSAny? get _jsPerformance; + +@JS('JSON') +external JSAny? get _jsJSON; + +extension type _JSPerformance(JSObject performance) { + @JS('measure') + external JSAny? get _measureMethod; + + @JS('mark') + external JSAny? get _markMethod; + + external void measure( + JSString measureName, JSString startMark, JSString endMark); + + external void mark(JSString markName, JSObject markOptions); +} + +extension type _JSJSON(JSObject performance) { + external JSObject parse(JSString string); +} + +_JSPerformance? _performance = (() { + final value = _jsPerformance; + if (value.isA<JSObject>()) { + final performance = _JSPerformance(value as JSObject); + if (performance._measureMethod != null && performance._markMethod != null) { + return performance; + } + } + return null; +})(); + +_JSJSON _json = (() { + final value = _jsJSON; + if (value.isA<JSObject>()) { + return value as _JSJSON; + } + throw UnsupportedError('Missing JSON.parse() support'); +})(); + @patch @pragma('dart2js:tryInline') bool debugger({bool when = true, String? message}) { - if (when) { - JS('', 'debugger'); - } + if (when) _jsDebugger(); return when; } @@ -69,9 +113,7 @@ @patch bool _isDartStreamEnabled() { - // Timeline requires performance.measure API. - return JS('bool', r'typeof performance !== "undefined"') && - JS('bool', r'typeof performance.measure !== "undefined"'); + return _performance != null; } @patch @@ -156,23 +198,17 @@ _incrementEventCount(currentEventName); currentEventName = _postfixWithCount(currentEventName); } - final markOptions = JS('', '{detail: JSON.parse(#)}', argumentsAsJson); // Start by creating a mark event. - JS('', 'performance.mark(#, #)', currentEventName, markOptions); + _performance!.mark(currentEventName.toJS, _json.parse(argumentsAsJson.toJS)); // If it's an end event, then create a measurement from the most recent begin // event with the same name. if (isEndEvent) { final beginEventName = _createEventName( taskId: taskId, name: name, isBeginEvent: true, isEndEvent: false); - JS( - '', - 'performance.measure(#, #, #)', - name, - _postfixWithCount(beginEventName), - currentEventName, - ); + _performance!.measure(name.toJS, _postfixWithCount(beginEventName).toJS, + currentEventName.toJS); _decrementEventCount(beginEventName); } }
diff --git a/sdk/lib/_internal/wasm/lib/developer.dart b/sdk/lib/_internal/wasm/lib/developer.dart deleted file mode 100644 index efe07b2..0000000 --- a/sdk/lib/_internal/wasm/lib/developer.dart +++ /dev/null
@@ -1,70 +0,0 @@ -// Copyright (c) 2022, 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. - -// This is a stub implementation of `dart:developer`. - -import "dart:_internal" show patch; - -import "dart:async" show Zone; - -// Stubs for `developer.dart`. - -@patch -bool debugger({bool when = true, String? message}) => when; - -@patch -Object? inspect(Object? object) => object; - -@patch -void log(String message, - {DateTime? time, - int? sequenceNumber, - int level = 0, - String name = '', - Zone? zone, - Object? error, - StackTrace? stackTrace}) {} - -@patch -int get reachabilityBarrier => 0; - -@patch -bool get extensionStreamHasListener => false; - -@patch -void _postEvent(String eventKind, String eventData) {} - -@patch -ServiceExtensionHandler? _lookupExtension(String method) => null; - -@patch -_registerExtension(String method, ServiceExtensionHandler handler) {} - -// Stubs for `timeline.dart`. - -@patch -bool _isDartStreamEnabled() => false; - -@patch -int _getTraceClock() => _traceClock++; - -int _traceClock = 0; - -@patch -int _getNextTaskId() => 0; - -@patch -void _reportTaskEvent( - int taskId, int flowId, int type, String name, String argumentsAsJson) {} - -@patch -abstract final class NativeRuntime { - @patch - static String? get buildId => null; - - @patch - static void writeHeapSnapshotToFile(String filepath) => - throw UnsupportedError( - "Generating heap snapshots is not supported on the wasm."); -}
diff --git a/sdk/lib/libraries.json b/sdk/lib/libraries.json index 989e4dd..6821883 100644 --- a/sdk/lib/libraries.json +++ b/sdk/lib/libraries.json
@@ -307,7 +307,7 @@ "developer": { "uri": "developer/developer.dart", "patches": [ - "_internal/wasm/lib/developer.dart" + "_internal/js_runtime/lib/developer_patch.dart" ] }, "ffi": {
diff --git a/sdk/lib/libraries.yaml b/sdk/lib/libraries.yaml index e5b4c23..5e44a20 100644 --- a/sdk/lib/libraries.yaml +++ b/sdk/lib/libraries.yaml
@@ -247,7 +247,7 @@ developer: uri: developer/developer.dart patches: - - _internal/wasm/lib/developer.dart + - _internal/js_runtime/lib/developer_patch.dart ffi: uri: "ffi/ffi.dart" patches:
diff --git a/tests/lib/lib.status b/tests/lib/lib.status index 5d7532c..fc812a2 100644 --- a/tests/lib/lib.status +++ b/tests/lib/lib.status
@@ -9,7 +9,6 @@ [ $compiler == dart2wasm ] async/stream_periodic3_test: Skip # Flaky, issue 50901 -developer/*: SkipByDesign fix_data_tests/*: SkipByDesign html/*: SkipByDesign # dart:html not supported on dart2wasm isolate/*: SkipByDesign
diff --git a/tools/VERSION b/tools/VERSION index b7f1022..cdbb07b 100644 --- a/tools/VERSION +++ b/tools/VERSION
@@ -27,5 +27,5 @@ MAJOR 3 MINOR 4 PATCH 0 -PRERELEASE 176 +PRERELEASE 177 PRERELEASE_PATCH 0
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json index 6016236..f2087be 100644 --- a/tools/bots/test_matrix.json +++ b/tools/bots/test_matrix.json
@@ -467,7 +467,7 @@ "dart2wasm-options": [ "-O0" ], - "timeout": 240 + "timeout": 60 } }, "dart2wasm-(linux|mac|win)-optimized-(d8|jsshell|jsc|chrome|firefox)": { @@ -476,7 +476,7 @@ "-O1" ], "host-asserts": false, - "timeout": 240 + "timeout": 60 } }, "dart2wasm-(linux|mac|win)-jscm-(d8|jsshell|jsc|chrome|firefox)": { @@ -486,7 +486,7 @@ "--js-compatibility" ], "host-asserts": true, - "timeout": 240 + "timeout": 60 } }, "vm-aot-android-(debug|product|release)-arm_x64": {
diff --git a/tools/gn.py b/tools/gn.py index d5f10e4..9a77144b 100755 --- a/tools/gn.py +++ b/tools/gn.py
@@ -412,7 +412,8 @@ print("Crashpad is only supported on Windows") return False if os.environ.get('RBE_cfg') == None and \ - socket.getfqdn().endswith('.corp.google.com') and \ + (socket.getfqdn().endswith('.corp.google.com') or + socket.getfqdn().endswith('.c.googlers.com')) and \ sys.platform in ['linux']: print('You can speed up your build by following: go/dart-rbe') if not args.rbe and not args.goma: