mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
![Aske Simon Christensen](/assets/img/avatar_default.png)
This adds basic infrastructure for a stringref implementation in dart2wasm: - A `--[no-]stringref` option to the compiler - An option in the `WasmTarget`, controlling the name of the target - Separate sets of patch files for the two targets - Separate platform dill files for the two targets For now, the patch file contents are the same, and the compiler flag is not used by the backend (only by the `dart2wasm` script to select the appropriate platform dill file). Both of these will change as the implementation progresses. Tested: ci + manual check that the option selects the correct dill Change-Id: I2c9bb95ba06fd3de3f7007703ef545e3f0c728ba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310621 Commit-Queue: Aske Simon Christensen <askesc@google.com> Reviewed-by: Ömer Ağacan <omersa@google.com>
87 lines
2.3 KiB
Plaintext
87 lines
2.3 KiB
Plaintext
# 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",
|
|
]
|
|
}
|
|
|
|
wasm_module("ffi_native_test_wasm_module") {
|
|
module_name = "ffi_native_test_module"
|
|
}
|
|
|
|
group("test_wasm_modules") {
|
|
deps = [ ":ffi_native_test_wasm_module" ]
|
|
}
|