|
9 | 9 |
|
10 | 10 | // TODO: Change this generic fatal error to the descriptive one. |
11 | 11 | #define AssertAndFailFast(x) if (!(x)) { Assert(x); Js::Throw::FatalInternalError(); } |
| 12 | +#define AssertMsgAndFailFast(x, m) if (!(x)) { AssertMsg((x), m); Js::Throw::FatalInternalError(); } |
12 | 13 |
|
13 | 14 | using namespace Js; |
14 | 15 |
|
@@ -1749,6 +1750,7 @@ using namespace Js; |
1749 | 1750 | ival = ((SparseArraySegment<int32>*)seg)->elements[i /*+ seg->length*/]; |
1750 | 1751 | if (ival == JavascriptNativeIntArray::MissingItem) |
1751 | 1752 | { |
| 1753 | + AssertMsgAndFailFast(newSeg != intArray->head || !intArray->HasNoMissingValues(), "Unexpected missing item during array conversion"); |
1752 | 1754 | continue; |
1753 | 1755 | } |
1754 | 1756 | newSeg->elements[i] = (double)ival; |
@@ -2016,6 +2018,7 @@ using namespace Js; |
2016 | 2018 | ival = ((SparseArraySegment<int32>*)seg)->elements[i]; |
2017 | 2019 | if (ival == JavascriptNativeIntArray::MissingItem) |
2018 | 2020 | { |
| 2021 | + AssertMsgAndFailFast(seg != intArray->head || !intArray->HasNoMissingValues(), "Unexpected missing item during array conversion"); |
2019 | 2022 | continue; |
2020 | 2023 | } |
2021 | 2024 | newSeg->elements[i] = JavascriptNumber::ToVar(ival, scriptContext); |
@@ -2050,6 +2053,7 @@ using namespace Js; |
2050 | 2053 | ival = ((SparseArraySegment<int32>*)seg)->elements[i]; |
2051 | 2054 | if (ival == JavascriptNativeIntArray::MissingItem) |
2052 | 2055 | { |
| 2056 | + AssertMsgAndFailFast(seg != intArray->head || !intArray->HasNoMissingValues(), "Unexpected missing item during array conversion"); |
2053 | 2057 | ((SparseArraySegment<Var>*)seg)->elements[i] = (Var)JavascriptArray::MissingItem; |
2054 | 2058 | } |
2055 | 2059 | else |
@@ -2229,6 +2233,7 @@ using namespace Js; |
2229 | 2233 | { |
2230 | 2234 | if (SparseArraySegment<double>::IsMissingItem(&((SparseArraySegment<double>*)seg)->elements[i])) |
2231 | 2235 | { |
| 2236 | + AssertMsgAndFailFast(seg != fArray->head || !fArray->HasNoMissingValues(), "Unexpected missing item during conversion"); |
2232 | 2237 | if (seg == newSeg) |
2233 | 2238 | { |
2234 | 2239 | newSeg->elements[i] = (Var)JavascriptArray::MissingItem; |
|
0 commit comments