perf(ivy): remove unnecessary view type checks (#31959)

PR Close #31959
This commit is contained in:
Pawel Kozlowski 2019-08-02 11:50:48 +02:00 committed by Alex Rickabaugh
parent 6f98107d5e
commit 9d1f43f3ba
5 changed files with 17 additions and 60 deletions

View File

@ -12,7 +12,7 @@
"master": {
"uncompressed": {
"runtime": 1440,
"main": 14021,
"main": 13517,
"polyfills": 43567
}
}

View File

@ -387,7 +387,8 @@ export function createEmbeddedViewAndNode<T>(
}
/**
* Used for rendering embedded views (e.g. dynamically created views)
* Used for rendering views in a LContainer (embedded views or root component views for dynamically
* created components).
*
* Dynamically created views must store/retrieve their TViews differently from component views
* because their template functions are nested in the template functions of their hosts, creating
@ -401,16 +402,15 @@ export function renderEmbeddedTemplate<T>(viewToRender: LView, tView: TView, con
const _isParent = getIsParent();
const _previousOrParentTNode = getPreviousOrParentTNode();
let oldView: LView;
if (viewToRender[FLAGS] & LViewFlags.IsRoot) {
// This is a root view inside the view tree
tickRootContext(getRootContext(viewToRender));
} else {
// Will become true if the `try` block executes with no errors.
let safeToRunHooks = false;
try {
oldView = enterView(viewToRender, viewToRender[T_HOST]);
resetPreOrderHookFlags(viewToRender);
executeTemplate(viewToRender, tView.template !, getRenderFlags(viewToRender), context);
const templateFn = tView.template;
if (templateFn !== null) {
executeTemplate(viewToRender, templateFn, getRenderFlags(viewToRender), context);
}
refreshDescendantViews(viewToRender);
safeToRunHooks = true;
} finally {
@ -418,7 +418,6 @@ export function renderEmbeddedTemplate<T>(viewToRender: LView, tView: TView, con
setPreviousOrParentTNode(_previousOrParentTNode, _isParent);
}
}
}
export function renderComponentOrTemplate<T>(
hostView: LView, context: T, templateFn?: ComponentTemplate<T>) {

View File

@ -404,12 +404,6 @@
{
"name": "getRenderParent"
},
{
"name": "getRootContext"
},
{
"name": "getRootView"
},
{
"name": "getSelectedIndex"
},
@ -548,12 +542,6 @@
{
"name": "postProcessDirective"
},
{
"name": "readPatchedData"
},
{
"name": "readPatchedLView"
},
{
"name": "refreshChildComponents"
},
@ -578,9 +566,6 @@
{
"name": "renderComponent"
},
{
"name": "renderComponentOrTemplate"
},
{
"name": "renderEmbeddedTemplate"
},
@ -686,9 +671,6 @@
{
"name": "throwMultipleComponentError"
},
{
"name": "tickRootContext"
},
{
"name": "unwrapRNode"
},

View File

@ -326,12 +326,6 @@
{
"name": "getRenderParent"
},
{
"name": "getRootContext"
},
{
"name": "getRootView"
},
{
"name": "getSelectedIndex"
},
@ -413,12 +407,6 @@
{
"name": "postProcessBaseDirective"
},
{
"name": "readPatchedData"
},
{
"name": "readPatchedLView"
},
{
"name": "refreshChildComponents"
},
@ -434,9 +422,6 @@
{
"name": "renderComponent"
},
{
"name": "renderComponentOrTemplate"
},
{
"name": "renderEmbeddedTemplate"
},
@ -500,9 +485,6 @@
{
"name": "syncViewWithBlueprint"
},
{
"name": "tickRootContext"
},
{
"name": "unwrapRNode"
},

View File

@ -899,12 +899,6 @@
{
"name": "getRenderer"
},
{
"name": "getRootContext"
},
{
"name": "getRootView"
},
{
"name": "getSelectedIndex"
},