Bug 1130845: Add a list of SIMD freed stack slots in LinearScan; r=sunfish
authorBenjamin Bouvier <benj@benj.me>
Thu, 12 Feb 2015 15:49:33 +0100
changeset 229353 3341a0bc3296f3c6096eadf378da2db912a58c7e
parent 229352 12189d1c13af8dea7ebfe91391dee8b1186aeaca
child 229354 b0867af35eb0f43d6915d9cf3f3403d73546030f
push id11352
push userryanvm@gmail.com
push dateTue, 17 Feb 2015 19:29:37 +0000
treeherderfx-team@b6c56fab513d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssunfish
bugs1130845
milestone38.0a1
Bug 1130845: Add a list of SIMD freed stack slots in LinearScan; r=sunfish
js/src/jit-test/tests/SIMD/bug1130845.js
js/src/jit/LinearScan.cpp
js/src/jit/LinearScan.h
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;