Skip to content
Open
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
6 changes: 6 additions & 0 deletions Source/JavaScriptCore/runtime/MathCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ ALWAYS_INLINE int32_t toInt32(double number)
int32_t result = 0;
__asm__ ("fjcvtzs %w0, %d1" : "=r" (result) : "w" (number) : "cc");
return result;
#elif CPU(X86_64) && COMPILER(GCC_COMPATIBLE)
int32_t result;
__asm__ ("cvttsd2si %1, %0" : "=r" (result) : "x" (number));
if (static_cast<double>(result) != number)
return toIntImpl<int32_t>(number);
return result;
#else
return toIntImpl<int32_t>(number);
#endif
Expand Down
7 changes: 0 additions & 7 deletions Source/JavaScriptCore/runtime/TypedArrayAdaptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,7 @@ struct IntegralTypedArrayAdaptor {

static Type toNativeFromDouble(double value)
{
#if HAVE(FJCVTZS_INSTRUCTION)
return static_cast<Type>(toInt32(value));
#else
int32_t result = static_cast<int32_t>(value);
if (static_cast<double>(result) != value)
result = toInt32(value);
return static_cast<Type>(result);
#endif
}

static constexpr Type toNativeFromUndefined()
Expand Down