webkit2gtk: update to 2.34.0

This commit is contained in:
q66 2021-10-14 21:52:06 +02:00
parent e3b8a8d4d5
commit 15a5f952ee
3 changed files with 278 additions and 296 deletions

View file

@ -1,205 +1,243 @@
From 1e7d7e7361189d40ace22d6ff2e2139a4e6759f0 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Sat, 31 Jul 2021 22:31:52 +0200
Subject: [PATCH 2/2] some big endian rendering fixes
Original source: Jacek Piszczek <jacek.piszczek@runbox.com>
Source: Jacek Piszczek <jacek.piszczek@runbox.com>
---
.../platform/graphics/ImageBufferBackend.cpp | 109 ++++++++++++++++++
.../platform/graphics/ImageBufferBackend.h | 3 +
2 files changed, 112 insertions(+)
diff --git a/Source/WebCore/platform/graphics/ImageBufferBackend.cpp b/Source/WebCore/platform/graphics/ImageBufferBackend.cpp
index 9394e7bf..e704be6b 100644
--- a/Source/WebCore/platform/graphics/ImageBufferBackend.cpp
+++ b/Source/WebCore/platform/graphics/ImageBufferBackend.cpp
@@ -110,7 +110,11 @@ Vector<uint8_t> ImageBufferBackend::toBGRAData(void* data) const
diff --git a/Source/WebCore/platform/graphics/PixelBufferConversion.cpp b/Source/WebCore/platform/graphics/PixelBufferConversion.cpp
index 9acf304d..618b7b26 100644
--- a/Source/WebCore/platform/graphics/PixelBufferConversion.cpp
+++ b/Source/WebCore/platform/graphics/PixelBufferConversion.cpp
@@ -140,9 +140,17 @@ static void convertImagePixelsAccelerated(const ConstPixelBufferConversionView&
enum class PixelFormatConversion { None, Permute };
static inline void copyPremultipliedToPremultiplied(PixelFormat srcPixelFormat, const uint8_t* srcPixel, PixelFormat destPixelFormat, uint8_t* destPixel)
template<PixelFormatConversion pixelFormatConversion>
+#if CPU(BIG_ENDIAN)
+static void convertSinglePixelPremultipliedToPremultiplied(PixelFormat sourcePixelFormat, const uint8_t* sourcePixel, PixelFormat destinationPixelFormat, uint8_t* destinationPixel)
+#else
static void convertSinglePixelPremultipliedToPremultiplied(const uint8_t* sourcePixel, uint8_t* destinationPixel)
+#endif
{
+#if CPU(BIG_ENDIAN)
+ uint8_t alpha = srcPixel[srcPixelFormat == PixelFormat::ARGB8 ? 0 : 3];
+ uint8_t alpha = sourcePixel[sourcePixelFormat == PixelFormat::ARGB8 ? 0 : 3];
+#else
uint8_t alpha = srcPixel[3];
uint8_t alpha = sourcePixel[3];
+#endif
if (!alpha) {
reinterpret_cast<uint32_t*>(destPixel)[0] = 0;
reinterpret_cast<uint32_t*>(destinationPixel)[0] = 0;
return;
@@ -121,21 +125,73 @@ static inline void copyPremultipliedToPremultiplied(PixelFormat srcPixelFormat,
return;
}
@@ -151,23 +158,81 @@ static void convertSinglePixelPremultipliedToPremultiplied(const uint8_t* source
if constexpr (pixelFormatConversion == PixelFormatConversion::None)
reinterpret_cast<uint32_t*>(destinationPixel)[0] = reinterpret_cast<const uint32_t*>(sourcePixel)[0];
else {
+#if CPU(BIG_ENDIAN)
+ // Swap pixel channels ARGB <-> RGBA.
+ if (destPixelFormat == PixelFormat::ARGB8)
+ {
+ destPixel[0] = srcPixel[3];
+ destPixel[1] = srcPixel[0];
+ destPixel[2] = srcPixel[1];
+ destPixel[3] = srcPixel[2];
+ }
+ else
+ {
+ destPixel[0] = srcPixel[1];
+ destPixel[1] = srcPixel[2];
+ destPixel[2] = srcPixel[3];
+ destPixel[3] = srcPixel[0];
+ }
+#else
// Swap pixel channels BGRA <-> RGBA.
destPixel[0] = srcPixel[2];
destPixel[1] = srcPixel[1];
destPixel[2] = srcPixel[0];
destPixel[3] = srcPixel[3];
+#endif
}
static inline void copyPremultipliedToUnpremultiplied(PixelFormat srcPixelFormat, const uint8_t* srcPixel, PixelFormat destPixelFormat, uint8_t* destPixel)
{
+#if CPU(BIG_ENDIAN)
+ uint8_t alpha = srcPixel[srcPixelFormat == PixelFormat::ARGB8 ? 0 : 3];
+#else
uint8_t alpha = srcPixel[3];
+#endif
+
if (!alpha || alpha == 255) {
copyPremultipliedToPremultiplied(srcPixelFormat, srcPixel, destPixelFormat, destPixel);
return;
}
+#if CPU(BIG_ENDIAN)
+ if (srcPixelFormat == destPixelFormat) {
+ if (srcPixelFormat == PixelFormat::ARGB8) {
+ destPixel[0] = alpha;
+ destPixel[1] = (srcPixel[1] * 255) / alpha;
+ destPixel[2] = (srcPixel[2] * 255) / alpha;
+ destPixel[3] = (srcPixel[3] * 255) / alpha;
+ return;
+ // Swap pixel channels ARGB <-> RGBA.
+ if (destinationPixelFormat == PixelFormat::ARGB8)
+ {
+ destinationPixel[0] = sourcePixel[3];
+ destinationPixel[1] = sourcePixel[0];
+ destinationPixel[2] = sourcePixel[1];
+ destinationPixel[3] = sourcePixel[2];
+ }
+ destPixel[0] = (srcPixel[0] * 255) / alpha;
+ destPixel[1] = (srcPixel[1] * 255) / alpha;
+ destPixel[2] = (srcPixel[2] * 255) / alpha;
+ destPixel[3] = alpha;
+ return;
+ }
+
+ if (srcPixelFormat == PixelFormat::ARGB8) {
+ destPixel[0] = (srcPixel[1] * 255) / alpha;
+ destPixel[1] = (srcPixel[2] * 255) / alpha;
+ destPixel[2] = (srcPixel[3] * 255) / alpha;
+ destPixel[3] = alpha;
+ }
+ else {
+ destPixel[0] = alpha;
+ destPixel[1] = (srcPixel[0] * 255) / alpha;
+ destPixel[2] = (srcPixel[1] * 255) / alpha;
+ destPixel[3] = (srcPixel[2] * 255) / alpha;
+ }
+#else
if (srcPixelFormat == destPixelFormat) {
destPixel[0] = (srcPixel[0] * 255) / alpha;
destPixel[1] = (srcPixel[1] * 255) / alpha;
@@ -149,16 +205,51 @@ static inline void copyPremultipliedToUnpremultiplied(PixelFormat srcPixelFormat
destPixel[1] = (srcPixel[1] * 255) / alpha;
destPixel[2] = (srcPixel[0] * 255) / alpha;
destPixel[3] = alpha;
+#endif
}
static inline void copyUnpremultipliedToPremultiplied(PixelFormat srcPixelFormat, const uint8_t* srcPixel, PixelFormat destPixelFormat, uint8_t* destPixel)
{
+#if CPU(BIG_ENDIAN)
+ uint8_t alpha = srcPixel[srcPixelFormat == PixelFormat::ARGB8 ? 0 : 3];
+#else
uint8_t alpha = srcPixel[3];
+#endif
+
if (!alpha || alpha == 255) {
copyPremultipliedToPremultiplied(srcPixelFormat, srcPixel, destPixelFormat, destPixel);
return;
}
+#if CPU(BIG_ENDIAN)
+ if (srcPixelFormat == destPixelFormat) {
+ if (srcPixelFormat == PixelFormat::ARGB8) {
+ destPixel[0] = alpha;
+ destPixel[1] = (srcPixel[1] * alpha + 254) / 255;
+ destPixel[2] = (srcPixel[2] * alpha + 254) / 255;
+ destPixel[3] = (srcPixel[3] * alpha + 254) / 255;
+ return;
+ else
+ {
+ destinationPixel[0] = sourcePixel[1];
+ destinationPixel[1] = sourcePixel[2];
+ destinationPixel[2] = sourcePixel[3];
+ destinationPixel[3] = sourcePixel[0];
+ }
+ destPixel[0] = (srcPixel[0] * alpha + 254) / 255;
+ destPixel[1] = (srcPixel[1] * alpha + 254) / 255;
+ destPixel[2] = (srcPixel[2] * alpha + 254) / 255;
+ destPixel[3] = alpha;
+ return;
+ }
+
+ if (srcPixelFormat == PixelFormat::ARGB8) {
+ destPixel[0] = (srcPixel[1] * alpha + 254) / 255;
+ destPixel[1] = (srcPixel[2] * alpha + 254) / 255;
+ destPixel[2] = (srcPixel[3] * alpha + 254) / 255;
+ destPixel[3] = alpha;
+ return;
+ }
+
+ destPixel[0] = alpha;
+ destPixel[1] = (srcPixel[0] * alpha + 254) / 255;
+ destPixel[2] = (srcPixel[1] * alpha + 254) / 255;
+ destPixel[3] = (srcPixel[2] * alpha + 254) / 255;
+#else
if (srcPixelFormat == destPixelFormat) {
destPixel[0] = (srcPixel[0] * alpha + 254) / 255;
destPixel[1] = (srcPixel[1] * alpha + 254) / 255;
@@ -172,6 +263,7 @@ static inline void copyUnpremultipliedToPremultiplied(PixelFormat srcPixelFormat
destPixel[1] = (srcPixel[1] * alpha + 254) / 255;
destPixel[2] = (srcPixel[0] * alpha + 254) / 255;
destPixel[3] = alpha;
// Swap pixel channels BGRA <-> RGBA.
destinationPixel[0] = sourcePixel[2];
destinationPixel[1] = sourcePixel[1];
destinationPixel[2] = sourcePixel[0];
destinationPixel[3] = sourcePixel[3];
+#endif
}
}
static inline void copyUnpremultipliedToUnpremultiplied(PixelFormat srcPixelFormat, const uint8_t* srcPixel, PixelFormat destPixelFormat, uint8_t* destPixel)
@@ -181,11 +273,27 @@ static inline void copyUnpremultipliedToUnpremultiplied(PixelFormat srcPixelForm
template<PixelFormatConversion pixelFormatConversion>
+#if CPU(BIG_ENDIAN)
+static void convertSinglePixelPremultipliedToUnpremultiplied(PixelFormat sourcePixelFormat, const uint8_t* sourcePixel, PixelFormat destinationPixelFormat, uint8_t* destinationPixel)
+#else
static void convertSinglePixelPremultipliedToUnpremultiplied(const uint8_t* sourcePixel, uint8_t* destinationPixel)
+#endif
{
+#if CPU(BIG_ENDIAN)
+ uint8_t alpha = sourcePixel[sourcePixelFormat == PixelFormat::ARGB8 ? 0 : 3];
+#else
uint8_t alpha = sourcePixel[3];
+#endif
if (!alpha || alpha == 255) {
+#if CPU(BIG_ENDIAN)
+ convertSinglePixelPremultipliedToPremultiplied<pixelFormatConversion>(sourcePixelFormat, sourcePixel, destinationPixelFormat, destinationPixel);
+#else
convertSinglePixelPremultipliedToPremultiplied<pixelFormatConversion>(sourcePixel, destinationPixel);
+#endif
return;
}
+#if CPU(BIG_ENDIAN)
+ // Swap pixel channels ARGB <-> RGBA.
+ if (destPixelFormat == PixelFormat::ARGB8) {
+ destPixel[0] = srcPixel[3];
+ destPixel[1] = srcPixel[0];
+ destPixel[2] = srcPixel[1];
+ destPixel[3] = srcPixel[2];
+ }
+ else {
+ destPixel[0] = srcPixel[1];
+ destPixel[1] = srcPixel[2];
+ destPixel[2] = srcPixel[3];
+ destPixel[3] = srcPixel[0];
+ UNUSED_PARAM(destinationPixelFormat);
+ if constexpr (pixelFormatConversion == PixelFormatConversion::None) {
+ if (sourcePixelFormat == PixelFormat::ARGB8) {
+ destinationPixel[0] = alpha;
+ destinationPixel[1] = (sourcePixel[1] * 255) / alpha;
+ destinationPixel[2] = (sourcePixel[2] * 255) / alpha;
+ destinationPixel[3] = (sourcePixel[3] * 255) / alpha;
+ } else {
+ destinationPixel[0] = (sourcePixel[0] * 255) / alpha;
+ destinationPixel[1] = (sourcePixel[1] * 255) / alpha;
+ destinationPixel[2] = (sourcePixel[2] * 255) / alpha;
+ destinationPixel[3] = alpha;
+ }
+ } else {
+ if (sourcePixelFormat == PixelFormat::ARGB8) {
+ destinationPixel[0] = (sourcePixel[1] * 255) / alpha;
+ destinationPixel[1] = (sourcePixel[2] * 255) / alpha;
+ destinationPixel[2] = (sourcePixel[3] * 255) / alpha;
+ destinationPixel[3] = alpha;
+ } else {
+ destinationPixel[0] = alpha;
+ destinationPixel[1] = (sourcePixel[0] * 255) / alpha;
+ destinationPixel[2] = (sourcePixel[1] * 255) / alpha;
+ destinationPixel[3] = (sourcePixel[2] * 255) / alpha;
+ }
+ }
+#else
// Swap pixel channels BGRA <-> RGBA.
destPixel[0] = srcPixel[2];
destPixel[1] = srcPixel[1];
destPixel[2] = srcPixel[0];
destPixel[3] = srcPixel[3];
if constexpr (pixelFormatConversion == PixelFormatConversion::None) {
destinationPixel[0] = (sourcePixel[0] * 255) / alpha;
destinationPixel[1] = (sourcePixel[1] * 255) / alpha;
@@ -180,17 +245,58 @@ static void convertSinglePixelPremultipliedToUnpremultiplied(const uint8_t* sour
destinationPixel[2] = (sourcePixel[0] * 255) / alpha;
destinationPixel[3] = alpha;
}
+#endif
}
template<void (*copyFunctor)(PixelFormat, const uint8_t*, PixelFormat, uint8_t*)>
@@ -207,6 +315,7 @@ void ImageBufferBackend::copyImagePixels(
AlphaPremultiplication destAlphaFormat, PixelFormat destPixelFormat, unsigned destBytesPerRow, uint8_t* destRows, const IntSize& size) const
template<PixelFormatConversion pixelFormatConversion>
+#if CPU(BIG_ENDIAN)
+static void convertSinglePixelUnpremultipliedToPremultiplied(PixelFormat sourcePixelFormat, const uint8_t* sourcePixel, PixelFormat destinationPixelFormat, uint8_t* destinationPixel)
+#else
static void convertSinglePixelUnpremultipliedToPremultiplied(const uint8_t* sourcePixel, uint8_t* destinationPixel)
+#endif
{
// We don't currently support getting or putting pixel data with deep color buffers.
+#if CPU(BIG_ENDIAN)
+ uint8_t alpha = sourcePixel[sourcePixelFormat == PixelFormat::ARGB8 ? 0 : 3];
+#else
uint8_t alpha = sourcePixel[3];
+#endif
if (!alpha || alpha == 255) {
+#if CPU(BIG_ENDIAN)
+ convertSinglePixelPremultipliedToPremultiplied<pixelFormatConversion>(sourcePixelFormat, sourcePixel, destinationPixelFormat, destinationPixel);
+#else
convertSinglePixelPremultipliedToPremultiplied<pixelFormatConversion>(sourcePixel, destinationPixel);
+#endif
return;
}
+#if CPU(BIG_ENDIAN)
+ UNUSED_PARAM(destinationPixelFormat);
+ if constexpr (pixelFormatConversion == PixelFormatConversion::None) {
+ if (sourcePixelFormat == PixelFormat::ARGB8) {
+ destinationPixel[0] = alpha;
+ destinationPixel[1] = (sourcePixel[1] * alpha + 254) / 255;
+ destinationPixel[2] = (sourcePixel[2] * alpha + 254) / 255;
+ destinationPixel[3] = (sourcePixel[3] * alpha + 254) / 255;
+ } else {
+ destinationPixel[0] = (sourcePixel[0] * alpha + 254) / 255;
+ destinationPixel[1] = (sourcePixel[1] * alpha + 254) / 255;
+ destinationPixel[2] = (sourcePixel[2] * alpha + 254) / 255;
+ destinationPixel[3] = alpha;
+ }
+ } else {
+ if (sourcePixelFormat == PixelFormat::ARGB8) {
+ destinationPixel[0] = (sourcePixel[1] * alpha + 254) / 255;
+ destinationPixel[1] = (sourcePixel[2] * alpha + 254) / 255;
+ destinationPixel[2] = (sourcePixel[3] * alpha + 254) / 255;
+ destinationPixel[3] = alpha;
+ } else {
+ destinationPixel[0] = alpha;
+ destinationPixel[1] = (sourcePixel[0] * alpha + 254) / 255;
+ destinationPixel[2] = (sourcePixel[1] * alpha + 254) / 255;
+ destinationPixel[3] = (sourcePixel[2] * alpha + 254) / 255;
+ }
+ }
+#else
if constexpr (pixelFormatConversion == PixelFormatConversion::None) {
destinationPixel[0] = (sourcePixel[0] * alpha + 254) / 255;
destinationPixel[1] = (sourcePixel[1] * alpha + 254) / 255;
@@ -203,23 +309,49 @@ static void convertSinglePixelUnpremultipliedToPremultiplied(const uint8_t* sour
destinationPixel[2] = (sourcePixel[0] * alpha + 254) / 255;
destinationPixel[3] = alpha;
}
+#endif
}
template<PixelFormatConversion pixelFormatConversion>
+#if CPU(BIG_ENDIAN)
+static void convertSinglePixelUnpremultipliedToUnpremultiplied(PixelFormat sourcePixelFormat, const uint8_t* sourcePixel, PixelFormat destinationPixelFormat, uint8_t* destinationPixel)
+#else
static void convertSinglePixelUnpremultipliedToUnpremultiplied(const uint8_t* sourcePixel, uint8_t* destinationPixel)
+#endif
{
if constexpr (pixelFormatConversion == PixelFormatConversion::None)
reinterpret_cast<uint32_t*>(destinationPixel)[0] = reinterpret_cast<const uint32_t*>(sourcePixel)[0];
else {
+#if CPU(BIG_ENDIAN)
+ UNUSED_PARAM(sourcePixelFormat);
+ // Swap pixel channels ARGB <-> RGBA.
+ if (destinationPixelFormat == PixelFormat::ARGB8) {
+ destinationPixel[0] = sourcePixel[3];
+ destinationPixel[1] = sourcePixel[0];
+ destinationPixel[2] = sourcePixel[1];
+ destinationPixel[3] = sourcePixel[2];
+ }
+ else {
+ destinationPixel[0] = sourcePixel[1];
+ destinationPixel[1] = sourcePixel[2];
+ destinationPixel[2] = sourcePixel[3];
+ destinationPixel[3] = sourcePixel[0];
+ }
+#else
// Swap pixel channels BGRA <-> RGBA.
destinationPixel[0] = sourcePixel[2];
destinationPixel[1] = sourcePixel[1];
destinationPixel[2] = sourcePixel[0];
destinationPixel[3] = sourcePixel[3];
+#endif
}
}
+#if CPU(BIG_ENDIAN)
+template<void (*convertFunctor)(PixelFormat, const uint8_t*, PixelFormat, uint8_t*)>
+#else
template<void (*convertFunctor)(const uint8_t*, uint8_t*)>
+#endif
static void convertImagePixelsUnaccelerated(const ConstPixelBufferConversionView& source, const PixelBufferConversionView& destination, const IntSize& destinationSize)
{
const uint8_t* sourceRows = source.rows;
@@ -228,7 +360,11 @@ static void convertImagePixelsUnaccelerated(const ConstPixelBufferConversionView
size_t bytesPerRow = destinationSize.width() * 4;
for (int y = 0; y < destinationSize.height(); ++y) {
for (size_t x = 0; x < bytesPerRow; x += 4)
+#if CPU(BIG_ENDIAN)
+ convertFunctor(source.format.pixelFormat, &sourceRows[x], destination.format.pixelFormat, &destinationRows[x]);
+#else
convertFunctor(&sourceRows[x], &destinationRows[x]);
+#endif
sourceRows += source.bytesPerRow;
destinationRows += destination.bytesPerRow;
}
@@ -237,6 +373,7 @@ static void convertImagePixelsUnaccelerated(const ConstPixelBufferConversionView
void convertImagePixels(const ConstPixelBufferConversionView& source, const PixelBufferConversionView& destination, const IntSize& destinationSize)
{
// We don't currently support converting pixel data with non-8-bit buffers.
+ // BGRA8 is actually ARGB8 on BIG_ENDIAN.
ASSERT(srcPixelFormat == PixelFormat::RGBA8 || srcPixelFormat == PixelFormat::BGRA8);
ASSERT(destPixelFormat == PixelFormat::RGBA8 || destPixelFormat == PixelFormat::BGRA8);
ASSERT(source.format.pixelFormat == PixelFormat::RGBA8 || source.format.pixelFormat == PixelFormat::BGRA8);
ASSERT(destination.format.pixelFormat == PixelFormat::RGBA8 || destination.format.pixelFormat == PixelFormat::BGRA8);
diff --git a/Source/WebCore/platform/graphics/ImageBufferBackend.h b/Source/WebCore/platform/graphics/ImageBufferBackend.h
index 31ce9775..4c52fa52 100644
--- a/Source/WebCore/platform/graphics/ImageBufferBackend.h
+++ b/Source/WebCore/platform/graphics/ImageBufferBackend.h
@@ -58,6 +58,9 @@ enum class PreserveResolution : uint8_t {
diff --git a/Source/WebCore/platform/graphics/PixelFormat.h b/Source/WebCore/platform/graphics/PixelFormat.h
index 1ca711b8..4a7168f8 100644
--- a/Source/WebCore/platform/graphics/PixelFormat.h
+++ b/Source/WebCore/platform/graphics/PixelFormat.h
@@ -33,6 +33,9 @@ namespace WebCore {
enum class PixelFormat : uint8_t {
RGBA8,
BGRA8,
@ -209,6 +247,3 @@ index 31ce9775..4c52fa52 100644
RGB10,
RGB10A8,
};
--
2.31.1

View file

@ -4,8 +4,56 @@ https://tenfourfox.tenderapp.com/discussions/problems/7505-problems-uploading-to
Updated by @q66.
diff --git Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h
index dbe211d..4da5fbd 100644
diff --git a/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h b/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
index 8b9e57d3..3802e0f2 100644
--- a/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
+++ b/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
@@ -186,3 +186,9 @@
#else
#define OFFLINE_ASM_HAVE_FAST_TLS 0
#endif
+
+#if CPU(BIG_ENDIAN)
+#define OFFLINE_ASM_BIG_ENDIAN 1
+#else
+#define OFFLINE_ASM_BIG_ENDIAN 0
+#endif
diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
index b8a0f205..7afc8f8f 100644
--- a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
+++ b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
@@ -1667,7 +1667,11 @@ llintOpWithMetadata(op_get_by_val, OpGetByVal, macro (size, get, dispatch, metad
.opGetByValNotDouble:
subi ArrayStorageShape, t2
- bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValNotIndexedStorage
+ if BIG_ENDIAN
+ bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValSlow
+ else
+ bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValNotIndexedStorage
+ end
biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t3], .opGetByValSlow
loadi ArrayStorage::m_vector + TagOffset[t3, t1, 8], t2
loadi ArrayStorage::m_vector + PayloadOffset[t3, t1, 8], t1
diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
index c7d1a204..4f33d06d 100644
--- a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
+++ b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
@@ -1751,7 +1751,11 @@ llintOpWithMetadata(op_get_by_val, OpGetByVal, macro (size, get, dispatch, metad
.opGetByValNotDouble:
subi ArrayStorageShape, t2
- bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValNotIndexedStorage
+ if BIG_ENDIAN
+ bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValSlow
+ else
+ bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValNotIndexedStorage
+ end
biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t3], .opGetByValSlow
get(m_dst, t0)
loadq ArrayStorage::m_vector[t3, t1, 8], t2
diff --git a/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h b/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h
index c22c55a0..bc1e55c3 100644
--- a/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h
+++ b/Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h
@@ -28,6 +28,7 @@
@ -56,7 +104,7 @@ index dbe211d..4da5fbd 100644
}
bool setIndex(JSGlobalObject* globalObject, unsigned i, JSValue jsValue)
@@ -172,13 +197,54 @@ public:
@@ -172,13 +197,56 @@ public:
if (isDetached() || i >= m_length)
return false;
@ -94,31 +142,33 @@ index dbe211d..4da5fbd 100644
+#endif
+ }
- static Optional<ElementType> toAdaptorNativeFromValueWithoutCoercion(JSValue jsValue) { return toNativeFromValueWithoutCoercion<Adaptor>(jsValue); }
+ static Optional<ElementType> toAdaptorNativeFromValueWithoutCoercion(JSValue jsValue)
- static std::optional<ElementType> toAdaptorNativeFromValueWithoutCoercion(JSValue jsValue) { return toNativeFromValueWithoutCoercion<Adaptor>(jsValue); }
+ static std::optional<ElementType> toAdaptorNativeFromValueWithoutCoercion(JSValue jsValue)
+ {
+ auto opt = toNativeFromValueWithoutCoercion<Adaptor>(jsValue);
+#if CPU(BIG_ENDIAN)
+ switch (Adaptor::typeValue) {
+ case TypeFloat32:
+ case TypeFloat64:
+ return toNativeFromValueWithoutCoercion<Adaptor>(jsValue);
+ break;
+ default:
+ // typed array views are commonly expected to be little endian views of the underlying data
+ return flipBytes(toNativeFromValueWithoutCoercion<Adaptor>(jsValue));
+ if (!opt)
+ break;
+ return std::optional<ElementType>{flipBytes(*opt)};
+ }
+#else
+ return toNativeFromValueWithoutCoercion<Adaptor>(jsValue);
+#endif
+ return opt;
+ }
void sort()
{
diff --git Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
index 126f33c..0913af5 100644
diff --git a/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h b/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
index 00492c0a..7bb150dc 100644
--- a/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
+++ b/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h
@@ -208,9 +208,36 @@ ALWAYS_INLINE EncodedJSValue genericTypedArrayViewProtoFuncIncludes(VM& vm, JSGl
scope.assertNoException();
scope.assertNoExceptionExceptTermination();
RELEASE_ASSERT(!thisObject->isDetached());
- if (std::isnan(static_cast<double>(*targetOption))) {
@ -156,106 +206,3 @@ index 126f33c..0913af5 100644
return JSValue::encode(jsBoolean(true));
}
} else {
diff --git Source/WTF/wtf/FlipBytes.h Source/WTF/wtf/FlipBytes.h
index 6cd7126..24708f7 100644
--- a/Source/WTF/wtf/FlipBytes.h
+++ b/Source/WTF/wtf/FlipBytes.h
@@ -24,6 +24,7 @@
*/
#pragma once
+#include "Optional.h"
namespace WTF {
@@ -98,6 +99,42 @@ inline T flipBytes(T value)
return T();
}
+template<typename T>
+inline T flipBytes(WTF::Optional<T> value)
+{
+ if (sizeof(*value) == 1)
+ return *value;
+ if (sizeof(*value) == 2) {
+ union {
+ T original;
+ uint16_t word;
+ } u;
+ u.original = *value;
+ u.word = flipBytes(u.word);
+ return u.original;
+ }
+ if (sizeof(*value) == 4) {
+ union {
+ T original;
+ uint32_t word;
+ } u;
+ u.original = *value;
+ u.word = flipBytes(u.word);
+ return u.original;
+ }
+ if (sizeof(*value) == 8) {
+ union {
+ T original;
+ uint64_t word;
+ } u;
+ u.original = *value;
+ u.word = flipBytes(u.word);
+ return u.original;
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return T();
+}
+
template<typename T>
inline T flipBytesIfLittleEndian(T value, bool littleEndian)
{
diff --git a/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h b/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
index 33be4058..1a6d69fd 100644
--- a/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
+++ b/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
@@ -179,3 +179,9 @@
#else
#define OFFLINE_ASM_HAVE_FAST_TLS 0
#endif
+
+#if CPU(BIG_ENDIAN)
+#define OFFLINE_ASM_BIG_ENDIAN 1
+#else
+#define OFFLINE_ASM_BIG_ENDIAN 0
+#endif
diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
index 20c0c40b..10c58846 100644
--- a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
+++ b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
@@ -1667,7 +1667,11 @@ llintOpWithMetadata(op_get_by_val, OpGetByVal, macro (size, get, dispatch, metad
.opGetByValNotDouble:
subi ArrayStorageShape, t2
- bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValNotIndexedStorage
+ if BIG_ENDIAN
+ bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValSlow
+ else
+ bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValNotIndexedStorage
+ end
biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t3], .opGetByValSlow
loadi ArrayStorage::m_vector + TagOffset[t3, t1, 8], t2
loadi ArrayStorage::m_vector + PayloadOffset[t3, t1, 8], t1
diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
index 27e76d2f..bfb2a46e 100644
--- a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
+++ b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
@@ -1721,7 +1721,11 @@ llintOpWithMetadata(op_get_by_val, OpGetByVal, macro (size, get, dispatch, metad
.opGetByValNotDouble:
subi ArrayStorageShape, t2
- bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValNotIndexedStorage
+ if BIG_ENDIAN
+ bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValSlow
+ else
+ bia t2, SlowPutArrayStorageShape - ArrayStorageShape, .opGetByValNotIndexedStorage
+ end
biaeq t1, -sizeof IndexingHeader + IndexingHeader::u.lengths.vectorLength[t3], .opGetByValSlow
get(m_dst, t0)
loadq ArrayStorage::m_vector[t3, t1, 8], t2

View file

@ -1,14 +1,14 @@
# Template file for 'webkit2gtk'
# ping q66 before touching this
pkgname=webkit2gtk
version=2.32.4
version=2.34.0
revision=1
wrksrc="webkitgtk-${version}"
build_style=cmake
build_helper="gir"
configure_args="-DPORT=GTK -DUSE_LD_GOLD=OFF
-DCMAKE_LINKER=${XBPS_CROSS_TRIPLET}-gcc -DCMAKE_SKIP_RPATH=ON
-DUSE_SYSTEMD=OFF -DUSE_WOFF2=ON
-DUSE_SYSTEMD=OFF -DUSE_WOFF2=ON -DUSE_SOUP2=ON
-DENABLE_GTKDOC=OFF -DUSE_WPE_RENDERER=ON
-DENABLE_MINIBROWSER=$(vopt_if minibrowser ON OFF)
-DENABLE_JIT=$(vopt_if jit ON OFF)
@ -37,7 +37,7 @@ maintainer="q66 <daniel@octaforge.org>"
license="LGPL-2.1-or-later, BSD-2-Clause"
homepage="https://webkitgtk.org/"
distfiles="${homepage}/releases/webkitgtk-${version}.tar.xz"
checksum=00ce2d3f798d7bc5e9039d9059f0c3c974d51de38c8b716f00e94452a177d3fd
checksum=880c8ee626f67019f67557ca09e59a23ecf245e60f6173215f1a8823cb09af34
make_check=no
build_options="gir wayland x11 bubblewrap jit sampling_profiler minibrowser