Bug 1130845: Add a list of SIMD freed stack slots in LinearScan; r=sunfish
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/SIMD/bug1130845.js
@@ -0,0 +1,12 @@
+var int32x4 = SIMD.int32x4;
+function test() {
+ var a = int32x4();
+ var b = int32x4(10, 20, 30, 40);
+ var c = SIMD.int32x4.and(a, b);
+ assertEq(c.x, 0);
+ return 0;
+}
+test();
+var u = [], v = [];
+for (var j=0; j<u.length; ++j)
+ v[test()] = t;
--- a/js/src/jit/LinearScan.cpp
+++ b/js/src/jit/LinearScan.cpp
@@ -818,17 +818,19 @@ LinearScanAllocator::assign(LAllocation
}
uint32_t
LinearScanAllocator::allocateSlotFor(const LiveInterval *interval)
{
LinearScanVirtualRegister *reg = &vregs[interval->vreg()];
SlotList *freed;
- if (reg->type() == LDefinition::DOUBLE)
+ if (reg->def()->isSimdType())
+ freed = &finishedQuadSlots_;
+ else if (reg->type() == LDefinition::DOUBLE)
freed = &finishedDoubleSlots_;
#if JS_BITS_PER_WORD == 64
else if (reg->type() == LDefinition::GENERAL ||
reg->type() == LDefinition::OBJECT ||
reg->type() == LDefinition::SLOTS)
freed = &finishedDoubleSlots_;
#endif
#ifdef JS_PUNBOX64
@@ -911,17 +913,19 @@ LinearScanAllocator::spill()
}
void
LinearScanAllocator::freeAllocation(LiveInterval *interval, LAllocation *alloc)
{
LinearScanVirtualRegister *mine = &vregs[interval->vreg()];
if (!IsNunbox(mine)) {
if (alloc->isStackSlot()) {
- if (mine->type() == LDefinition::DOUBLE)
+ if (mine->def()->isSimdType())
+ finishedQuadSlots_.append(interval);
+ else if (mine->type() == LDefinition::DOUBLE)
finishedDoubleSlots_.append(interval);
#if JS_BITS_PER_WORD == 64
else if (mine->type() == LDefinition::GENERAL ||
mine->type() == LDefinition::OBJECT ||
mine->type() == LDefinition::SLOTS)
finishedDoubleSlots_.append(interval);
#endif
#ifdef JS_PUNBOX64
--- a/js/src/jit/LinearScan.h
+++ b/js/src/jit/LinearScan.h
@@ -76,16 +76,17 @@ class LinearScanAllocator
void assertSorted();
LiveInterval *dequeue();
};
typedef Vector<LiveInterval *, 0, SystemAllocPolicy> SlotList;
SlotList finishedSlots_;
SlotList finishedDoubleSlots_;
+ SlotList finishedQuadSlots_;
#ifdef JS_NUNBOX32
SlotList finishedNunboxSlots_;
#endif
// Run-time state
UnhandledQueue unhandled;
InlineList<LiveInterval> active;
InlineList<LiveInterval> inactive;