Skip to content

Commit 11dc254

Browse files
rcorsiawesomekling
authored andcommitted
LibJS: Add missing internal object string printing for debugging
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.
1 parent 7260159 commit 11dc254

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Libraries/LibJS/Runtime/Value.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,8 @@ String Value::to_string_without_side_effects() const
386386
case EMPTY_TAG:
387387
return "<empty>"_string;
388388
default:
389+
if (is_cell())
390+
return String::formatted("[internal object {}]", as_cell().class_name()).release_value();
389391
VERIFY_NOT_REACHED();
390392
}
391393
}
@@ -417,6 +419,8 @@ Utf16String Value::to_utf16_string_without_side_effects() const
417419
case EMPTY_TAG:
418420
return "<empty>"_utf16;
419421
default:
422+
if (is_cell())
423+
return Utf16String::formatted("[internal object {}]", as_cell().class_name());
420424
VERIFY_NOT_REACHED();
421425
}
422426
}

0 commit comments

Comments
 (0)