refactor(ivy): prevent `-0` from being generated (#34290)
PR Close #34290
This commit is contained in:
parent
bb52fb798c
commit
4ef6f1ab2e
|
@ -1216,7 +1216,10 @@ export function generateExpandoInstructionBlock(
|
|||
tView.firstCreatePass, true,
|
||||
'Expando block should only be generated on first create pass.');
|
||||
|
||||
const elementIndex = -(tNode.index - HEADER_OFFSET);
|
||||
// Important: In JS `-x` and `0-x` is not the same! If `x===0` then `-x` will produce `-0` which
|
||||
// requires non standard math arithmetic and it can prevent VM optimizations.
|
||||
// `0-0` will always produce `0` and will not cause a potential deoptimization in VM.
|
||||
const elementIndex = HEADER_OFFSET - tNode.index;
|
||||
const providerStartIndex = tNode.providerIndexes & TNodeProviderIndexes.ProvidersStartIndexMask;
|
||||
const providerCount = tView.data.length - providerStartIndex;
|
||||
(tView.expandoInstructions || (tView.expandoInstructions = [
|
||||
|
|
Loading…
Reference in New Issue