From 01552c03d907eb61f52d4cd129f4efd6aecf4351 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Tue, 30 Sep 2014 11:33:11 +0200 Subject: [PATCH] Bug 1068725: More debugging and assertions for MoveGroups; r=sunfish * * * Bug 1068725: Make the MoveGroup type spew debug only; r=bustage --- js/src/jit/LIR.cpp | 28 +++++++++++++++++++++++++--- js/src/jit/LIR.h | 1 + js/src/jit/RegisterAllocator.cpp | 2 +- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/js/src/jit/LIR.cpp b/js/src/jit/LIR.cpp index 35a297093271..bad572f792ab 100644 --- a/js/src/jit/LIR.cpp +++ b/js/src/jit/LIR.cpp @@ -348,6 +348,8 @@ static const char * const TypeChars[] = "s", // SLOTS "f", // FLOAT32 "d", // DOUBLE + "i32x4", // INT32X4 + "f32x4", // FLOAT32X4 #ifdef JS_NUNBOX32 "t", // TYPE "p" // PAYLOAD @@ -541,9 +543,25 @@ bool LMoveGroup::add(LAllocation *from, LAllocation *to, LDefinition::Type type) { #ifdef DEBUG - JS_ASSERT(*from != *to); + MOZ_ASSERT(*from != *to); for (size_t i = 0; i < moves_.length(); i++) - JS_ASSERT(*to != *moves_[i].to()); + MOZ_ASSERT(*to != *moves_[i].to()); + + // Check that SIMD moves are aligned according to ABI requirements. + if (LDefinition(type).isSimdType()) { + if (from->isMemory()) { + if (from->isArgument()) + MOZ_ASSERT(from->toArgument()->index() % SimdStackAlignment == 0); + else + MOZ_ASSERT(from->toStackSlot()->slot() % SimdStackAlignment == 0); + } + if (to->isMemory()) { + if (to->isArgument()) + MOZ_ASSERT(to->toArgument()->index() % SimdStackAlignment == 0); + else + MOZ_ASSERT(to->toStackSlot()->slot() % SimdStackAlignment == 0); + } + } #endif return moves_.append(LMove(from, to, type)); } @@ -582,7 +600,11 @@ LMoveGroup::printOperands(FILE *fp) const LMove &move = getMove(i); // Use two printfs, as LAllocation::toString is not reentrant. fprintf(fp, " [%s", move.from()->toString()); - fprintf(fp, " -> %s]", move.to()->toString()); + fprintf(fp, " -> %s", move.to()->toString()); +#ifdef DEBUG + fprintf(fp, ", %s", TypeChars[move.type()]); +#endif + fprintf(fp, "]"); if (i != numMoves() - 1) fprintf(fp, ","); } diff --git a/js/src/jit/LIR.h b/js/src/jit/LIR.h index cda84bec76c5..d80ddc0018d3 100644 --- a/js/src/jit/LIR.h +++ b/js/src/jit/LIR.h @@ -416,6 +416,7 @@ class LDefinition MUST_REUSE_INPUT }; + // This should be kept in sync with LIR.cpp's TypeChars. enum Type { GENERAL, // Generic, integer or pointer-width data (GPR). INT32, // int32 data (GPR). diff --git a/js/src/jit/RegisterAllocator.cpp b/js/src/jit/RegisterAllocator.cpp index 67621b27c46a..27892b0c0a53 100644 --- a/js/src/jit/RegisterAllocator.cpp +++ b/js/src/jit/RegisterAllocator.cpp @@ -407,7 +407,7 @@ AllocationIntegrityState::dump() if (ins->isMoveGroup()) { LMoveGroup *group = ins->toMoveGroup(); for (int i = group->numMoves() - 1; i >= 0; i--) { - // Use two printfs, as LAllocation::toString is not reentant. + // Use two printfs, as LAllocation::toString is not reentrant. fprintf(stderr, " [%s", group->getMove(i).from()->toString()); fprintf(stderr, " -> %s]", group->getMove(i).to()->toString()); }