Skip to content

Commit 180c150

Browse files
richardlauaduh95
authored andcommitted
deps: V8: cherry-pick cf1bce40a5ef
Original commit message: [wasm] Fix S128Const on big endian Since http://crrev.com/c/2944437 globals are no longer little endian enforced. S128Const handling in the initializer needs to take this into account and byte reverse values which are hard coded in little endian order. This is currently causing failures on Node.js upstream: #59034 (comment) Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213 Commit-Queue: Milad Farazmand <mfarazma@ibm.com> Reviewed-by: Manos Koukoutos <manoskouk@chromium.org> Cr-Commit-Position: refs/heads/main@{#106082} Refs: v8/v8@cf1bce4 PR-URL: #62449 Refs: v8/v8@cf1bce4 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent bc265aa commit 180c150

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

deps/v8/src/wasm/constant-expression-interface.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,17 @@ void ConstantExpressionInterface::S128Const(FullDecoder* decoder,
4040
const Simd128Immediate& imm,
4141
Value* result) {
4242
if (!generate_value()) return;
43+
#if V8_TARGET_BIG_ENDIAN
44+
// Globals are not little endian enforced, they use native byte order and we
45+
// need to reverse the bytes on big endian platforms.
46+
uint8_t value[kSimd128Size];
47+
for (int i = 0; i < kSimd128Size; i++) {
48+
value[i] = imm.value[kSimd128Size - 1 - i];
49+
}
50+
result->runtime_value = WasmValue(value, kWasmS128);
51+
#else
4352
result->runtime_value = WasmValue(imm.value, kWasmS128);
53+
#endif
4454
}
4555

4656
void ConstantExpressionInterface::UnOp(FullDecoder* decoder, WasmOpcode opcode,

0 commit comments

Comments
 (0)