|
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 |
|
@@ -1758,6 +1759,7 @@ using namespace Js; |
1758 | 1759 | ival = ((SparseArraySegment<int32>*)seg)->elements[i /*+ seg->length*/]; |
1759 | 1760 | if (ival == JavascriptNativeIntArray::MissingItem) |
1760 | 1761 | { |
| 1762 | + AssertMsgAndFailFast(newSeg != intArray->head || !intArray->HasNoMissingValues(), "Unexpected missing item during array conversion"); |
1761 | 1763 | continue; |
1762 | 1764 | } |
1763 | 1765 | newSeg->elements[i] = (double)ival; |
@@ -2025,6 +2027,7 @@ using namespace Js; |
2025 | 2027 | ival = ((SparseArraySegment<int32>*)seg)->elements[i]; |
2026 | 2028 | if (ival == JavascriptNativeIntArray::MissingItem) |
2027 | 2029 | { |
| 2030 | + AssertMsgAndFailFast(seg != intArray->head || !intArray->HasNoMissingValues(), "Unexpected missing item during array conversion"); |
2028 | 2031 | continue; |
2029 | 2032 | } |
2030 | 2033 | newSeg->elements[i] = JavascriptNumber::ToVar(ival, scriptContext); |
@@ -2059,6 +2062,7 @@ using namespace Js; |
2059 | 2062 | ival = ((SparseArraySegment<int32>*)seg)->elements[i]; |
2060 | 2063 | if (ival == JavascriptNativeIntArray::MissingItem) |
2061 | 2064 | { |
| 2065 | + AssertMsgAndFailFast(seg != intArray->head || !intArray->HasNoMissingValues(), "Unexpected missing item during array conversion"); |
2062 | 2066 | ((SparseArraySegment<Var>*)seg)->elements[i] = (Var)JavascriptArray::MissingItem; |
2063 | 2067 | } |
2064 | 2068 | else |
@@ -2238,6 +2242,7 @@ using namespace Js; |
2238 | 2242 | { |
2239 | 2243 | if (SparseArraySegment<double>::IsMissingItem(&((SparseArraySegment<double>*)seg)->elements[i])) |
2240 | 2244 | { |
| 2245 | + AssertMsgAndFailFast(seg != fArray->head || !fArray->HasNoMissingValues(), "Unexpected missing item during conversion"); |
2241 | 2246 | if (seg == newSeg) |
2242 | 2247 | { |
2243 | 2248 | newSeg->elements[i] = (Var)JavascriptArray::MissingItem; |
|
0 commit comments