зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1491147 - When emitting tableswitch'd case constants, assert the constants are int32_t using NumberEqualsInt32 (which permits -0) and not NumberIsInt32 (which does not), because switching compares values using strict equality which consideres +0 and -0 to be equivalent. rs=me as trivial
--HG-- extra : rebase_source : 0c27bcffe3e124fee9eedf3090da8c469e450a07
This commit is contained in:
Родитель
2e4fe088b6
Коммит
0fdb26eeb5
|
@ -2660,8 +2660,11 @@ BytecodeEmitter::emitSwitch(SwitchStatement* switchStmt)
|
|||
|
||||
NumericLiteral* literal = &caseValue->as<NumericLiteral>();
|
||||
#ifdef DEBUG
|
||||
// Use NumberEqualsInt32 here because switches compare using
|
||||
// strict equality, which will equate -0 and +0. In contrast
|
||||
// NumberIsInt32 would return false for -0.
|
||||
int32_t v;
|
||||
MOZ_ASSERT(mozilla::NumberIsInt32(literal->value(), &v));
|
||||
MOZ_ASSERT(mozilla::NumberEqualsInt32(literal->value(), &v));
|
||||
#endif
|
||||
int32_t i = int32_t(literal->value());
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче