Commit 4d595e02 authored by Predrag Rudic's avatar Predrag Rudic Committed by Commit Bot

[builtins] Support BigInt code stubs for BIG ENDIAN platforms

mjsunit/harmony/bigint/typedarray test failure on mips32 big endian
pointed there was a problem.

Change-Id: I016a31d7758e7bd4019210e23c147dc0f8ea893f
Reviewed-on: https://chromium-review.googlesource.com/995455
Commit-Queue: Ivica Bogosavljevic <ivica.bogosavljevic@mips.com>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52380}
parent dbb80b62
......@@ -1730,11 +1730,19 @@ Node* CodeStubAssembler::LoadFixedBigInt64ArrayElementAsTagged(
TVARIABLE(WordT, var_sign, IntPtrConstant(BigInt::SignBits::encode(false)));
TVARIABLE(IntPtrT, var_low);
TVARIABLE(IntPtrT, var_high);
#if defined(V8_TARGET_BIG_ENDIAN)
var_high = UncheckedCast<IntPtrT>(
Load(MachineType::UintPtr(), data_pointer, offset));
var_low = UncheckedCast<IntPtrT>(
Load(MachineType::UintPtr(), data_pointer,
Int32Add(offset, Int32Constant(kPointerSize))));
#else
var_low = UncheckedCast<IntPtrT>(
Load(MachineType::UintPtr(), data_pointer, offset));
var_high = UncheckedCast<IntPtrT>(
Load(MachineType::UintPtr(), data_pointer,
Int32Add(offset, Int32Constant(kPointerSize))));
#endif
Label high_zero(this), negative(this), allocate_one_digit(this),
allocate_two_digits(this);
......@@ -1813,11 +1821,19 @@ Node* CodeStubAssembler::LoadFixedBigUint64ArrayElementAsTagged(
DCHECK(!Is64());
Label high_zero(this);
#if defined(V8_TARGET_BIG_ENDIAN)
TNode<UintPtrT> high = UncheckedCast<UintPtrT>(
Load(MachineType::UintPtr(), data_pointer, offset));
TNode<UintPtrT> low = UncheckedCast<UintPtrT>(
Load(MachineType::UintPtr(), data_pointer,
Int32Add(offset, Int32Constant(kPointerSize))));
#else
TNode<UintPtrT> low = UncheckedCast<UintPtrT>(
Load(MachineType::UintPtr(), data_pointer, offset));
TNode<UintPtrT> high = UncheckedCast<UintPtrT>(
Load(MachineType::UintPtr(), data_pointer,
Int32Add(offset, Int32Constant(kPointerSize))));
#endif
GotoIf(WordEqual(high, IntPtrConstant(0)), &high_zero);
var_result = AllocateBigInt(IntPtrConstant(2));
......@@ -8234,12 +8250,23 @@ void CodeStubAssembler::EmitBigTypedArrayElementStore(
Node* offset = ElementOffsetFromIndex(intptr_key, BIGINT64_ELEMENTS,
INTPTR_PARAMETERS, 0);
MachineRepresentation rep = WordT::kMachineRepresentation;
#if defined(V8_TARGET_BIG_ENDIAN)
if (!Is64()) {
StoreNoWriteBarrier(rep, backing_store, offset, var_high.value());
StoreNoWriteBarrier(rep, backing_store,
IntPtrAdd(offset, IntPtrConstant(kPointerSize)),
var_low.value());
} else {
StoreNoWriteBarrier(rep, backing_store, offset, var_low.value());
}
#else
StoreNoWriteBarrier(rep, backing_store, offset, var_low.value());
if (!Is64()) {
StoreNoWriteBarrier(rep, backing_store,
IntPtrAdd(offset, IntPtrConstant(kPointerSize)),
var_high.value());
}
#endif
}
void CodeStubAssembler::EmitElementStore(Node* object, Node* key, Node* value,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment