Backed out changeset 5fbd9586a141 (bug 1077175) for build bustage on a CLOSED TREE

This commit is contained in:
Wes Kocher 2014-10-21 13:51:41 -07:00
parent 564d5ee268
commit 5f4493ea7f
2 changed files with 53 additions and 71 deletions

View File

@ -386,11 +386,10 @@ class Type
Fixnum = AsmJSNumLit::Fixnum,
Signed = AsmJSNumLit::NegativeInt,
Unsigned = AsmJSNumLit::BigUnsigned,
DoubleLit = AsmJSNumLit::Double,
Double = AsmJSNumLit::Double,
Float = AsmJSNumLit::Float,
Int32x4 = AsmJSNumLit::Int32x4,
Float32x4 = AsmJSNumLit::Float32x4,
Double,
MaybeDouble,
MaybeFloat,
Floatish,
@ -429,20 +428,19 @@ class Type
inline bool operator<=(Type rhs) const {
switch (rhs.which_) {
case Signed: return isSigned();
case Unsigned: return isUnsigned();
case DoubleLit: return isDoubleLit();
case Double: return isDouble();
case Float: return isFloat();
case Int32x4: return isInt32x4();
case Float32x4: return isFloat32x4();
case MaybeDouble: return isMaybeDouble();
case MaybeFloat: return isMaybeFloat();
case Floatish: return isFloatish();
case Int: return isInt();
case Intish: return isIntish();
case Fixnum: return isFixnum();
case Void: return isVoid();
case Type::Signed: return isSigned();
case Type::Unsigned: return isUnsigned();
case Type::Double: return isDouble();
case Type::Float: return isFloat();
case Type::Int32x4: return isInt32x4();
case Type::Float32x4: return isFloat32x4();
case Type::MaybeDouble: return isMaybeDouble();
case Type::MaybeFloat: return isMaybeFloat();
case Type::Floatish: return isFloatish();
case Type::Int: return isInt();
case Type::Intish: return isIntish();
case Type::Fixnum: return isFixnum();
case Type::Void: return isVoid();
}
MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("unexpected this type");
}
@ -467,12 +465,8 @@ class Type
return isInt() || which_ == Intish;
}
bool isDoubleLit() const {
return which_ == DoubleLit;
}
bool isDouble() const {
return isDoubleLit() || which_ == Double;
return which_ == Double;
}
bool isMaybeDouble() const {
@ -518,7 +512,6 @@ class Type
MIRType toMIRType() const {
switch (which_) {
case Double:
case DoubleLit:
case MaybeDouble:
return MIRType_Double;
case Float:
@ -550,7 +543,6 @@ class Type
return Float;
// Scalar types
case Double:
case DoubleLit:
case MaybeDouble:
case Float:
case MaybeFloat:
@ -575,7 +567,30 @@ class Type
return Floatish;
// Scalar types
case Double:
case DoubleLit:
case MaybeDouble:
case Float:
case MaybeFloat:
case Floatish:
case Fixnum:
case Int:
case Signed:
case Unsigned:
case Intish:
case Void:
break;
}
MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("Invalid SIMD Type");
}
AsmJSSimdType simdToSimdType() const {
MOZ_ASSERT(isSimd());
switch (which_) {
case Int32x4:
return AsmJSSimdType_int32x4;
case Float32x4:
return AsmJSSimdType_float32x4;
// Scalar types
case Double:
case MaybeDouble:
case Float:
case MaybeFloat:
@ -594,7 +609,6 @@ class Type
const char *toChars() const {
switch (which_) {
case Double: return "double";
case DoubleLit: return "doublelit";
case MaybeDouble: return "double?";
case Float: return "float";
case Floatish: return "floatish";
@ -4932,6 +4946,8 @@ CheckMathBuiltinCall(FunctionCompiler &f, ParseNode *callNode, AsmJSMathBuiltinF
typedef Vector<MDefinition*, 4, SystemAllocPolicy> DefinitionVector;
namespace {
template<class CheckArgOp>
static bool
CheckSimdCallArgs(FunctionCompiler &f, ParseNode *call, unsigned expectedArity,
@ -4952,15 +4968,13 @@ CheckSimdCallArgs(FunctionCompiler &f, ParseNode *call, unsigned expectedArity,
Type argType;
if (!CheckExpr(f, arg, &argDefs[i], &argType))
return false;
if (!checkArg(f, arg, i, argType, &argDefs[i]))
if (!checkArg(f, arg, i, argType))
return false;
}
return true;
}
namespace {
class CheckArgIsSubtypeOf
{
Type formalType_;
@ -4968,8 +4982,7 @@ class CheckArgIsSubtypeOf
public:
explicit CheckArgIsSubtypeOf(Type t) : formalType_(t) {}
bool operator()(FunctionCompiler &f, ParseNode *arg, unsigned argIndex, Type actualType,
MDefinition **def) const
bool operator()(FunctionCompiler &f, ParseNode *arg, unsigned argIndex, Type actualType) const
{
if (!(actualType <= formalType_)) {
return f.failf(arg, "%s is not a subtype of %s", actualType.toChars(),
@ -4979,36 +4992,6 @@ class CheckArgIsSubtypeOf
}
};
class CheckSimdScalarArgs
{
Type simdType_;
Type formalType_;
public:
CheckSimdScalarArgs(Type simdType)
: simdType_(simdType), formalType_(simdType.simdToCoercedScalarType())
{}
bool operator()(FunctionCompiler &f, ParseNode *arg, unsigned argIndex, Type actualType,
MDefinition **def) const
{
if (!(actualType <= formalType_)) {
// As a special case, accept doublelit arguments to float32x4 ops by
// re-emitting them as float32 constants.
if (!simdType_.isFloat32x4() || !actualType.isDoubleLit()) {
return f.failf(arg, "%s is not a subtype of %s%s",
actualType.toChars(), formalType_.toChars(),
simdType_.isFloat32x4() ? " or doublelit" : "");
}
AsmJSNumLit doubleLit = ExtractNumericLiteral(f.m(), arg);
MOZ_ASSERT(doubleLit.which() == AsmJSNumLit::Double);
*def = f.constant(doubleLit.scalarValue(), Type::Float);
}
return true;
}
};
class CheckSimdSelectArgs
{
Type formalType_;
@ -5016,8 +4999,7 @@ class CheckSimdSelectArgs
public:
explicit CheckSimdSelectArgs(Type t) : formalType_(t) {}
bool operator()(FunctionCompiler &f, ParseNode *arg, unsigned argIndex, Type actualType,
MDefinition **def) const
bool operator()(FunctionCompiler &f, ParseNode *arg, unsigned argIndex, Type actualType) const
{
if (argIndex == 0) {
// First argument of select is an int32x4 mask.
@ -5041,8 +5023,7 @@ class CheckSimdVectorScalarArgs
public:
explicit CheckSimdVectorScalarArgs(Type t) : formalType_(t) {}
bool operator()(FunctionCompiler &f, ParseNode *arg, unsigned argIndex, Type actualType,
MDefinition **def) const
bool operator()(FunctionCompiler &f, ParseNode *arg, unsigned argIndex, Type actualType) const
{
MOZ_ASSERT(argIndex < 2);
if (argIndex == 0) {
@ -5295,7 +5276,8 @@ CheckSimdOperationCall(FunctionCompiler &f, ParseNode *call, const ModuleCompile
case AsmJSSimdOperation_splat: {
DefinitionVector defs;
if (!CheckSimdCallArgs(f, call, 1, CheckSimdScalarArgs(retType), &defs))
Type formalType = retType.simdToCoercedScalarType();
if (!CheckSimdCallArgs(f, call, 1, CheckArgIsSubtypeOf(formalType), &defs))
return false;
*def = f.splatSimd(defs[0], retType.toMIRType());
*type = retType;
@ -5329,13 +5311,16 @@ CheckSimdCtorCall(FunctionCompiler &f, ParseNode *call, const ModuleCompiler::Gl
AsmJSSimdType simdType = global->simdCtorType();
Type retType = simdType;
unsigned length = SimdTypeToLength(simdType);
Type formalType = retType.simdToCoercedScalarType();
DefinitionVector defs;
if (!CheckSimdCallArgs(f, call, length, CheckSimdScalarArgs(retType), &defs))
if (!CheckSimdCallArgs(f, call, length, CheckArgIsSubtypeOf(formalType), &defs))
return false;
// This code will need to be generalized when we handle float64x2
MOZ_ASSERT(length == 4);
*def = f.constructSimd<MSimdValueX4>(defs[0], defs[1], defs[2], defs[3], retType.toMIRType());
MIRType opType = retType.toMIRType();
*def = f.constructSimd<MSimdValueX4>(defs[0], defs[1], defs[2], defs[3], opType);
*type = retType;
return true;
}

View File

@ -152,10 +152,9 @@ assertEq(asmLink(asmCompile('glob', USE_ASM + F32 + "function f() {f4(1,2,3,4);}
// Int32x4 ctor should accept int?
assertEqX4(asmLink(asmCompile('glob', 'ffi', 'heap', USE_ASM + I32 + "var i32=new glob.Int32Array(heap); function f(i) {i=i|0; return i4(i4(i32[i>>2], 2, 3, 4))} return f"), this, {}, new ArrayBuffer(0x10000))(0x20000), [0, 2, 3, 4]);
// Float32x4 ctor should accept floatish (i.e. float || float? || floatish) and doublit
// Float32x4 ctor should accept floatish, i.e. float || float? || floatish
assertEqX4(asmLink(asmCompile('glob', 'ffi', 'heap', USE_ASM + F32 + FROUND + "var h=new glob.Float32Array(heap); function f(i) {i=i|0; return f4(f4(h[i>>2], f32(2), f32(3), f32(4)))} return f"), this, {}, new ArrayBuffer(0x10000))(0x20000), [NaN, 2, 3, 4]);
assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + FROUND + "function f(i) {i=i|0; return f4(f4(f32(1) + f32(2), f32(2), f32(3), f32(4)))} return f"), this, {}, new ArrayBuffer(0x10000))(0x20000), [3, 2, 3, 4]);
assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + FROUND + "function f(i) {i=i|0; return f4(f4(f32(1) + f32(2), 2.0, 3.0, 4.0))} return f"), this, {}, new ArrayBuffer(0x10000))(0x20000), [3, 2, 3, 4]);
// 1.3.2 Reading values out of lanes
assertAsmTypeFail('glob', USE_ASM + "function f() {var x=1; return x.y | 0;} return f");
@ -816,10 +815,8 @@ assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + I32SPLAT + 'function f(){r
const l33t = Math.fround(13.37);
assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + F32SPLAT + FROUND + 'function f(){return f4(splat(f32(1)));} return f'), this)(), [1, 1, 1, 1]);
assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + F32SPLAT + FROUND + 'function f(){return f4(splat(1.0));} return f'), this)(), [1, 1, 1, 1]);
assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + F32SPLAT + FROUND + 'function f(){return f4(splat(f32(1 >>> 0)));} return f'), this)(), [1, 1, 1, 1]);
assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + F32SPLAT + FROUND + 'function f(){return f4(splat(f32(13.37)));} return f'), this)(), [l33t, l33t, l33t, l33t]);
assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + F32SPLAT + FROUND + 'function f(){return f4(splat(13.37));} return f'), this)(), [l33t, l33t, l33t, l33t]);
var i32view = new Int32Array(heap);
var f32view = new Float32Array(heap);