Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ivy): merge directives into LViewData #26316

Closed
wants to merge 2 commits into from
Closed

Conversation

kara
Copy link
Contributor

@kara kara commented Oct 9, 2018

This PR flattens the LViewData[DIRECTIVES] array into LViewData and the TView.directives array into TView.data. This reduces memory pressure by avoiding the creation of unnecessary nested arrays. It also implements the host binding algorithm outlined in VIEW_DATA.md.

Notes:

  • loadDirective() was being used in hostBinding and contentQueries functions as a special instruction to read from the directives array. Now that there isn't a directives array, we can simply use the existing load() instruction in these cases, so the loadDirective() instruction has been removed.
  • We were also using loadDirective() in a number of places as a testing utility. This can't really be replaced with load() because now that directives are flat, it's harder to predict where the directive will live in viewData (e.g. there might be other directives with injectors and host bindings ahead of it), so I've created a new testing utility to replace it called getDirectiveOnNode(). This takes the node index and an optional directive offset.
  • We were previously creating a node injector for any node that injected special tokens, like ElementRef. This is unnecessary given that they are created using factories, so injecting these tokens no longer triggers the creation of an injector on its own.
  • We were also creating a node injector for directives private to DI if they happened to inject something else. This also isn't correct since the injector it would create would be empty. Now nodes with only private directives that have injectables will simply skip to the parent injector.

For more information about this change, see VIEW_DATA.md.

@kara kara added action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release comp: ivy refactoring Issue that involves refactoring or code-cleanup labels Oct 9, 2018
@kara kara requested a review from mhevery October 9, 2018 05:17
@mary-poppins
Copy link

You can preview 802d257 at https://pr26316-802d257.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 3f26161 at https://pr26316-3f26161.ngbuilds.io/.

@kara kara removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 9, 2018
@kara
Copy link
Contributor Author

kara commented Oct 9, 2018

presubmit

@kara kara added the action: merge The PR is ready for merge by the caretaker label Oct 9, 2018
@kara
Copy link
Contributor Author

kara commented Oct 9, 2018

@jasonaden AIO local test keeps flaking, so I can't get this green

Update: green now

@kara kara added merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Oct 9, 2018
@jasonaden jasonaden closed this in b087904 Oct 9, 2018
jasonaden pushed a commit that referenced this pull request Oct 9, 2018
pkozlowski-opensource added a commit to pkozlowski-opensource/angular that referenced this pull request Oct 10, 2018
mhevery pushed a commit that referenced this pull request Oct 11, 2018
FrederikSchlemmer pushed a commit to FrederikSchlemmer/angular that referenced this pull request Jan 3, 2019
FrederikSchlemmer pushed a commit to FrederikSchlemmer/angular that referenced this pull request Jan 3, 2019
FrederikSchlemmer pushed a commit to FrederikSchlemmer/angular that referenced this pull request Jan 3, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes refactoring Issue that involves refactoring or code-cleanup target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants