mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
9e37c2b480
The purpose of the wasm_js_compatibility target is to facilitate experiments with a JS compatibility mode for Dart2Wasm. Initially, we're just going to focus on typed data, but this will give us a place to experiment with moving List and String to JS as well. In addition, someday down the road we hope to experiment with two additional compatibility changes: 1) Exclusively using double for all Dart numbers 2) Allowing undefined to flow as null. The two major benefits of this approach are: 1) Much faster JS interop 2) To make it easier to bring up Dart2JS applications on Dart2Wasm The only downside will be access overhead on the Wasm side, but the JS builtins proposal could potentially bring us close to parity with Wasm builtins someday. Tested: Wasm specific trivial refactor. Change-Id: I2c09426b6999507c1de6e584e9bc7072a088bda9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313240 Commit-Queue: Joshua Litt <joshualitt@google.com> Reviewed-by: Ömer Ağacan <omersa@google.com> Reviewed-by: William Hesse <whesse@google.com>
104 lines
2.7 KiB
Text
104 lines
2.7 KiB
Text
# 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.
|
|
|
|
import("../aot_snapshot.gni")
|
|
import("../compile_platform.gni")
|
|
|
|
sdk_root = "../../sdk"
|
|
|
|
template("wasm_module") {
|
|
action(target_name) {
|
|
script = rebase_path("//build/gn_run_binary.py")
|
|
args = [
|
|
"compiled_action",
|
|
rebase_path("//third_party/emsdk/upstream/emscripten/emcc"),
|
|
"--no-entry",
|
|
rebase_path("//tests/web/wasm/${invoker.module_name}.c"),
|
|
"-o",
|
|
rebase_path("$root_out_dir/wasm/${invoker.module_name}.wasm"),
|
|
"-O",
|
|
]
|
|
outputs = [ "$root_out_dir/wasm/${invoker.module_name}.wasm" ]
|
|
}
|
|
}
|
|
|
|
aot_snapshot("dart2wasm_snapshot") {
|
|
main_dart = "../../pkg/dart2wasm/bin/dart2wasm.dart"
|
|
name = "dart2wasm"
|
|
}
|
|
|
|
aot_snapshot("dart2wasm_asserts_snapshot") {
|
|
main_dart = "../../pkg/dart2wasm/bin/dart2wasm.dart"
|
|
name = "dart2wasm_asserts"
|
|
gen_kernel_args = [ "--enable-asserts" ]
|
|
gen_snapshot_args = [ "--enable-asserts" ]
|
|
}
|
|
|
|
aot_snapshot("dart2wasm_product_snapshot") {
|
|
main_dart = "../../pkg/dart2wasm/bin/dart2wasm.dart"
|
|
name = "dart2wasm_product"
|
|
force_product_mode = true
|
|
}
|
|
|
|
compile_platform("compile_dart2wasm_platform") {
|
|
single_root_scheme = "org-dartlang-sdk"
|
|
single_root_base = rebase_path("$sdk_root/")
|
|
libraries_specification_uri = "org-dartlang-sdk:///lib/libraries.json"
|
|
|
|
outputs = [
|
|
"$root_out_dir/dart2wasm_platform.dill",
|
|
"$root_out_dir/dart2wasm_outline.dill",
|
|
]
|
|
|
|
args = [
|
|
"--target=dart2wasm",
|
|
"--no-defines",
|
|
"dart:core",
|
|
"--nnbd-strong",
|
|
]
|
|
}
|
|
|
|
compile_platform("compile_dart2wasm_stringref_platform") {
|
|
single_root_scheme = "org-dartlang-sdk"
|
|
single_root_base = rebase_path("$sdk_root/")
|
|
libraries_specification_uri = "org-dartlang-sdk:///lib/libraries.json"
|
|
|
|
outputs = [
|
|
"$root_out_dir/dart2wasm_stringref_platform.dill",
|
|
"$root_out_dir/dart2wasm_stringref_outline.dill",
|
|
]
|
|
|
|
args = [
|
|
"--target=dart2wasm_stringref",
|
|
"--no-defines",
|
|
"dart:core",
|
|
"--nnbd-strong",
|
|
]
|
|
}
|
|
|
|
compile_platform("compile_dart2wasm_js_compatibility_platform") {
|
|
single_root_scheme = "org-dartlang-sdk"
|
|
single_root_base = rebase_path("$sdk_root/")
|
|
libraries_specification_uri = "org-dartlang-sdk:///lib/libraries.json"
|
|
|
|
outputs = [
|
|
"$root_out_dir/dart2wasm_js_compatibility_platform.dill",
|
|
"$root_out_dir/dart2wasm_js_compatibility_outline.dill",
|
|
]
|
|
|
|
args = [
|
|
"--target=dart2wasm_js_compatibility",
|
|
"--no-defines",
|
|
"dart:core",
|
|
"--nnbd-strong",
|
|
]
|
|
}
|
|
|
|
wasm_module("ffi_native_test_wasm_module") {
|
|
module_name = "ffi_native_test_module"
|
|
}
|
|
|
|
group("test_wasm_modules") {
|
|
deps = [ ":ffi_native_test_wasm_module" ]
|
|
}
|