Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JSC] Use int32 serialization for double stringifying in JSStringJoiner #14900

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ JSC_DEFINE_HOST_FUNCTION(arrayProtoFuncToString, (JSGlobalObject* globalObject,
RETURN_IF_EXCEPTION(scope, encodedJSValue());

Integrity::auditStructureID(thisObject->structureID());
if (!canUseDefaultArrayJoinForToString(thisObject)) {
if (UNLIKELY(!canUseDefaultArrayJoinForToString(thisObject))) {
// 2. Let func be the result of calling the [[Get]] internal method of array with argument "join".
JSValue function = thisObject->get(globalObject, vm.propertyNames->join);
RETURN_IF_EXCEPTION(scope, encodedJSValue());
Expand Down
5 changes: 4 additions & 1 deletion Source/JavaScriptCore/runtime/JSStringJoiner.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ ALWAYS_INLINE void JSStringJoiner::appendNumber(VM& vm, int32_t value)

ALWAYS_INLINE void JSStringJoiner::appendNumber(VM& vm, double value)
{
append8Bit(vm.numericStrings.add(value));
if (canBeStrictInt32(value))
appendNumber(vm, static_cast<int32_t>(value));
else
append8Bit(vm.numericStrings.add(value));
}

} // namespace JSC