LibJS: Add missing internal object string printing for debugging
Some checks failed
Close stale PRs / stale (push) Has been cancelled
Package the js repl as a binary artifact / Linux, arm64 (push) Has been cancelled
Package the js repl as a binary artifact / macOS, arm64 (push) Has been cancelled
Package the js repl as a binary artifact / Linux, x86_64 (push) Has been cancelled
Label PRs with merge conflicts / auto-labeler (push) Has been cancelled
Nightly Lagom / Linux, arm64, Distribution, Clang (push) Has been cancelled
Nightly Lagom / macOS, arm64, Distribution, Clang (push) Has been cancelled
Nightly Lagom / Linux, arm64, Sanitizer, Clang (push) Has been cancelled
Nightly Lagom / macOS, arm64, Sanitizer, Swift (push) Has been cancelled
Nightly Lagom / Linux, x86_64, Distribution, GNU (push) Has been cancelled
Nightly Lagom / Linux, x86_64, Sanitizer, Swift (push) Has been cancelled
Nightly Lagom / Windows, x86_64, Windows_Sanitizer_CI, ClangCL (push) Has been cancelled
Nightly Lagom / Flatpak aarch64 (push) Has been cancelled
Nightly Lagom / Flatpak x86_64 (push) Has been cancelled

When testing with JS_BYTECODE_DEBUG macro defined or using the All_Debug
profile, internal objects were not known in Value class to the function
Value::to_string_without_side_effects leading to a VERIFICATION FAILED
when running the test-js or test-web programs.

Internal objects are known in the Value class as cells, and do not have
a dedicated tag to identify them. Internal objects are detected using
is_cell function call, but only after all other types have been
checked as other types of non-internal objects can also be cells.

Both the String and Utf16String version of the function were updated.
This commit is contained in:
Rocco Corsi
2025-11-03 21:07:22 -05:00
committed by Andreas Kling
parent 7260159b8f
commit 11dc254d27
Notes: github-actions[bot] 2025-11-30 18:23:47 +00:00

View File

@@ -386,6 +386,8 @@ String Value::to_string_without_side_effects() const
case EMPTY_TAG:
return "<empty>"_string;
default:
if (is_cell())
return String::formatted("[internal object {}]", as_cell().class_name()).release_value();
VERIFY_NOT_REACHED();
}
}
@@ -417,6 +419,8 @@ Utf16String Value::to_utf16_string_without_side_effects() const
case EMPTY_TAG:
return "<empty>"_utf16;
default:
if (is_cell())
return Utf16String::formatted("[internal object {}]", as_cell().class_name());
VERIFY_NOT_REACHED();
}
}