{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/prepack/pulls/comments/175918934","pull_request_review_id":105532087,"id":175918934,"diff_hunk":"@@ -295,19 +350,28 @@ export class Functions {\n     return call.bind(this, globalThis, args);\n   }\n \n+  _optimizeFunction(funcValue: ECMAScriptSourceFunctionValue | BoundFunctionValue) {\n+    let call = this._callOfFunction(funcValue);\n+    let effects = this.realm.evaluatePure(() =>\n+      this.realm.evaluateForEffectsInGlobalEnv(call, undefined, \"additional function\")\n+    );\n+    invariant(effects);\n+    let additionalFunctionEffects = this._createAdditionalEffects(effects, true);\n+    invariant(additionalFunctionEffects);\n+    if (funcValue instanceof BoundFunctionValue) {\n+      invariant(funcValue.$BoundTargetFunction instanceof ECMAScriptSourceFunctionValue);\n+      this.writeEffects.set(funcValue.$BoundTargetFunction, additionalFunctionEffects);","path":"src/serializer/functions.js","position":181,"original_position":181,"commit_id":"2c253369f98468ce43157c34c757d6ff35accafe","original_commit_id":"2c253369f98468ce43157c34c757d6ff35accafe","user":{"login":"NTillmann","id":6457462,"avatar_url":"https://avatars2.githubusercontent.com/u/6457462?v=4","gravatar_id":"","url":"https://api.github.com/users/NTillmann","html_url":"https://github.com/NTillmann","followers_url":"https://api.github.com/users/NTillmann/followers","following_url":"https://api.github.com/users/NTillmann/following{/other_user}","gists_url":"https://api.github.com/users/NTillmann/gists{/gist_id}","starred_url":"https://api.github.com/users/NTillmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NTillmann/subscriptions","organizations_url":"https://api.github.com/users/NTillmann/orgs","repos_url":"https://api.github.com/users/NTillmann/repos","events_url":"https://api.github.com/users/NTillmann/events{/privacy}","received_events_url":"https://api.github.com/users/NTillmann/received_events","type":"User","site_admin":false},"body":"I now see that `callOfFunction` does something similar. Then why not do it once at the top of `_optimizeFunction`?","created_at":"2018-03-20T20:54:20Z","updated_at":"2018-03-20T20:54:20Z","html_url":"https://github.com/facebook/prepack/pull/1614#discussion_r175918934","pull_request_url":"https://api.github.com/repos/facebook/prepack/pulls/1614","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/facebook/prepack/pulls/comments/175918934"},"html":{"href":"https://github.com/facebook/prepack/pull/1614#discussion_r175918934"},"pull_request":{"href":"https://api.github.com/repos/facebook/prepack/pulls/1614"}},"in_reply_to_id":175918706},"pull_request":{"url":"https://api.github.com/repos/facebook/prepack/pulls/1614","id":175958449,"html_url":"https://github.com/facebook/prepack/pull/1614","diff_url":"https://github.com/facebook/prepack/pull/1614.diff","patch_url":"https://github.com/facebook/prepack/pull/1614.patch","issue_url":"https://api.github.com/repos/facebook/prepack/issues/1614","number":1614,"state":"open","locked":false,"title":"[WIP] React Reconciler - add nested optimized function support","user":{"login":"trueadm","id":1519870,"avatar_url":"https://avatars0.githubusercontent.com/u/1519870?v=4","gravatar_id":"","url":"https://api.github.com/users/trueadm","html_url":"https://github.com/trueadm","followers_url":"https://api.github.com/users/trueadm/followers","following_url":"https://api.github.com/users/trueadm/following{/other_user}","gists_url":"https://api.github.com/users/trueadm/gists{/gist_id}","starred_url":"https://api.github.com/users/trueadm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trueadm/subscriptions","organizations_url":"https://api.github.com/users/trueadm/orgs","repos_url":"https://api.github.com/users/trueadm/repos","events_url":"https://api.github.com/users/trueadm/events{/privacy}","received_events_url":"https://api.github.com/users/trueadm/received_events","type":"User","site_admin":false},"body":"Release notes: none\r\n\r\nThis is a pretty big refactor of how nested optimized functions get handled by the React reconciler. Now when we enter the React reconciler phase we mark **every** function value encounter during that evaluation effects of a React component render phase. Once we've done that we then go back through all the functions we found and try and optimize them all and if needed, putting them through through the reconciliation phase independently.\r\n\r\nI still need to add a bunch of tests.","created_at":"2018-03-19T16:42:34Z","updated_at":"2018-03-20T20:54:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe1fcc615735905748d32c67b0914665316a745d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":279345275,"url":"https://api.github.com/repos/facebook/prepack/labels/CLA%20Signed","name":"CLA Signed","color":"009900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/prepack/pulls/1614/commits","review_comments_url":"https://api.github.com/repos/facebook/prepack/pulls/1614/comments","review_comment_url":"https://api.github.com/repos/facebook/prepack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/prepack/issues/1614/comments","statuses_url":"https://api.github.com/repos/facebook/prepack/statuses/2c253369f98468ce43157c34c757d6ff35accafe","head":{"label":"trueadm:track-all-closures-in-react-reconcilation","ref":"track-all-closures-in-react-reconcilation","sha":"2c253369f98468ce43157c34c757d6ff35accafe","user":{"login":"trueadm","id":1519870,"avatar_url":"https://avatars0.githubusercontent.com/u/1519870?v=4","gravatar_id":"","url":"https://api.github.com/users/trueadm","html_url":"https://github.com/trueadm","followers_url":"https://api.github.com/users/trueadm/followers","following_url":"https://api.github.com/users/trueadm/following{/other_user}","gists_url":"https://api.github.com/users/trueadm/gists{/gist_id}","starred_url":"https://api.github.com/users/trueadm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trueadm/subscriptions","organizations_url":"https://api.github.com/users/trueadm/orgs","repos_url":"https://api.github.com/users/trueadm/repos","events_url":"https://api.github.com/users/trueadm/events{/privacy}","received_events_url":"https://api.github.com/users/trueadm/received_events","type":"User","site_admin":false},"repo":{"id":101437011,"name":"prepack","full_name":"trueadm/prepack","owner":{"login":"trueadm","id":1519870,"avatar_url":"https://avatars0.githubusercontent.com/u/1519870?v=4","gravatar_id":"","url":"https://api.github.com/users/trueadm","html_url":"https://github.com/trueadm","followers_url":"https://api.github.com/users/trueadm/followers","following_url":"https://api.github.com/users/trueadm/following{/other_user}","gists_url":"https://api.github.com/users/trueadm/gists{/gist_id}","starred_url":"https://api.github.com/users/trueadm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trueadm/subscriptions","organizations_url":"https://api.github.com/users/trueadm/orgs","repos_url":"https://api.github.com/users/trueadm/repos","events_url":"https://api.github.com/users/trueadm/events{/privacy}","received_events_url":"https://api.github.com/users/trueadm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/trueadm/prepack","description":"Prepack is a partial evaluator for JavaScript. Prepack rewrites a JavaScript bundle, resulting in JavaScript code that executes more efficiently.","fork":true,"url":"https://api.github.com/repos/trueadm/prepack","forks_url":"https://api.github.com/repos/trueadm/prepack/forks","keys_url":"https://api.github.com/repos/trueadm/prepack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trueadm/prepack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trueadm/prepack/teams","hooks_url":"https://api.github.com/repos/trueadm/prepack/hooks","issue_events_url":"https://api.github.com/repos/trueadm/prepack/issues/events{/number}","events_url":"https://api.github.com/repos/trueadm/prepack/events","assignees_url":"https://api.github.com/repos/trueadm/prepack/assignees{/user}","branches_url":"https://api.github.com/repos/trueadm/prepack/branches{/branch}","tags_url":"https://api.github.com/repos/trueadm/prepack/tags","blobs_url":"https://api.github.com/repos/trueadm/prepack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trueadm/prepack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trueadm/prepack/git/refs{/sha}","trees_url":"https://api.github.com/repos/trueadm/prepack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trueadm/prepack/statuses/{sha}","languages_url":"https://api.github.com/repos/trueadm/prepack/languages","stargazers_url":"https://api.github.com/repos/trueadm/prepack/stargazers","contributors_url":"https://api.github.com/repos/trueadm/prepack/contributors","subscribers_url":"https://api.github.com/repos/trueadm/prepack/subscribers","subscription_url":"https://api.github.com/repos/trueadm/prepack/subscription","commits_url":"https://api.github.com/repos/trueadm/prepack/commits{/sha}","git_commits_url":"https://api.github.com/repos/trueadm/prepack/git/commits{/sha}","comments_url":"https://api.github.com/repos/trueadm/prepack/comments{/number}","issue_comment_url":"https://api.github.com/repos/trueadm/prepack/issues/comments{/number}","contents_url":"https://api.github.com/repos/trueadm/prepack/contents/{+path}","compare_url":"https://api.github.com/repos/trueadm/prepack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trueadm/prepack/merges","archive_url":"https://api.github.com/repos/trueadm/prepack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trueadm/prepack/downloads","issues_url":"https://api.github.com/repos/trueadm/prepack/issues{/number}","pulls_url":"https://api.github.com/repos/trueadm/prepack/pulls{/number}","milestones_url":"https://api.github.com/repos/trueadm/prepack/milestones{/number}","notifications_url":"https://api.github.com/repos/trueadm/prepack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trueadm/prepack/labels{/name}","releases_url":"https://api.github.com/repos/trueadm/prepack/releases{/id}","deployments_url":"https://api.github.com/repos/trueadm/prepack/deployments","created_at":"2017-08-25T19:46:20Z","updated_at":"2018-03-20T20:28:52Z","pushed_at":"2018-03-20T20:28:51Z","git_url":"git://github.com/trueadm/prepack.git","ssh_url":"git@github.com:trueadm/prepack.git","clone_url":"https://github.com/trueadm/prepack.git","svn_url":"https://github.com/trueadm/prepack","homepage":"https://prepack.io","size":7180,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"4c1691118c87ed1b411d2b1c83e98727244e4693","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":45147841,"name":"prepack","full_name":"facebook/prepack","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/prepack","description":"Prepack is a partial evaluator for JavaScript. Prepack rewrites a JavaScript bundle, resulting in JavaScript code that executes more efficiently.","fork":false,"url":"https://api.github.com/repos/facebook/prepack","forks_url":"https://api.github.com/repos/facebook/prepack/forks","keys_url":"https://api.github.com/repos/facebook/prepack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/prepack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/prepack/teams","hooks_url":"https://api.github.com/repos/facebook/prepack/hooks","issue_events_url":"https://api.github.com/repos/facebook/prepack/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/prepack/events","assignees_url":"https://api.github.com/repos/facebook/prepack/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/prepack/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/prepack/tags","blobs_url":"https://api.github.com/repos/facebook/prepack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/prepack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/prepack/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/prepack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/prepack/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/prepack/languages","stargazers_url":"https://api.github.com/repos/facebook/prepack/stargazers","contributors_url":"https://api.github.com/repos/facebook/prepack/contributors","subscribers_url":"https://api.github.com/repos/facebook/prepack/subscribers","subscription_url":"https://api.github.com/repos/facebook/prepack/subscription","commits_url":"https://api.github.com/repos/facebook/prepack/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/prepack/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/prepack/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/prepack/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/prepack/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/prepack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/prepack/merges","archive_url":"https://api.github.com/repos/facebook/prepack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/prepack/downloads","issues_url":"https://api.github.com/repos/facebook/prepack/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/prepack/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/prepack/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/prepack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/prepack/labels{/name}","releases_url":"https://api.github.com/repos/facebook/prepack/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/prepack/deployments","created_at":"2015-10-28T23:25:08Z","updated_at":"2018-03-20T18:52:38Z","pushed_at":"2018-03-20T20:33:01Z","git_url":"git://github.com/facebook/prepack.git","ssh_url":"git@github.com:facebook/prepack.git","clone_url":"https://github.com/facebook/prepack.git","svn_url":"https://github.com/facebook/prepack","homepage":"https://prepack.io","size":8163,"stargazers_count":11442,"watchers_count":11442,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":342,"mirror_url":null,"archived":false,"open_issues_count":158,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":342,"open_issues":158,"watchers":11442,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/prepack/pulls/1614"},"html":{"href":"https://github.com/facebook/prepack/pull/1614"},"issue":{"href":"https://api.github.com/repos/facebook/prepack/issues/1614"},"comments":{"href":"https://api.github.com/repos/facebook/prepack/issues/1614/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/prepack/pulls/1614/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/prepack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/prepack/pulls/1614/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/prepack/statuses/2c253369f98468ce43157c34c757d6ff35accafe"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"NTillmann"}}