mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibJS: Show label names & targets in bytecode instruction serialization
This commit is contained in:
parent
702977373c
commit
2d6bc21a33
Notes:
github-actions[bot]
2025-11-30 10:54:54 +00:00
Author: https://github.com/awesomekling
Commit: 2d6bc21a33
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6977
1 changed files with 47 additions and 0 deletions
|
|
@ -431,6 +431,42 @@ def generate_to_byte_string_impl(op: OpDef) -> str:
|
|||
lines.append("")
|
||||
continue
|
||||
|
||||
if t == "Label":
|
||||
lines.append(f" if ({count_name} != 0) {{")
|
||||
lines.append(" StringBuilder list_builder;")
|
||||
lines.append(f' list_builder.appendff("{{}}:[", "{label}"sv);')
|
||||
lines.append(" bool first_elem = true;")
|
||||
lines.append(f" for (size_t i = 0; i < {count_name}; ++i) {{")
|
||||
lines.append(" if (!first_elem)")
|
||||
lines.append(' list_builder.append(", "sv);')
|
||||
lines.append(" first_elem = false;")
|
||||
lines.append(f' list_builder.appendff("{{}}", {f.name}[i]);')
|
||||
lines.append(" }")
|
||||
lines.append(" list_builder.append(']');")
|
||||
lines.append(" append_piece(list_builder.to_byte_string());")
|
||||
lines.append(" }")
|
||||
lines.append("")
|
||||
continue
|
||||
|
||||
if t == "Optional<Label>":
|
||||
lines.append(f" if ({count_name} != 0) {{")
|
||||
lines.append(" StringBuilder list_builder;")
|
||||
lines.append(f' list_builder.appendff("{{}}:[", "{label}"sv);')
|
||||
lines.append(" bool first_elem = true;")
|
||||
lines.append(f" for (size_t i = 0; i < {count_name}; ++i) {{")
|
||||
lines.append(f" if (!{f.name}[i].has_value())")
|
||||
lines.append(" continue;")
|
||||
lines.append(" if (!first_elem)")
|
||||
lines.append(' list_builder.append(", "sv);')
|
||||
lines.append(" first_elem = false;")
|
||||
lines.append(f' list_builder.appendff("{{}}", {f.name}[i].value());')
|
||||
lines.append(" }")
|
||||
lines.append(" list_builder.append(']');")
|
||||
lines.append(" append_piece(list_builder.to_byte_string());")
|
||||
lines.append(" }")
|
||||
lines.append("")
|
||||
continue
|
||||
|
||||
# other array types not printed
|
||||
continue
|
||||
|
||||
|
|
@ -445,6 +481,17 @@ def generate_to_byte_string_impl(op: OpDef) -> str:
|
|||
lines.append("")
|
||||
continue
|
||||
|
||||
if t == "Label":
|
||||
lines.append(f' append_piece(ByteString::formatted("{label}:{{}}", {f.name}));')
|
||||
lines.append("")
|
||||
continue
|
||||
|
||||
if t == "Optional<Label>":
|
||||
lines.append(f" if ({f.name}.has_value())")
|
||||
lines.append(f' append_piece(ByteString::formatted("{label}:{{}}", {f.name}.value()));')
|
||||
lines.append("")
|
||||
continue
|
||||
|
||||
if t == "IdentifierTableIndex":
|
||||
lines.append(f" append_piece(executable.identifier_table->get({f.name}));")
|
||||
lines.append("")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue