Commit 3386d841 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[bazel] Improve v8_torque rule

- Creates v8root to reconcile support with blaze
- Adds -m32 flag for 32 bit architectures

No-Try: true
Bug: v8:11234
Change-Id: I1c0b68b92922ee00cbfb960625c7be62445f636a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2987834Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75404}
parent 096faa3a
......@@ -10,6 +10,7 @@ load(
"v8_custom_config",
"v8_flag",
"v8_int",
"v8_string",
"v8_library",
"v8_torque",
"v8_mksnapshot",
......@@ -58,6 +59,11 @@ config_setting(
},
)
selects.config_setting_group(
name = "is_32bits",
match_any = [":is_ia32", ":is_arm"],
)
config_setting(
name = "is_linux",
constraint_values = ["@platforms//os:linux"],
......@@ -105,6 +111,8 @@ config_setting(
# Flags
# =================================================
v8_string(name = "v8_root", default = ".")
v8_flag(name = "v8_annotate_torque_ir")
v8_flag(name = "v8_enable_lazy_source_positions", default = True)
v8_flag(name = "v8_enable_minor_mc", default = True)
......@@ -2612,6 +2620,13 @@ v8_torque(
"objects-body-descriptors-inl.inc",
"objects-printer.cc",
],
args = select({
":is_v8_annotate_torque_ir": [ "-annotate-ir" ],
"//conditions:default": [],
}) + select({
":is_32bits": [ "-m32" ],
"//conditions:default": [],
}),
)
genrule(
......
......@@ -148,20 +148,24 @@ def v8_library(
)
def _torque_impl(ctx):
v8root = ctx.attr.v8root[FlagInfo].value
# Arguments
args = []
args += ctx.attr.args
args.append("-o")
args.append(ctx.genfiles_dir.path + "/torque-generated")
args.append(ctx.bin_dir.path + "/torque-generated")
args.append("-strip-v8-root")
args.append("-v8-root")
args.append(".")
if ctx.attr._v8_annotate_torque_ir[FlagInfo].value:
args.append("-annotate-ir")
args.append(v8root)
# Sources
args += [f.path for f in ctx.files.srcs]
# Generate/declare output files
outs = []
for src in ctx.files.srcs:
root, period, ext = src.path.rpartition(".")
# Strip v8root
if root[:len(v8root)] == v8root:
root = root[len(v8root):]
file = "torque-generated/" + root
outs.append(ctx.actions.declare_file(file + "-tq-csa.cc"))
outs.append(ctx.actions.declare_file(file + "-tq-csa.h"))
......@@ -189,7 +193,8 @@ v8_torque = rule(
executable = True,
cfg = "host",
),
"_v8_annotate_torque_ir": attr.label(default = ":v8_annotate_torque_ir"),
"args": attr.string_list(),
"v8root": attr.label(default = ":v8_root"),
},
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment