mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[be] Tidy up some mutableRange logic
This commit is contained in:
@@ -102,14 +102,14 @@ export function inferMutableLifetimes(
|
||||
for (const [_, block] of func.body.blocks) {
|
||||
for (const phi of block.phis) {
|
||||
let start = Number.MAX_SAFE_INTEGER;
|
||||
let end = Number.MIN_SAFE_INTEGER;
|
||||
let end = phi.id.mutableRange.end as number;
|
||||
for (const [_, operand] of phi.operands) {
|
||||
start = Math.min(start, operand.mutableRange.start);
|
||||
end = Math.max(end, operand.mutableRange.end);
|
||||
}
|
||||
invariant(
|
||||
start !== Number.MAX_SAFE_INTEGER && end !== Number.MIN_SAFE_INTEGER,
|
||||
"Expected phi to have set start/end range values"
|
||||
start !== Number.MAX_SAFE_INTEGER,
|
||||
"Expected phi to have a start range value"
|
||||
);
|
||||
phi.id.mutableRange = {
|
||||
start: makeInstructionId(start),
|
||||
|
||||
@@ -148,15 +148,6 @@ export function inferReactiveScopeVariables(fn: HIRFunction): void {
|
||||
}
|
||||
vars.add(identifier);
|
||||
});
|
||||
|
||||
// Copy scope ranges to identifier ranges: not strictly required but this is useful
|
||||
// for visualization
|
||||
for (const [scope, vars] of scopeVariables) {
|
||||
for (const identifier of vars) {
|
||||
identifier.mutableRange.start = scope.range.start;
|
||||
identifier.mutableRange.end = scope.range.end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Is the operand mutable at this given instruction
|
||||
|
||||
Reference in New Issue
Block a user