perf(ivy): avoid generating extra parameters for host property bindings (#31550)
Currently we reuse the same instruction both for regular property bindings and property bindings on the `host`. The only difference between the two is that when it's on the host we shouldn't support inputs. We have an optional parameter called `nativeOnly` which is used to differentiate the two, however since `nativeOnly` is preceeded by another optional parameter (`sanitizer`), we have to generate two extra parameters for each host property bindings every time (e.g. `property('someProp', 'someValue', null, true)`). These changes add a new instruction called `hostProperty` which avoids the need for the two parameters by removing `nativeOnly` which is always set and it allows us to omit `sanitizer` when it isn't being used. These changes also remove the `nativeOnly` parameter from the `updateSyntheticHostBinding` instruction, because it's only generated for host elements which means that we can assume that its value will always be `true`. PR Close #31550
This commit is contained in:
@ -642,7 +642,7 @@ describe('compiler compliance: bindings', () => {
|
||||
$r3$.ɵɵallocHostVars(1);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵɵproperty("id", ctx.dirId, null, true);
|
||||
$r3$.ɵɵhostProperty("id", ctx.dirId);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -689,7 +689,7 @@ describe('compiler compliance: bindings', () => {
|
||||
$r3$.ɵɵallocHostVars(3);
|
||||
}
|
||||
if (rf & 2) {
|
||||
$r3$.ɵɵproperty("id", $r3$.ɵɵpureFunction1(1, $ff$, ctx.id), null, true);
|
||||
$r3$.ɵɵhostProperty("id", $r3$.ɵɵpureFunction1(1, $ff$, ctx.id));
|
||||
}
|
||||
},
|
||||
consts: 0,
|
||||
@ -888,7 +888,7 @@ describe('compiler compliance: bindings', () => {
|
||||
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
|
||||
…
|
||||
if (rf & 2) {
|
||||
$r3$.ɵɵproperty("title", ctx.myTitle, null, true)("tabindex", 1, null, true)("id", ctx.myId, null, true);
|
||||
$r3$.ɵɵhostProperty("title", ctx.myTitle)("tabindex", 1)("id", ctx.myId);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -924,7 +924,7 @@ describe('compiler compliance: bindings', () => {
|
||||
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
|
||||
…
|
||||
if (rf & 2) {
|
||||
$r3$.ɵɵproperty("tabindex", 1, null, true)("title", ctx.myTitle, null, true)("id", ctx.myId, null, true);
|
||||
$r3$.ɵɵhostProperty("tabindex", 1)("title", ctx.myTitle)("id", ctx.myId);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -956,7 +956,7 @@ describe('compiler compliance: bindings', () => {
|
||||
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
|
||||
…
|
||||
if (rf & 2) {
|
||||
$r3$.ɵɵproperty("title", "my title", null, true)("id", "my-id", null, true);
|
||||
$r3$.ɵɵhostProperty("title", "my title")("id", "my-id");
|
||||
$r3$.ɵɵattribute("tabindex", 1);
|
||||
}
|
||||
}
|
||||
@ -992,7 +992,7 @@ describe('compiler compliance: bindings', () => {
|
||||
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
|
||||
…
|
||||
if (rf & 2) {
|
||||
$r3$.ɵɵupdateSyntheticHostBinding("@expand", ctx.expandedState, null, true)("@fadeOut", true, null, true)("@shrink", ctx.isSmall, null, true);
|
||||
$r3$.ɵɵupdateSyntheticHostBinding("@expand", ctx.expandedState)("@fadeOut", true)("@shrink", ctx.isSmall);
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1095,7 +1095,7 @@ describe('compiler compliance: bindings', () => {
|
||||
hostBindings: function MyDirective_HostBindings(rf, ctx, elIndex) {
|
||||
…
|
||||
if (rf & 2) {
|
||||
$r3$.ɵɵproperty("tabindex", 1, null, true);
|
||||
$r3$.ɵɵhostProperty("tabindex", 1);
|
||||
$r3$.ɵɵattribute("title", "my title")("id", "my-id");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user