[hir] represent PropertyCall as receiver + PropertyLoad

How Forget currently lowers PropertyCall: 

```js 

// source: [[ calleeExpr ]].propertyName( [[ argExpr0 ]]) 

$0 = [[ calleeExpr ]] 

$1 = [[ argExpr0 ]] 

$2 = PropertyCall callee=$0 property="propertyName" args=[$1] 

``` 

This PR changes the lowering: 

```js 

// source: [[ calleeExpr ]].propertyName( [[ argExpr0 ]]) 

$0 = [[ calleeExpr ]] 

$1 = PropertyLoad $0 "propertyName" 

$2 = [[ argExpr0 ]] 

$3 = PropertyCall callee=$0 fn=$1 args=[$2] 

``` 

From my understanding, `PropertyCall` needs the receiver to properly model JS 
semantics which is something like `resolvedFn.apply(resolvedCallee, arg0, arg1, 
...)`. This is additionally useful for: 

- Fine-grained mutability / alias analysis. The property call is technically a 
read of the resolved function, and a mutate of the callee. 

- Dependency tracking. While we could special case PropertyCall, this 
representation would correctly add both callee and callee.propertyName as 
dependencies for PropertyCall. 

e.g. 

```js 

let x = []; 

mutate(x); 

useFreeze(x); 

let y = {}; 

y.a = x.bar(); 

return y; 

```
This commit is contained in:
Mofei Zhang
2023-03-21 14:57:12 -04:00
parent 6ce4cd0898
commit 01a6502baa
13 changed files with 306 additions and 244 deletions
+13 -6
View File
@@ -926,21 +926,28 @@ function lowerExpression(
return { kind: "UnsupportedNode", node: exprNode, loc: exprLoc };
}
if (calleePath.isMemberExpression()) {
const { object, property } = lowerMemberExpression(builder, calleePath);
const memberExpr = lowerMemberExpression(builder, calleePath);
const args = lowerArguments(builder, expr.get("arguments"));
if (typeof property === "string") {
if (typeof memberExpr.property === "string") {
const propertyPlace = buildTemporaryPlace(builder, GeneratedSource);
builder.push({
id: makeInstructionId(0),
lvalue: { ...propertyPlace },
value: memberExpr.value,
loc: GeneratedSource,
});
return {
kind: "PropertyCall",
receiver: object,
property,
receiver: memberExpr.object,
property: { ...propertyPlace },
args,
loc: exprLoc,
};
} else {
return {
kind: "ComputedCall",
receiver: object,
property,
receiver: memberExpr.object,
property: memberExpr.property,
args,
loc: exprLoc,
};
+23 -7
View File
@@ -432,6 +432,28 @@ export type Phi = {
type: Type;
};
/**
* Forget currently does not handle PropertyCall / ComputedCall correctly in
* all cases. Specifically, we do not bind the receiver and method property
* before calling to args. Until we add a SequenceExpression to inline all
* instructions generated when lowering args, we have a limited representation
* with some constraints.
*
* Forget currently makes these assumptions (checked in codegen):
* - {@link PropertyCall.property} is a temporary produced by a PropertyLoad on {@link PropertyCall.receiver}
* - this is always true for PropertyCall, but property.object and receiver
* may be different for ComputedCalls
* - {@link PropertyCall.property} remains an rval (i.e. never promoted to a
* named identifier). We currently rely on this for codegen.
*/
type PropertyCall = {
kind: "PropertyCall";
receiver: Place;
property: Place;
args: Array<Place | SpreadPattern>;
loc: SourceLocation;
};
/**
* The value of a given instruction. Note that values are not recursive: complex
* values such as objects or arrays are always defined by instructions to define
@@ -488,13 +510,7 @@ export type InstructionValue =
args: Array<Place | SpreadPattern>;
loc: SourceLocation;
}
| {
kind: "PropertyCall";
receiver: Place;
property: string;
args: Array<Place | SpreadPattern>;
loc: SourceLocation;
}
| PropertyCall
| {
kind: "ComputedCall";
receiver: Place;
+2
View File
@@ -57,6 +57,7 @@ export function* eachInstructionValueOperand(
}
case "PropertyCall": {
yield instrValue.receiver;
yield instrValue.property;
yield* eachCallArgument(instrValue.args);
break;
}
@@ -357,6 +358,7 @@ export function mapInstructionOperands(
}
case "PropertyCall": {
instrValue.receiver = fn(instrValue.receiver);
instrValue.property = fn(instrValue.property);
instrValue.args = mapCallArguments(instrValue.args, fn);
break;
}
@@ -672,6 +672,7 @@ function inferBlock(
}
state.reference(instrValue.receiver, Effect.Mutate);
state.reference(instrValue.property, Effect.Read);
for (const arg of instrValue.args) {
if (arg.kind === "Identifier") {
state.reference(arg, Effect.Mutate);
@@ -590,13 +590,26 @@ function codegenInstructionValue(
break;
}
case "PropertyCall": {
const receiver = codegenPlace(cx, instrValue.receiver);
const callee = t.memberExpression(
receiver,
t.identifier(instrValue.property)
const memberExpr = codegenPlace(cx, instrValue.property);
invariant(
t.isMemberExpression(memberExpr) ||
t.isOptionalMemberExpression(memberExpr),
"[Codegen] Internal error: PropertyCall::property must be an unpromoted + unmemoized MemberExpression."
);
invariant(
memberExpr.computed === false,
"[Codegen] Internal error: PropertyCall::property must be a non-computed MemberExpression."
);
invariant(
t.isNodesEquivalent(
memberExpr.object,
codegenPlace(cx, instrValue.receiver)
),
"[Codegen] Internal error: Forget should always generate PropertyCall::property " +
"as a MemberExpression of PropertyCall::receiver"
);
const args = instrValue.args.map((arg) => codegenArgument(cx, arg));
value = createCallExpression(instrValue.loc, callee, args);
value = createCallExpression(instrValue.loc, memberExpr, args);
break;
}
case "ComputedCall": {
@@ -19,9 +19,9 @@ function component({ mutator }) {
## Code
```javascript
function component(t27) {
function component(t29) {
const $ = React.unstable_useMemoCache(7);
const { mutator } = t27;
const { mutator } = t29;
const c_0 = $[0] !== mutator;
let t0;
if (c_0) {
@@ -19,46 +19,49 @@ function foo(props) {
```javascript
bb0 (block):
[1] store $35[1:33]:TObject<Array> = Array []
[2] store $37[2:33]:TObject<Array> = StoreLocal Let store x$36[2:33]:TObject<Array> = capture $35[1:33]:TObject<Array>
[3] mutate $38[3:33]:TObject<Array> = LoadLocal capture x$36[2:33]:TObject<Array>
[4] mutate $39 = LoadLocal read props$34
[5] mutate $40 = PropertyLoad read $39.bar
[6] mutate $41 = PropertyCall mutate $38[3:33]:TObject<Array>.push(read $40)
[7] Ternary test:bb2 fallthrough=bb1
[1] store $38[1:36]:TObject<Array> = Array []
[2] store $40[2:36]:TObject<Array> = StoreLocal Let store x$39[2:36]:TObject<Array> = capture $38[1:36]:TObject<Array>
[3] mutate $41[3:36]:TObject<Array> = LoadLocal capture x$39[2:36]:TObject<Array>
[4] mutate $42 = LoadLocal read props$37
[5] mutate $43 = PropertyLoad read $42.bar
[6] mutate $44[6:36] = PropertyLoad read $41[3:36]:TObject<Array>.push
[7] mutate $45 = PropertyCall mutate $41[3:36]:TObject<Array>.[object Object](read $43)
[8] Ternary test:bb2 fallthrough=bb1
bb2 (value):
predecessor blocks: bb0
[8] mutate $42 = LoadLocal read props$34
[9] mutate $43 = PropertyLoad read $42.cond
[10] Branch (read $43) then:bb3 else:bb4
[9] mutate $46 = LoadLocal read props$37
[10] mutate $47 = PropertyLoad read $46.cond
[11] Branch (read $47) then:bb3 else:bb4
bb3 (value):
predecessor blocks: bb2
[14] store $48[14:33]:TObject<Array> = Array []
[15] store $49[15:33]:TObject<Array> = Array [capture $48[14:33]:TObject<Array>]
[16] store $51[16:33] = Destructure Reassign [ mutate x$36[16:33] ] = capture $49[15:33]:TObject<Array>
[17] mutate $52[17:33] = LoadLocal capture x$36[16:33]
[18] mutate $53 = LoadLocal read props$34
[19] mutate $54 = PropertyLoad read $53.foo
[20] mutate $55[20:30] = PropertyCall mutate $52[17:33].push(read $54)
[21] store $57[21:30] = StoreLocal Const mutate $56[7:30] = capture $55[20:30]
[22] Goto bb1
[15] store $52[15:36]:TObject<Array> = Array []
[16] store $53[16:36]:TObject<Array> = Array [capture $52[15:36]:TObject<Array>]
[17] store $55[17:36] = Destructure Reassign [ mutate x$39[17:36] ] = capture $53[16:36]:TObject<Array>
[18] mutate $56[18:36] = LoadLocal capture x$39[17:36]
[19] mutate $57 = LoadLocal read props$37
[20] mutate $58 = PropertyLoad read $57.foo
[21] mutate $59[21:36] = PropertyLoad read $56[18:36].push
[22] mutate $60[22:33] = PropertyCall mutate $56[18:36].[object Object](read $58)
[23] store $62[23:33] = StoreLocal Const mutate $61[8:33] = capture $60[22:33]
[24] Goto bb1
bb4 (value):
predecessor blocks: bb2
[23] mutate $58[23:30]:TPrimitive = null
[24] store $60[24:30]:TPrimitive = StoreLocal Const mutate $56[7:30] = read $58[23:30]:TPrimitive
[25] Goto bb1
[25] mutate $63[25:33]:TPrimitive = null
[26] store $65[26:33]:TPrimitive = StoreLocal Const mutate $61[8:33] = read $63[25:33]:TPrimitive
[27] Goto bb1
bb1 (block):
predecessor blocks: bb3 bb4
$63[7:30]:TPhi: phi(bb3: $56, bb4: $59)
x$36[2:33]:TPhi: phi(bb3: x$36, bb4: x$36)
[26] store $62[26:30] = StoreLocal Const mutate _$61[26:30] = capture $56[7:30]
[27] mutate $64 = Global console
[28] mutate $65[28:30] = LoadLocal capture _$61[26:30]
[29] mutate $66 = PropertyCall read $64.log(mutate $65[28:30])
[30] mutate $67:TFunction = Global mut
[31] mutate $68[31:33] = LoadLocal capture x$36[2:33]
[32] mutate $70 = Call read $67:TFunction(mutate $68[31:33])
[33] mutate $71 = LoadLocal capture x$36[2:33]
[34] Return freeze $71
$68[8:33]:TPhi: phi(bb3: $61, bb4: $64)
x$39[2:36]:TPhi: phi(bb3: x$39, bb4: x$39)
[28] store $67[28:33] = StoreLocal Const mutate _$66[28:33] = capture $61[8:33]
[29] mutate $69 = Global console
[30] mutate $70[30:33] = LoadLocal capture _$66[28:33]
[31] mutate $71 = PropertyLoad read $69.log
[32] mutate $72 = PropertyCall read $69.[object Object](mutate $70[30:33])
[33] mutate $73:TFunction = Global mut
[34] mutate $74[34:36] = LoadLocal capture x$39[2:36]
[35] mutate $76 = Call read $73:TFunction(mutate $74[34:36])
[36] mutate $77 = LoadLocal capture x$39[2:36]
[37] Return freeze $77
```
@@ -18,43 +18,46 @@ function foo(props) {
```javascript
bb0 (block):
[1] store $32[1:7]:TObject<Array> = Array []
[2] store $34[2:7]:TObject<Array> = StoreLocal Let store x$33[2:7]:TObject<Array> = capture $32[1:7]:TObject<Array>
[3] mutate $35[3:7]:TObject<Array> = LoadLocal capture x$33[2:7]:TObject<Array>
[4] mutate $36 = LoadLocal read props$31
[5] mutate $37 = PropertyLoad read $36.bar
[6] mutate $38 = PropertyCall mutate $35[3:7]:TObject<Array>.push(read $37)
[7] Ternary test:bb2 fallthrough=bb1
[1] store $35[1:8]:TObject<Array> = Array []
[2] store $37[2:8]:TObject<Array> = StoreLocal Let store x$36[2:8]:TObject<Array> = capture $35[1:8]:TObject<Array>
[3] mutate $38[3:8]:TObject<Array> = LoadLocal capture x$36[2:8]:TObject<Array>
[4] mutate $39 = LoadLocal read props$34
[5] mutate $40 = PropertyLoad read $39.bar
[6] mutate $41[6:8] = PropertyLoad read $38[3:8]:TObject<Array>.push
[7] mutate $42 = PropertyCall mutate $38[3:8]:TObject<Array>.[object Object](read $40)
[8] Ternary test:bb2 fallthrough=bb1
bb2 (value):
predecessor blocks: bb0
[8] mutate $39 = LoadLocal read props$31
[9] mutate $40 = PropertyLoad read $39.cond
[10] Branch (read $40) then:bb3 else:bb4
[9] mutate $43 = LoadLocal read props$34
[10] mutate $44 = PropertyLoad read $43.cond
[11] Branch (read $44) then:bb3 else:bb4
bb3 (value):
predecessor blocks: bb2
[14] store $45[14:21]:TObject<Array> = Array []
[15] store $46[15:21]:TObject<Array> = Array [capture $45[14:21]:TObject<Array>]
[16] store $48[16:21] = Destructure Reassign [ mutate x$33[16:21] ] = capture $46[15:21]:TObject<Array>
[17] mutate $49[17:21] = LoadLocal capture x$33[16:21]
[18] mutate $50 = LoadLocal read props$31
[19] mutate $51 = PropertyLoad read $50.foo
[20] mutate $52[20:30] = PropertyCall mutate $49[17:21].push(read $51)
[21] store $54[21:30] = StoreLocal Const mutate $53[7:30] = capture $52[20:30]
[22] Goto bb1
[15] store $49[15:23]:TObject<Array> = Array []
[16] store $50[16:23]:TObject<Array> = Array [capture $49[15:23]:TObject<Array>]
[17] store $52[17:23] = Destructure Reassign [ mutate x$36[17:23] ] = capture $50[16:23]:TObject<Array>
[18] mutate $53[18:23] = LoadLocal capture x$36[17:23]
[19] mutate $54 = LoadLocal read props$34
[20] mutate $55 = PropertyLoad read $54.foo
[21] mutate $56[21:23] = PropertyLoad read $53[18:23].push
[22] mutate $57[22:33] = PropertyCall mutate $53[18:23].[object Object](read $55)
[23] store $59[23:33] = StoreLocal Const mutate $58[8:33] = capture $57[22:33]
[24] Goto bb1
bb4 (value):
predecessor blocks: bb2
[23] mutate $55[23:30]:TPrimitive = null
[24] store $57[24:30]:TPrimitive = StoreLocal Const mutate $53[7:30] = read $55[23:30]:TPrimitive
[25] Goto bb1
[25] mutate $60[25:33]:TPrimitive = null
[26] store $62[26:33]:TPrimitive = StoreLocal Const mutate $58[8:33] = read $60[25:33]:TPrimitive
[27] Goto bb1
bb1 (block):
predecessor blocks: bb3 bb4
$60[7:30]:TPhi: phi(bb3: $53, bb4: $56)
x$33:TPhi: phi(bb3: x$33, bb4: x$33)
[26] store $59[26:30] = StoreLocal Const mutate _$58[26:30] = capture $53[7:30]
[27] mutate $61 = Global console
[28] mutate $62[28:30] = LoadLocal capture _$58[26:30]
[29] mutate $63 = PropertyCall read $61.log(mutate $62[28:30])
[30] mutate $64 = LoadLocal capture x$33
[31] Return freeze $64
$65[8:33]:TPhi: phi(bb3: $58, bb4: $61)
x$36:TPhi: phi(bb3: x$36, bb4: x$36)
[28] store $64[28:33] = StoreLocal Const mutate _$63[28:33] = capture $58[8:33]
[29] mutate $66 = Global console
[30] mutate $67[30:33] = LoadLocal capture _$63[28:33]
[31] mutate $68 = PropertyLoad read $66.log
[32] mutate $69 = PropertyCall read $66.[object Object](mutate $67[30:33])
[33] mutate $70 = LoadLocal capture x$36
[34] Return freeze $70
```
@@ -17,45 +17,48 @@ function foo(props) {
```javascript
bb0 (block):
[1] store $33[1:31]:TObject<Array> = Array []
[2] store $35[2:31]:TObject<Array> = StoreLocal Let store x$34[2:31]:TObject<Array> = capture $33[1:31]:TObject<Array>
[3] mutate $36[3:31]:TObject<Array> = LoadLocal capture x$34[2:31]:TObject<Array>
[4] mutate $37 = LoadLocal read props$32
[5] mutate $38 = PropertyLoad read $37.bar
[6] mutate $39 = PropertyCall mutate $36[3:31]:TObject<Array>.push(read $38)
[7] Ternary test:bb2 fallthrough=bb1
[1] store $36[1:34]:TObject<Array> = Array []
[2] store $38[2:34]:TObject<Array> = StoreLocal Let store x$37[2:34]:TObject<Array> = capture $36[1:34]:TObject<Array>
[3] mutate $39[3:34]:TObject<Array> = LoadLocal capture x$37[2:34]:TObject<Array>
[4] mutate $40 = LoadLocal read props$35
[5] mutate $41 = PropertyLoad read $40.bar
[6] mutate $42[6:34] = PropertyLoad read $39[3:34]:TObject<Array>.push
[7] mutate $43 = PropertyCall mutate $39[3:34]:TObject<Array>.[object Object](read $41)
[8] Ternary test:bb2 fallthrough=bb1
bb2 (value):
predecessor blocks: bb0
[8] mutate $40 = LoadLocal read props$32
[9] mutate $41 = PropertyLoad read $40.cond
[10] Branch (read $41) then:bb3 else:bb4
[9] mutate $44 = LoadLocal read props$35
[10] mutate $45 = PropertyLoad read $44.cond
[11] Branch (read $45) then:bb3 else:bb4
bb3 (value):
predecessor blocks: bb2
[13] store $45[13:31]:TObject<Array> = Array []
[14] store $47[14:31]:TObject<Array> = StoreLocal Reassign store x$34[14:31]:TObject<Array> = capture $45[13:31]:TObject<Array>
[15] mutate $48[15:31]:TObject<Array> = LoadLocal capture x$34[14:31]:TObject<Array>
[16] mutate $49 = LoadLocal read props$32
[17] mutate $50 = PropertyLoad read $49.foo
[18] mutate $51[18:28] = PropertyCall mutate $48[15:31]:TObject<Array>.push(read $50)
[19] store $53[19:28] = StoreLocal Const mutate $52[7:28] = capture $51[18:28]
[20] Goto bb1
[14] store $49[14:34]:TObject<Array> = Array []
[15] store $51[15:34]:TObject<Array> = StoreLocal Reassign store x$37[15:34]:TObject<Array> = capture $49[14:34]:TObject<Array>
[16] mutate $52[16:34]:TObject<Array> = LoadLocal capture x$37[15:34]:TObject<Array>
[17] mutate $53 = LoadLocal read props$35
[18] mutate $54 = PropertyLoad read $53.foo
[19] mutate $55[19:34] = PropertyLoad read $52[16:34]:TObject<Array>.push
[20] mutate $56[20:31] = PropertyCall mutate $52[16:34]:TObject<Array>.[object Object](read $54)
[21] store $58[21:31] = StoreLocal Const mutate $57[8:31] = capture $56[20:31]
[22] Goto bb1
bb4 (value):
predecessor blocks: bb2
[21] mutate $54[21:28]:TPrimitive = null
[22] store $56[22:28]:TPrimitive = StoreLocal Const mutate $52[7:28] = read $54[21:28]:TPrimitive
[23] Goto bb1
[23] mutate $59[23:31]:TPrimitive = null
[24] store $61[24:31]:TPrimitive = StoreLocal Const mutate $57[8:31] = read $59[23:31]:TPrimitive
[25] Goto bb1
bb1 (block):
predecessor blocks: bb3 bb4
$59[7:28]:TPhi: phi(bb3: $52, bb4: $55)
x$34[2:31]:TObject<Array>: phi(bb3: x$34, bb4: x$34)
[24] store $58[24:28] = StoreLocal Const mutate _$57[24:28] = capture $52[7:28]
[25] mutate $60 = Global console
[26] mutate $61[26:28] = LoadLocal capture _$57[24:28]
[27] mutate $62 = PropertyCall read $60.log(mutate $61[26:28])
[28] mutate $63:TFunction = Global mut
[29] mutate $64[29:31] = LoadLocal capture x$34[2:31]
[30] mutate $66 = Call read $63:TFunction(mutate $64[29:31])
[31] mutate $67 = LoadLocal capture x$34[2:31]
[32] Return freeze $67
$64[8:31]:TPhi: phi(bb3: $57, bb4: $60)
x$37[2:34]:TObject<Array>: phi(bb3: x$37, bb4: x$37)
[26] store $63[26:31] = StoreLocal Const mutate _$62[26:31] = capture $57[8:31]
[27] mutate $65 = Global console
[28] mutate $66[28:31] = LoadLocal capture _$62[26:31]
[29] mutate $67 = PropertyLoad read $65.log
[30] mutate $68 = PropertyCall read $65.[object Object](mutate $66[28:31])
[31] mutate $69:TFunction = Global mut
[32] mutate $70[32:34] = LoadLocal capture x$37[2:34]
[33] mutate $72 = Call read $69:TFunction(mutate $70[32:34])
[34] mutate $73 = LoadLocal capture x$37[2:34]
[35] Return freeze $73
```
@@ -16,42 +16,45 @@ function foo(props) {
```javascript
bb0 (block):
[1] store $30[1:7]:TObject<Array> = Array []
[2] store $32[2:7]:TObject<Array> = StoreLocal Let store x$31[2:7]:TObject<Array> = capture $30[1:7]:TObject<Array>
[3] mutate $33[3:7]:TObject<Array> = LoadLocal capture x$31[2:7]:TObject<Array>
[4] mutate $34 = LoadLocal read props$29
[5] mutate $35 = PropertyLoad read $34.bar
[6] mutate $36 = PropertyCall mutate $33[3:7]:TObject<Array>.push(read $35)
[7] Ternary test:bb2 fallthrough=bb1
[1] store $33[1:8]:TObject<Array> = Array []
[2] store $35[2:8]:TObject<Array> = StoreLocal Let store x$34[2:8]:TObject<Array> = capture $33[1:8]:TObject<Array>
[3] mutate $36[3:8]:TObject<Array> = LoadLocal capture x$34[2:8]:TObject<Array>
[4] mutate $37 = LoadLocal read props$32
[5] mutate $38 = PropertyLoad read $37.bar
[6] mutate $39[6:8] = PropertyLoad read $36[3:8]:TObject<Array>.push
[7] mutate $40 = PropertyCall mutate $36[3:8]:TObject<Array>.[object Object](read $38)
[8] Ternary test:bb2 fallthrough=bb1
bb2 (value):
predecessor blocks: bb0
[8] mutate $37 = LoadLocal read props$29
[9] mutate $38 = PropertyLoad read $37.cond
[10] Branch (read $38) then:bb3 else:bb4
[9] mutate $41 = LoadLocal read props$32
[10] mutate $42 = PropertyLoad read $41.cond
[11] Branch (read $42) then:bb3 else:bb4
bb3 (value):
predecessor blocks: bb2
[13] store $42[13:19]:TObject<Array> = Array []
[14] store $44[14:19]:TObject<Array> = StoreLocal Reassign store x$31[14:19]:TObject<Array> = capture $42[13:19]:TObject<Array>
[15] mutate $45[15:19]:TObject<Array> = LoadLocal capture x$31[14:19]:TObject<Array>
[16] mutate $46 = LoadLocal read props$29
[17] mutate $47 = PropertyLoad read $46.foo
[18] mutate $48[18:28] = PropertyCall mutate $45[15:19]:TObject<Array>.push(read $47)
[19] store $50[19:28] = StoreLocal Const mutate $49[7:28] = capture $48[18:28]
[20] Goto bb1
[14] store $46[14:21]:TObject<Array> = Array []
[15] store $48[15:21]:TObject<Array> = StoreLocal Reassign store x$34[15:21]:TObject<Array> = capture $46[14:21]:TObject<Array>
[16] mutate $49[16:21]:TObject<Array> = LoadLocal capture x$34[15:21]:TObject<Array>
[17] mutate $50 = LoadLocal read props$32
[18] mutate $51 = PropertyLoad read $50.foo
[19] mutate $52[19:21] = PropertyLoad read $49[16:21]:TObject<Array>.push
[20] mutate $53[20:31] = PropertyCall mutate $49[16:21]:TObject<Array>.[object Object](read $51)
[21] store $55[21:31] = StoreLocal Const mutate $54[8:31] = capture $53[20:31]
[22] Goto bb1
bb4 (value):
predecessor blocks: bb2
[21] mutate $51[21:28]:TPrimitive = null
[22] store $53[22:28]:TPrimitive = StoreLocal Const mutate $49[7:28] = read $51[21:28]:TPrimitive
[23] Goto bb1
[23] mutate $56[23:31]:TPrimitive = null
[24] store $58[24:31]:TPrimitive = StoreLocal Const mutate $54[8:31] = read $56[23:31]:TPrimitive
[25] Goto bb1
bb1 (block):
predecessor blocks: bb3 bb4
$56[7:28]:TPhi: phi(bb3: $49, bb4: $52)
x$31:TObject<Array>: phi(bb3: x$31, bb4: x$31)
[24] store $55[24:28] = StoreLocal Const mutate _$54[24:28] = capture $49[7:28]
[25] mutate $57 = Global console
[26] mutate $58[26:28] = LoadLocal capture _$54[24:28]
[27] mutate $59 = PropertyCall read $57.log(mutate $58[26:28])
[28] mutate $60 = LoadLocal capture x$31
[29] Return freeze $60
$61[8:31]:TPhi: phi(bb3: $54, bb4: $57)
x$34:TObject<Array>: phi(bb3: x$34, bb4: x$34)
[26] store $60[26:31] = StoreLocal Const mutate _$59[26:31] = capture $54[8:31]
[27] mutate $62 = Global console
[28] mutate $63[28:31] = LoadLocal capture _$59[26:31]
[29] mutate $64 = PropertyLoad read $62.log
[30] mutate $65 = PropertyCall read $62.[object Object](mutate $63[28:31])
[31] mutate $66 = LoadLocal capture x$34
[32] Return freeze $66
```
@@ -19,50 +19,54 @@ function foo(props) {
```javascript
bb0 (block):
[1] store $40[1:7]:TObject<Array> = Array []
[2] store $42[2:7]:TObject<Array> = StoreLocal Let store x$41[2:38]:TObject<Array> = capture $40[1:7]:TObject<Array>
[3] mutate $43[3:7]:TObject<Array> = LoadLocal capture x$41[2:38]:TObject<Array>
[4] mutate $44 = LoadLocal read props$39
[5] mutate $45 = PropertyLoad read $44.bar
[6] mutate $46 = PropertyCall mutate $43[3:7]:TObject<Array>.push(read $45)
[7] Ternary test:bb2 fallthrough=bb1
[1] store $44[1:8]:TObject<Array> = Array []
[2] store $46[2:8]:TObject<Array> = StoreLocal Let store x$45[2:42]:TObject<Array> = capture $44[1:8]:TObject<Array>
[3] mutate $47[3:8]:TObject<Array> = LoadLocal capture x$45[2:42]:TObject<Array>
[4] mutate $48 = LoadLocal read props$43
[5] mutate $49 = PropertyLoad read $48.bar
[6] mutate $50[6:8] = PropertyLoad read $47[3:8]:TObject<Array>.push
[7] mutate $51 = PropertyCall mutate $47[3:8]:TObject<Array>.[object Object](read $49)
[8] Ternary test:bb2 fallthrough=bb1
bb2 (value):
predecessor blocks: bb0
[8] mutate $47 = LoadLocal read props$39
[9] mutate $48 = PropertyLoad read $47.cond
[10] Branch (read $48) then:bb3 else:bb4
[9] mutate $52 = LoadLocal read props$43
[10] mutate $53 = PropertyLoad read $52.cond
[11] Branch (read $53) then:bb3 else:bb4
bb3 (value):
predecessor blocks: bb2
[13] store $52[13:38]:TObject<Array> = Array []
[14] store $54[14:38]:TObject<Array> = StoreLocal Reassign store x$41[14:38]:TObject<Array> = capture $52[13:38]:TObject<Array>
[15] mutate $55[15:38]:TObject<Array> = LoadLocal capture x$41[14:38]:TObject<Array>
[16] mutate $56 = LoadLocal read props$39
[17] mutate $57 = PropertyLoad read $56.foo
[18] mutate $58[18:35] = PropertyCall mutate $55[15:38]:TObject<Array>.push(read $57)
[19] store $60[19:35] = StoreLocal Const mutate $59[7:35] = capture $58[18:35]
[20] Goto bb1
[14] store $57[14:42]:TObject<Array> = Array []
[15] store $59[15:42]:TObject<Array> = StoreLocal Reassign store x$45[15:42]:TObject<Array> = capture $57[14:42]:TObject<Array>
[16] mutate $60[16:42]:TObject<Array> = LoadLocal capture x$45[15:42]:TObject<Array>
[17] mutate $61 = LoadLocal read props$43
[18] mutate $62 = PropertyLoad read $61.foo
[19] mutate $63[19:42] = PropertyLoad read $60[16:42]:TObject<Array>.push
[20] mutate $64[20:39] = PropertyCall mutate $60[16:42]:TObject<Array>.[object Object](read $62)
[21] store $66[21:39] = StoreLocal Const mutate $65[8:39] = capture $64[20:39]
[22] Goto bb1
bb4 (value):
predecessor blocks: bb2
[23] store $64[23:38]:TObject<Array> = Array []
[24] store $66[24:38]:TObject<Array> = StoreLocal Reassign store x$41[24:38]:TObject<Array> = capture $64[23:38]:TObject<Array>
[25] mutate $67[25:38]:TObject<Array> = LoadLocal capture x$41[24:38]:TObject<Array>
[26] mutate $68 = LoadLocal read props$39
[27] mutate $69 = PropertyLoad read $68.bar
[28] mutate $70[28:35] = PropertyCall mutate $67[25:38]:TObject<Array>.push(read $69)
[29] store $72[29:35] = StoreLocal Const mutate $59[7:35] = capture $70[28:35]
[30] Goto bb1
[25] store $70[25:42]:TObject<Array> = Array []
[26] store $72[26:42]:TObject<Array> = StoreLocal Reassign store x$45[26:42]:TObject<Array> = capture $70[25:42]:TObject<Array>
[27] mutate $73[27:42]:TObject<Array> = LoadLocal capture x$45[26:42]:TObject<Array>
[28] mutate $74 = LoadLocal read props$43
[29] mutate $75 = PropertyLoad read $74.bar
[30] mutate $76[30:42] = PropertyLoad read $73[27:42]:TObject<Array>.push
[31] mutate $77[31:39] = PropertyCall mutate $73[27:42]:TObject<Array>.[object Object](read $75)
[32] store $79[32:39] = StoreLocal Const mutate $65[8:39] = capture $77[31:39]
[33] Goto bb1
bb1 (block):
predecessor blocks: bb3 bb4
$75[7:35]:TPhi: phi(bb3: $59, bb4: $71)
x$41[14:38]:TObject<Array>: phi(bb3: x$41, bb4: x$41)
[31] store $74[31:35] = StoreLocal Const mutate _$73[31:35] = capture $59[7:35]
[32] mutate $76 = Global console
[33] mutate $77[33:35] = LoadLocal capture _$73[31:35]
[34] mutate $78 = PropertyCall read $76.log(mutate $77[33:35])
[35] mutate $79:TFunction = Global mut
[36] mutate $80[36:38] = LoadLocal capture x$41[14:38]
[37] mutate $82 = Call read $79:TFunction(mutate $80[36:38])
[38] mutate $83 = LoadLocal capture x$41[14:38]
[39] Return freeze $83
$82[8:39]:TPhi: phi(bb3: $65, bb4: $78)
x$45[15:42]:TObject<Array>: phi(bb3: x$45, bb4: x$45)
[34] store $81[34:39] = StoreLocal Const mutate _$80[34:39] = capture $65[8:39]
[35] mutate $83 = Global console
[36] mutate $84[36:39] = LoadLocal capture _$80[34:39]
[37] mutate $85 = PropertyLoad read $83.log
[38] mutate $86 = PropertyCall read $83.[object Object](mutate $84[36:39])
[39] mutate $87:TFunction = Global mut
[40] mutate $88[40:42] = LoadLocal capture x$45[15:42]
[41] mutate $90 = Call read $87:TFunction(mutate $88[40:42])
[42] mutate $91 = LoadLocal capture x$45[15:42]
[43] Return freeze $91
```
@@ -18,47 +18,51 @@ function foo(props) {
```javascript
bb0 (block):
[1] store $37[1:7]:TObject<Array> = Array []
[2] store $39[2:7]:TObject<Array> = StoreLocal Let store x$38[2:7]:TObject<Array> = capture $37[1:7]:TObject<Array>
[3] mutate $40[3:7]:TObject<Array> = LoadLocal capture x$38[2:7]:TObject<Array>
[4] mutate $41 = LoadLocal read props$36
[5] mutate $42 = PropertyLoad read $41.bar
[6] mutate $43 = PropertyCall mutate $40[3:7]:TObject<Array>.push(read $42)
[7] Ternary test:bb2 fallthrough=bb1
[1] store $41[1:8]:TObject<Array> = Array []
[2] store $43[2:8]:TObject<Array> = StoreLocal Let store x$42[2:8]:TObject<Array> = capture $41[1:8]:TObject<Array>
[3] mutate $44[3:8]:TObject<Array> = LoadLocal capture x$42[2:8]:TObject<Array>
[4] mutate $45 = LoadLocal read props$40
[5] mutate $46 = PropertyLoad read $45.bar
[6] mutate $47[6:8] = PropertyLoad read $44[3:8]:TObject<Array>.push
[7] mutate $48 = PropertyCall mutate $44[3:8]:TObject<Array>.[object Object](read $46)
[8] Ternary test:bb2 fallthrough=bb1
bb2 (value):
predecessor blocks: bb0
[8] mutate $44 = LoadLocal read props$36
[9] mutate $45 = PropertyLoad read $44.cond
[10] Branch (read $45) then:bb3 else:bb4
[9] mutate $49 = LoadLocal read props$40
[10] mutate $50 = PropertyLoad read $49.cond
[11] Branch (read $50) then:bb3 else:bb4
bb3 (value):
predecessor blocks: bb2
[13] store $49[13:19]:TObject<Array> = Array []
[14] store $51[14:19]:TObject<Array> = StoreLocal Reassign store x$38[14:19]:TObject<Array> = capture $49[13:19]:TObject<Array>
[15] mutate $52[15:19]:TObject<Array> = LoadLocal capture x$38[14:19]:TObject<Array>
[16] mutate $53 = LoadLocal read props$36
[17] mutate $54 = PropertyLoad read $53.foo
[18] mutate $55[18:35] = PropertyCall mutate $52[15:19]:TObject<Array>.push(read $54)
[19] store $57[19:35] = StoreLocal Const mutate $56[7:35] = capture $55[18:35]
[20] Goto bb1
[14] store $54[14:21]:TObject<Array> = Array []
[15] store $56[15:21]:TObject<Array> = StoreLocal Reassign store x$42[15:21]:TObject<Array> = capture $54[14:21]:TObject<Array>
[16] mutate $57[16:21]:TObject<Array> = LoadLocal capture x$42[15:21]:TObject<Array>
[17] mutate $58 = LoadLocal read props$40
[18] mutate $59 = PropertyLoad read $58.foo
[19] mutate $60[19:21] = PropertyLoad read $57[16:21]:TObject<Array>.push
[20] mutate $61[20:39] = PropertyCall mutate $57[16:21]:TObject<Array>.[object Object](read $59)
[21] store $63[21:39] = StoreLocal Const mutate $62[8:39] = capture $61[20:39]
[22] Goto bb1
bb4 (value):
predecessor blocks: bb2
[23] store $61[23:29]:TObject<Array> = Array []
[24] store $63[24:29]:TObject<Array> = StoreLocal Reassign store x$38[24:29]:TObject<Array> = capture $61[23:29]:TObject<Array>
[25] mutate $64[25:29]:TObject<Array> = LoadLocal capture x$38[24:29]:TObject<Array>
[26] mutate $65 = LoadLocal read props$36
[27] mutate $66 = PropertyLoad read $65.bar
[28] mutate $67[28:35] = PropertyCall mutate $64[25:29]:TObject<Array>.push(read $66)
[29] store $69[29:35] = StoreLocal Const mutate $56[7:35] = capture $67[28:35]
[30] Goto bb1
[25] store $67[25:32]:TObject<Array> = Array []
[26] store $69[26:32]:TObject<Array> = StoreLocal Reassign store x$42[26:32]:TObject<Array> = capture $67[25:32]:TObject<Array>
[27] mutate $70[27:32]:TObject<Array> = LoadLocal capture x$42[26:32]:TObject<Array>
[28] mutate $71 = LoadLocal read props$40
[29] mutate $72 = PropertyLoad read $71.bar
[30] mutate $73[30:32] = PropertyLoad read $70[27:32]:TObject<Array>.push
[31] mutate $74[31:39] = PropertyCall mutate $70[27:32]:TObject<Array>.[object Object](read $72)
[32] store $76[32:39] = StoreLocal Const mutate $62[8:39] = capture $74[31:39]
[33] Goto bb1
bb1 (block):
predecessor blocks: bb3 bb4
$72[7:35]:TPhi: phi(bb3: $56, bb4: $68)
x$38:TObject<Array>: phi(bb3: x$38, bb4: x$38)
[31] store $71[31:35] = StoreLocal Const mutate _$70[31:35] = capture $56[7:35]
[32] mutate $73 = Global console
[33] mutate $74[33:35] = LoadLocal capture _$70[31:35]
[34] mutate $75 = PropertyCall read $73.log(mutate $74[33:35])
[35] mutate $76 = LoadLocal capture x$38
[36] Return freeze $76
$79[8:39]:TPhi: phi(bb3: $62, bb4: $75)
x$42:TObject<Array>: phi(bb3: x$42, bb4: x$42)
[34] store $78[34:39] = StoreLocal Const mutate _$77[34:39] = capture $62[8:39]
[35] mutate $80 = Global console
[36] mutate $81[36:39] = LoadLocal capture _$77[34:39]
[37] mutate $82 = PropertyLoad read $80.log
[38] mutate $83 = PropertyCall read $80.[object Object](mutate $81[36:39])
[39] mutate $84 = LoadLocal capture x$42
[40] Return freeze $84
```
@@ -24,40 +24,43 @@ function foo(props) {
```javascript
bb0 (block):
[1] store $32[1:7]:TObject<Array> = Array []
[2] store $34[2:7]:TObject<Array> = StoreLocal Let store x$33[2:31]:TObject<Array> = capture $32[1:7]:TObject<Array>
[3] mutate $35[3:7]:TObject<Array> = LoadLocal capture x$33[2:31]:TObject<Array>
[4] mutate $36 = LoadLocal read props$31
[5] mutate $37 = PropertyLoad read $36.bar
[6] mutate $38 = PropertyCall mutate $35[3:7]:TObject<Array>.push(read $37)
[7] mutate $39 = LoadLocal read props$31
[8] mutate $40 = PropertyLoad read $39.cond
[9] If (read $40) then:bb2 else:bb3 fallthrough=bb1
[1] store $35[1:8]:TObject<Array> = Array []
[2] store $37[2:8]:TObject<Array> = StoreLocal Let store x$36[2:34]:TObject<Array> = capture $35[1:8]:TObject<Array>
[3] mutate $38[3:8]:TObject<Array> = LoadLocal capture x$36[2:34]:TObject<Array>
[4] mutate $39 = LoadLocal read props$34
[5] mutate $40 = PropertyLoad read $39.bar
[6] mutate $41[6:8] = PropertyLoad read $38[3:8]:TObject<Array>.push
[7] mutate $42 = PropertyCall mutate $38[3:8]:TObject<Array>.[object Object](read $40)
[8] mutate $43 = LoadLocal read props$34
[9] mutate $44 = PropertyLoad read $43.cond
[10] If (read $44) then:bb2 else:bb3 fallthrough=bb1
bb2 (block):
predecessor blocks: bb0
[12] store $44[12:31]:TObject<Array> = Array []
[13] store $46[13:31]:TObject<Array> = StoreLocal Reassign store x$33[13:31]:TObject<Array> = capture $44[12:31]:TObject<Array>
[14] mutate $47[14:31]:TObject<Array> = LoadLocal capture x$33[13:31]:TObject<Array>
[15] mutate $48 = LoadLocal read props$31
[16] mutate $49 = PropertyLoad read $48.foo
[17] mutate $50 = PropertyCall mutate $47[14:31]:TObject<Array>.push(read $49)
[18] Goto bb1
[13] store $48[13:34]:TObject<Array> = Array []
[14] store $50[14:34]:TObject<Array> = StoreLocal Reassign store x$36[14:34]:TObject<Array> = capture $48[13:34]:TObject<Array>
[15] mutate $51[15:34]:TObject<Array> = LoadLocal capture x$36[14:34]:TObject<Array>
[16] mutate $52 = LoadLocal read props$34
[17] mutate $53 = PropertyLoad read $52.foo
[18] mutate $54[18:34] = PropertyLoad read $51[15:34]:TObject<Array>.push
[19] mutate $55 = PropertyCall mutate $51[15:34]:TObject<Array>.[object Object](read $53)
[20] Goto bb1
bb3 (block):
predecessor blocks: bb0
[21] store $54[21:31]:TObject<Array> = Array []
[22] store $56[22:31]:TObject<Array> = StoreLocal Reassign store x$33[22:31]:TObject<Array> = capture $54[21:31]:TObject<Array>
[23] mutate $57[23:31]:TObject<Array> = LoadLocal capture x$33[22:31]:TObject<Array>
[24] mutate $58 = LoadLocal read props$31
[25] mutate $59 = PropertyLoad read $58.bar
[26] mutate $60 = PropertyCall mutate $57[23:31]:TObject<Array>.push(read $59)
[27] Goto bb1
[23] store $59[23:34]:TObject<Array> = Array []
[24] store $61[24:34]:TObject<Array> = StoreLocal Reassign store x$36[24:34]:TObject<Array> = capture $59[23:34]:TObject<Array>
[25] mutate $62[25:34]:TObject<Array> = LoadLocal capture x$36[24:34]:TObject<Array>
[26] mutate $63 = LoadLocal read props$34
[27] mutate $64 = PropertyLoad read $63.bar
[28] mutate $65[28:34] = PropertyLoad read $62[25:34]:TObject<Array>.push
[29] mutate $66 = PropertyCall mutate $62[25:34]:TObject<Array>.[object Object](read $64)
[30] Goto bb1
bb1 (block):
predecessor blocks: bb2 bb3
x$33[13:31]:TObject<Array>: phi(bb2: x$33, bb3: x$33)
[28] mutate $61:TFunction = Global mut
[29] mutate $62[29:31] = LoadLocal capture x$33[13:31]
[30] mutate $64 = Call read $61:TFunction(mutate $62[29:31])
[31] mutate $65 = LoadLocal capture x$33[13:31]
[32] Return freeze $65
x$36[14:34]:TObject<Array>: phi(bb2: x$36, bb3: x$36)
[31] mutate $67:TFunction = Global mut
[32] mutate $68[32:34] = LoadLocal capture x$36[14:34]
[33] mutate $70 = Call read $67:TFunction(mutate $68[32:34])
[34] mutate $71 = LoadLocal capture x$36[14:34]
[35] Return freeze $71
```