mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 882323 - Fix LoadTypedArrayElementHole type barrier. r=bhackett
This commit is contained in:
parent
cba41605d1
commit
7877bf9da6
@ -6607,6 +6607,32 @@ IonBuilder::jsop_getelem_typed(int arrayType)
|
||||
load->setResultType(knownType);
|
||||
return true;
|
||||
} else {
|
||||
// We need a type barrier if the array's element type has never been
|
||||
// observed (we've only read out-of-bounds values). Note that for
|
||||
// Uint32Array, we only check for int32: if allowDouble is false we
|
||||
// will bailout when we read a double.
|
||||
bool needsBarrier = true;
|
||||
switch (arrayType) {
|
||||
case TypedArray::TYPE_INT8:
|
||||
case TypedArray::TYPE_UINT8:
|
||||
case TypedArray::TYPE_UINT8_CLAMPED:
|
||||
case TypedArray::TYPE_INT16:
|
||||
case TypedArray::TYPE_UINT16:
|
||||
case TypedArray::TYPE_INT32:
|
||||
case TypedArray::TYPE_UINT32:
|
||||
if (types->hasType(types::Type::Int32Type()))
|
||||
needsBarrier = false;
|
||||
break;
|
||||
case TypedArray::TYPE_FLOAT32:
|
||||
case TypedArray::TYPE_FLOAT64:
|
||||
if (allowDouble)
|
||||
needsBarrier = false;
|
||||
break;
|
||||
default:
|
||||
JS_NOT_REACHED("Unknown typed array type");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Assume we will read out-of-bound values. In this case the
|
||||
// bounds check will be part of the instruction, and the instruction
|
||||
// will always return a Value.
|
||||
@ -6615,7 +6641,7 @@ IonBuilder::jsop_getelem_typed(int arrayType)
|
||||
current->add(load);
|
||||
current->push(load);
|
||||
|
||||
return resumeAfter(load) && pushTypeBarrier(load, types, false);
|
||||
return resumeAfter(load) && pushTypeBarrier(load, types, needsBarrier);
|
||||
}
|
||||
}
|
||||
|
||||
|
23
js/src/jit-test/tests/ion/bug882323.js
Normal file
23
js/src/jit-test/tests/ion/bug882323.js
Normal file
@ -0,0 +1,23 @@
|
||||
var ints = new Int8Array(16);
|
||||
ints[0] = 42;
|
||||
function intElementAt(index) {
|
||||
return ints[index];
|
||||
}
|
||||
assertEq(intElementAt(16), undefined);
|
||||
assertEq(intElementAt(0), 42);
|
||||
|
||||
var floats = new Float64Array(16);
|
||||
floats[0] = 3.14;
|
||||
function floatElementAt(index) {
|
||||
return floats[index];
|
||||
}
|
||||
assertEq(floatElementAt(16), undefined);
|
||||
assertEq(floatElementAt(0), 3.14);
|
||||
|
||||
var uints = new Uint32Array(16);
|
||||
uints[0] = 123;
|
||||
function uintElementAt(index) {
|
||||
return uints[index];
|
||||
}
|
||||
assertEq(uintElementAt(16), undefined);
|
||||
assertEq(uintElementAt(0), 123);
|
Loading…
Reference in New Issue
Block a user