Backed out changeset d3f44966d998 (bug 1052514) for jit test failures on a CLOSED TREE

--HG--
extra : histedit_source : 40689854882f87883ce2d5018f0919c39273d137
This commit is contained in:
Benjamin Bouvier 2014-08-27 13:40:39 +02:00
parent 984a09622b
commit b6cda6a213
3 changed files with 18 additions and 23 deletions

View File

@ -106,22 +106,17 @@ ValidateGlobalVariable(JSContext *cx, const AsmJSModule &module, AsmJSModule::Gl
switch (global.varInitKind()) { switch (global.varInitKind()) {
case AsmJSModule::Global::InitConstant: { case AsmJSModule::Global::InitConstant: {
const AsmJSNumLit &lit = global.varInitNumLit(); const Value &v = global.varInitConstant();
const Value &v = lit.value(); switch (global.varInitCoercion()) {
switch (lit.which()) { case AsmJS_ToInt32:
case AsmJSNumLit::Fixnum:
case AsmJSNumLit::NegativeInt:
case AsmJSNumLit::BigUnsigned:
*(int32_t *)datum = v.toInt32(); *(int32_t *)datum = v.toInt32();
break; break;
case AsmJSNumLit::Double: case AsmJS_ToNumber:
*(double *)datum = v.toDouble(); *(double *)datum = v.toDouble();
break; break;
case AsmJSNumLit::Float: case AsmJS_FRound:
*(float *)datum = static_cast<float>(v.toDouble()); *(float *)datum = static_cast<float>(v.toDouble());
break; break;
case AsmJSNumLit::OutOfRangeInt:
MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("OutOfRangeInt isn't valid in the first place");
} }
break; break;
} }

View File

@ -131,7 +131,7 @@ class AsmJSNumLit
return float(value_.toDouble()); return float(value_.toDouble());
} }
const Value &value() const { Value value() const {
JS_ASSERT(which_ != OutOfRangeInt); JS_ASSERT(which_ != OutOfRangeInt);
return value_; return value_;
} }
@ -168,10 +168,10 @@ class AsmJSModule
struct { struct {
uint32_t index_; uint32_t index_;
VarInitKind initKind_; VarInitKind initKind_;
AsmJSCoercion coercion_;
union { union {
AsmJSCoercion coercion_; Value constant_; // will only contain int32/double
AsmJSNumLit numLit_; } init;
} u;
} var; } var;
uint32_t ffiIndex_; uint32_t ffiIndex_;
Scalar::Type viewType_; Scalar::Type viewType_;
@ -196,7 +196,7 @@ class AsmJSModule
if (name_) if (name_)
MarkStringUnbarriered(trc, &name_, "asm.js global name"); MarkStringUnbarriered(trc, &name_, "asm.js global name");
JS_ASSERT_IF(pod.which_ == Variable && pod.u.var.initKind_ == InitConstant, JS_ASSERT_IF(pod.which_ == Variable && pod.u.var.initKind_ == InitConstant,
!pod.u.var.u.numLit_.value().isMarkable()); !pod.u.var.init.constant_.isMarkable());
} }
public: public:
@ -212,15 +212,14 @@ class AsmJSModule
JS_ASSERT(pod.which_ == Variable); JS_ASSERT(pod.which_ == Variable);
return pod.u.var.initKind_; return pod.u.var.initKind_;
} }
const AsmJSNumLit &varInitNumLit() const { const Value &varInitConstant() const {
JS_ASSERT(pod.which_ == Variable); JS_ASSERT(pod.which_ == Variable);
JS_ASSERT(pod.u.var.initKind_ == InitConstant); JS_ASSERT(pod.u.var.initKind_ == InitConstant);
return pod.u.var.u.numLit_; return pod.u.var.init.constant_;
} }
AsmJSCoercion varInitCoercion() const { AsmJSCoercion varInitCoercion() const {
JS_ASSERT(pod.which_ == Variable); JS_ASSERT(pod.which_ == Variable);
JS_ASSERT(pod.u.var.initKind_ == InitImport); return pod.u.var.coercion_;
return pod.u.var.u.coercion_;
} }
PropertyName *varImportField() const { PropertyName *varImportField() const {
JS_ASSERT(pod.which_ == Variable); JS_ASSERT(pod.which_ == Variable);
@ -817,13 +816,14 @@ class AsmJSModule
PropertyName *bufferArgumentName() const { PropertyName *bufferArgumentName() const {
return bufferArgumentName_; return bufferArgumentName_;
} }
bool addGlobalVarInit(const AsmJSNumLit &lit, uint32_t *globalIndex) { bool addGlobalVarInit(const Value &v, AsmJSCoercion coercion, uint32_t *globalIndex) {
JS_ASSERT(!isFinishedWithModulePrologue()); JS_ASSERT(!isFinishedWithModulePrologue());
if (pod.numGlobalVars_ == UINT32_MAX) if (pod.numGlobalVars_ == UINT32_MAX)
return false; return false;
Global g(Global::Variable, nullptr); Global g(Global::Variable, nullptr);
g.pod.u.var.initKind_ = Global::InitConstant; g.pod.u.var.initKind_ = Global::InitConstant;
g.pod.u.var.u.numLit_ = lit; g.pod.u.var.init.constant_ = v;
g.pod.u.var.coercion_ = coercion;
g.pod.u.var.index_ = *globalIndex = pod.numGlobalVars_++; g.pod.u.var.index_ = *globalIndex = pod.numGlobalVars_++;
return globals_.append(g); return globals_.append(g);
} }
@ -831,7 +831,7 @@ class AsmJSModule
JS_ASSERT(!isFinishedWithModulePrologue()); JS_ASSERT(!isFinishedWithModulePrologue());
Global g(Global::Variable, name); Global g(Global::Variable, name);
g.pod.u.var.initKind_ = Global::InitImport; g.pod.u.var.initKind_ = Global::InitImport;
g.pod.u.var.u.coercion_ = coercion; g.pod.u.var.coercion_ = coercion;
g.pod.u.var.index_ = *globalIndex = pod.numGlobalVars_++; g.pod.u.var.index_ = *globalIndex = pod.numGlobalVars_++;
return globals_.append(g); return globals_.append(g);
} }

View File

@ -1350,7 +1350,7 @@ class MOZ_STACK_CLASS ModuleCompiler
bool addGlobalVarInit(PropertyName *varName, const AsmJSNumLit &lit, bool isConst) { bool addGlobalVarInit(PropertyName *varName, const AsmJSNumLit &lit, bool isConst) {
uint32_t index; uint32_t index;
VarType type = VarType::Of(lit); VarType type = VarType::Of(lit);
if (!module_->addGlobalVarInit(lit, &index)) if (!module_->addGlobalVarInit(lit.value(), type.toCoercion(), &index))
return false; return false;
Global::Which which = isConst ? Global::ConstantLiteral : Global::Variable; Global::Which which = isConst ? Global::ConstantLiteral : Global::Variable;