Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1632)

Unified Diff: runtime/bin/BUILD.gn

Issue 2901163002: Use assembly instead of C array literals to link the core snapshot into the VM. (Closed)
Patch Set: windows Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/toolchain/win/BUILD.gn ('k') | runtime/bin/bin.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/BUILD.gn
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index cde7664bd959f2fb159d3f1421e6a6371bff1fbc..4f30948dc15643e0f1ae14c7252faf25a859d2d0 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -489,43 +489,90 @@ action("generate_snapshot_bin") {
]
}
-action("generate_snapshot_file") {
+# Generates an assembly file defining a given symbol with the bytes from a
+# binary file. Places the symbol in a text section if 'executable' is true,
+# otherwise places the symbol in a read-only data section.
+template("bin_to_assembly") {
+ assert(defined(invoker.deps), "Must define deps")
+ assert(defined(invoker.input), "Must define input binary file")
+ assert(defined(invoker.output), "Must define output assembly file")
+ assert(defined(invoker.symbol), "Must define symbol name")
+ assert(defined(invoker.executable), "Must define boolean executable")
+
+ action(target_name) {
+ deps = invoker.deps
+ script = "../tools/bin_to_assembly.py"
+ args = [
+ "--input",
+ rebase_path(invoker.input),
+ "--output",
+ rebase_path(invoker.output),
+ "--symbol_name",
+ invoker.symbol,
+ "--target_os",
+ target_os,
+ ]
+ if (invoker.executable) {
+ args += [ "--executable" ]
+ }
+ inputs = [
+ script,
+ invoker.input,
+ ]
+ outputs = [
+ invoker.output,
+ ]
+ }
+}
+
+bin_to_assembly("vm_snapshot_data_assembly") {
deps = [
":generate_snapshot_bin",
]
+ input = "$target_gen_dir/vm_isolate_snapshot.bin"
+ output = "$target_gen_dir/vm_snapshot_data.S"
+ symbol = "kDartVmSnapshotData"
+ executable = false
+}
- snapshot_in_cc_file = "snapshot_in.cc"
- inputs = [
- "../tools/create_snapshot_file.py",
- snapshot_in_cc_file,
- "$target_gen_dir/vm_isolate_snapshot.bin",
- "$target_gen_dir/isolate_snapshot.bin",
- ]
- output = "$root_gen_dir/dart_snapshot.cc"
- outputs = [
- output,
- ]
+bin_to_assembly("vm_snapshot_instructions_assembly") {
+ deps = []
+ input = "../tools/empty.bin"
+ output = "$target_gen_dir/vm_snapshot_instructions.S"
+ symbol = "kDartVmSnapshotInstructions"
+ executable = true
+}
- script = "../tools/create_snapshot_file.py"
- args = [
- "--vm_input_bin",
- rebase_path("$target_gen_dir/vm_isolate_snapshot.bin"),
- "--input_bin",
- rebase_path("$target_gen_dir/isolate_snapshot.bin"),
- "--input_cc",
- rebase_path(snapshot_in_cc_file),
- "--output",
- rebase_path(output),
+bin_to_assembly("isolate_snapshot_data_assembly") {
+ deps = [
+ ":generate_snapshot_bin",
]
+ input = "$target_gen_dir/isolate_snapshot.bin"
+ output = "$target_gen_dir/isolate_snapshot_data.S"
+ symbol = "kDartCoreIsolateSnapshotData"
+ executable = false
}
-source_set("dart_snapshot_cc") {
- sources = [
- "$root_gen_dir/dart_snapshot.cc",
- ]
+bin_to_assembly("isolate_snapshot_instructions_assembly") {
+ deps = []
+ input = "../tools/empty.bin"
+ output = "$target_gen_dir/isolate_snapshot_instructions.S"
+ symbol = "kDartCoreIsolateSnapshotInstructions"
+ executable = true
+}
+source_set("dart_snapshot_cc") {
deps = [
- ":generate_snapshot_file",
+ ":isolate_snapshot_data_assembly",
+ ":isolate_snapshot_instructions_assembly",
+ ":vm_snapshot_data_assembly",
+ ":vm_snapshot_instructions_assembly",
+ ]
+ sources = [
+ "$target_gen_dir/isolate_snapshot_data.S",
+ "$target_gen_dir/isolate_snapshot_instructions.S",
+ "$target_gen_dir/vm_snapshot_data.S",
+ "$target_gen_dir/vm_snapshot_instructions.S",
]
}
« no previous file with comments | « build/toolchain/win/BUILD.gn ('k') | runtime/bin/bin.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698