{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/prepack/pulls/comments/134635800","pull_request_review_id":57949941,"id":134635800,"diff_hunk":"@@ -1163,17 +1173,52 @@ export class ResidualHeapSerializer {\n     // TODO #20: add timers\n \n     // TODO #21: add event listeners\n+\n     for (let [moduleId, moduleValue] of this.modules.initializedModules)\n       this.requireReturns.set(moduleId, this.serializeValue(moduleValue));\n \n+    // Make sure additional functions get serialized.\n+    // TODO: make sure those functions get skipped over in all relevant places in serialization/optimization\n+    // We have to do this if we're on the first pass so effects get reversed properly\n+    let rewrittenAdditionalFunctions: Map<FunctionValue, Array<BabelNodeStatement>> = new Map();\n+    let processAdditionalFunctionValues = () => {\n+      let additionalFVEffects = this.additionalFunctionValuesAndEffects;\n+      if (additionalFVEffects) {\n+        for (let [additionalFunctionValue, effects] of additionalFVEffects.entries()) {\n+          // Create the new function body\n+          let [r, g, ob, pb, co] = effects;\n+          let oldGenerator = this.generator;\n+          let originalLength = g.length;\n+          this.generator = g;\n+          this.realm.generator = g;\n+          // TODO: should we be ignoring the preludegenerator here?","path":"src/serializer/ResidualHeapSerializer.js","position":100,"original_position":100,"commit_id":"bfb9c729ec94919026987899aff42c0a74d35a32","original_commit_id":"bfb9c729ec94919026987899aff42c0a74d35a32","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":"By default, it should be okay to ignore the preludeGenerator.","created_at":"2017-08-23T00:54:39Z","updated_at":"2017-08-23T00:54:39Z","html_url":"https://github.com/facebook/prepack/pull/912#discussion_r134635800","pull_request_url":"https://api.github.com/repos/facebook/prepack/pulls/912","_links":{"self":{"href":"https://api.github.com/repos/facebook/prepack/pulls/comments/134635800"},"html":{"href":"https://github.com/facebook/prepack/pull/912#discussion_r134635800"},"pull_request":{"href":"https://api.github.com/repos/facebook/prepack/pulls/912"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/prepack/pulls/912","id":137084107,"html_url":"https://github.com/facebook/prepack/pull/912","diff_url":"https://github.com/facebook/prepack/pull/912.diff","patch_url":"https://github.com/facebook/prepack/pull/912.patch","issue_url":"https://api.github.com/repos/facebook/prepack/issues/912","number":912,"state":"open","locked":false,"title":"[WIP] Serialize independent functions","user":{"login":"cblappert","id":3744743,"avatar_url":"https://avatars1.githubusercontent.com/u/3744743?v=4","gravatar_id":"","url":"https://api.github.com/users/cblappert","html_url":"https://github.com/cblappert","followers_url":"https://api.github.com/users/cblappert/followers","following_url":"https://api.github.com/users/cblappert/following{/other_user}","gists_url":"https://api.github.com/users/cblappert/gists{/gist_id}","starred_url":"https://api.github.com/users/cblappert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cblappert/subscriptions","organizations_url":"https://api.github.com/users/cblappert/orgs","repos_url":"https://api.github.com/users/cblappert/repos","events_url":"https://api.github.com/users/cblappert/events{/privacy}","received_events_url":"https://api.github.com/users/cblappert/received_events","type":"User","site_admin":false},"body":"Currently works for all test cases except `noconflict-existantobject.js`. \r\n\r\nThere are a couple things that are dubious in the current implementation that I will address as I iterate on it:\r\n* We don't visit things correctly in the visitor or the serializer -- we should be visiting only:\r\n  * generator entries in effects\r\n  * Bindings, PropertyBindings in effects not relating to CreatedObjects\r\n* There is currently no way to emit to the main body after the main generator has been serialized -- we may need to if a value is only reachable from one of the additional functions.\r\n* More thought needs to go into how this interacts with\r\n  * speculative initialization\r\n  * require optimization\r\n  * inlining","created_at":"2017-08-22T21:29:45Z","updated_at":"2017-08-23T00:54:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/prepack/pulls/912/commits","review_comments_url":"https://api.github.com/repos/facebook/prepack/pulls/912/comments","review_comment_url":"https://api.github.com/repos/facebook/prepack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/prepack/issues/912/comments","statuses_url":"https://api.github.com/repos/facebook/prepack/statuses/bfb9c729ec94919026987899aff42c0a74d35a32","head":{"label":"facebook:serialize_independant_functions","ref":"serialize_independant_functions","sha":"bfb9c729ec94919026987899aff42c0a74d35a32","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":"2017-08-22T16:48:49Z","pushed_at":"2017-08-23T00:15:46Z","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":2961,"stargazers_count":10030,"watchers_count":10030,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":270,"mirror_url":null,"open_issues_count":81,"forks":270,"open_issues":81,"watchers":10030,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"d145b375ed20d784cae0631620d8cb06032cae24","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":"2017-08-22T16:48:49Z","pushed_at":"2017-08-23T00:15:46Z","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":2961,"stargazers_count":10030,"watchers_count":10030,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":270,"mirror_url":null,"open_issues_count":81,"forks":270,"open_issues":81,"watchers":10030,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/prepack/pulls/912"},"html":{"href":"https://github.com/facebook/prepack/pull/912"},"issue":{"href":"https://api.github.com/repos/facebook/prepack/issues/912"},"comments":{"href":"https://api.github.com/repos/facebook/prepack/issues/912/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/prepack/pulls/912/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/prepack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/prepack/pulls/912/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/prepack/statuses/bfb9c729ec94919026987899aff42c0a74d35a32"}}}}
{"actor":{"display_login":"NTillmann"}}