mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Bug 844059 - Prevent int-specialized GetElementIC to produce stub for float typed arrays. r=dvander
This commit is contained in:
parent
83d4a61880
commit
3bd0bd475d
@ -1618,7 +1618,13 @@ GetElementIC::attachTypedArrayElement(JSContext *cx, IonScript *ion, JSObject *o
|
||||
MacroAssembler masm;
|
||||
|
||||
// The array type is the object within the table of typed array classes.
|
||||
int arrayType = obj->getClass() - &TypedArray::classes[0];
|
||||
int arrayType = TypedArray::type(obj);
|
||||
|
||||
// The output register is not yet specialized as a float register, the only
|
||||
// way to accept float typed arrays for now is to return a Value type.
|
||||
bool floatOutput = arrayType == TypedArray::TYPE_FLOAT32 ||
|
||||
arrayType == TypedArray::TYPE_FLOAT64;
|
||||
JS_ASSERT_IF(!output().hasValue(), !floatOutput);
|
||||
|
||||
Register tmpReg = output().scratchReg().gpr();
|
||||
JS_ASSERT(tmpReg != InvalidReg);
|
||||
@ -1723,9 +1729,14 @@ GetElementIC::update(JSContext *cx, size_t cacheIndex, HandleObject obj,
|
||||
return false;
|
||||
attachedStub = true;
|
||||
} else if (obj->isTypedArray() && idval.isInt32()) {
|
||||
if (!cache.attachTypedArrayElement(cx, ion, obj, idval))
|
||||
return false;
|
||||
attachedStub = true;
|
||||
int arrayType = TypedArray::type(obj);
|
||||
bool floatOutput = arrayType == TypedArray::TYPE_FLOAT32 ||
|
||||
arrayType == TypedArray::TYPE_FLOAT64;
|
||||
if (!floatOutput || cache.output().hasValue()) {
|
||||
if (!cache.attachTypedArrayElement(cx, ion, obj, idval))
|
||||
return false;
|
||||
attachedStub = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
12
js/src/jit-test/tests/ion/bug844059.js
Normal file
12
js/src/jit-test/tests/ion/bug844059.js
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
function assertArraysFirstEqual(a, b) {
|
||||
assertEq(a[0], b[0]);
|
||||
}
|
||||
|
||||
function check(b) {
|
||||
var a = deserialize(serialize(b));
|
||||
assertArraysFirstEqual(a, b);
|
||||
}
|
||||
|
||||
check(new Int8Array(1));
|
||||
check(new Float64Array(1));
|
Loading…
Reference in New Issue
Block a user