{"id":2699,"date":"2015-04-04T11:00:01","date_gmt":"2015-04-04T16:00:01","guid":{"rendered":"http:\/\/mikeconley.ca\/blog\/?p=2699"},"modified":"2023-12-20T16:25:11","modified_gmt":"2023-12-20T21:25:11","slug":"things-ive-learned-this-week-march-30-april-3-2015","status":"publish","type":"post","link":"https:\/\/mikeconley.ca\/blog\/2015\/04\/04\/things-ive-learned-this-week-march-30-april-3-2015\/","title":{"rendered":"Things I&#8217;ve Learned This Week (March 30 &#8211; April 3, 2015)"},"content":{"rendered":"<p>This is my second post in a weekly series, where I attempt to distill my week down into some lessons or facts that I&#8217;ve picked up. Let&#8217;s get to it!<\/p>\n<h2>ES6 &#8211; what&#8217;s safe to use in browser development?<\/h2>\n<p>As of March 27, 2015, <a href=\"http:\/\/wiki.ecmascript.org\/doku.php?id=strawman:maximally_minimal_classes\">ES6 classes<\/a> are still not yet safe for use in production browser code. There&#8217;s code to support them in Firefox, but they&#8217;re Nightly-only behind a build-time pref.<\/p>\n<p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Array\/includes\">Array.prototype.includes<\/a> and <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/ArrayBuffer\/transfer\">ArrayBuffer.transfer<\/a> are also Nightly only at this time.<\/p>\n<p>However, any of the rest of the <a href=\"http:\/\/kangax.github.io\/compat-table\/es6\/\">ES6 Harmony work currently implemented by Nightly<\/a> is fair-game for use, according to jorendorff. The JS team is also working on a Wiki page to tell us Firefox developers what ES6 stuff is safe for use and what is not.<\/p>\n<h2>Getting a profile from a hung process<\/h2>\n<p><strong>Update [January 23rd, 2017]: <\/strong>Markus Stange contacted me to let me know that the function mozilla_sampler_save_profile_to_file has been changed to profiler_save_profile_to_file. This happened in <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1332577\">this bug<\/a>. I&#8217;ve updated the post to reflect this.<\/p>\n<p>According to mstange, it is possible to get profiles from hung Firefox processes using lldb<sup id=\"rf1-2699\"><a href=\"#fn1-2699\" title=\"Unfortunately, this technique will not work for Windows. :( \" rel=\"footnote\">1<\/a><\/sup>.<\/p>\n<ol>\n<li>After the process has hung, <a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/IDEs\/Conceptual\/gdb_to_lldb_transition_guide\/document\/lldb-terminal-workflow-tutorial.html#\/\/apple_ref\/doc\/uid\/TP40012917-CH4-SW5\">attach lldb<\/a>.<\/li>\n<li>Type in<sup id=\"rf2-2699\"><a href=\"#fn2-2699\" title=\"Assuming you&#8217;re running a build after &lt;a href=&quot;https:\/\/hg.mozilla.org\/integration\/mozilla-inbound\/rev\/d0fc7202b4cb&quot;&gt;this revision&lt;\/a&gt; landed.\" rel=\"footnote\">2<\/a><\/sup>, :\n<pre>p (void)profiler_save_profile_to_file(\"somepath\/profile.txt\")<\/pre>\n<\/li>\n<li><a href=\"https:\/\/github.com\/mstange\/analyze-tryserver-profiles\">Clone mstange&#8217;s handy profile analysis repository.<\/a><\/li>\n<li>Run:\n<pre>python symbolicate_profile.py somepath\/profile.txt<\/pre>\n<p>To graft symbols into the profile. mstange&#8217;s scripts do some fairly clever things to get those symbols &#8211; if your Firefox was built by Mozilla, then it will retrieve the symbols from the Mozilla symbol server. If you built Firefox yourself, it will attempt to use some cleverness<sup id=\"rf3-2699\"><a href=\"#fn3-2699\" title=\"A binary called dump_syms_mac in mstange&#8217;s toolkit, and nm on Linux\" rel=\"footnote\">3<\/a><\/sup> to grab the symbols from your binary.<\/p>\n<p>Your profile will now, hopefully, be updated with symbols.<\/p>\n<p>Then, load up <a href=\"http:\/\/people.mozilla.org\/~bgirard\/cleopatra\/\">Cleopatra<\/a>, and upload the profile.<\/p>\n<p>I haven&#8217;t yet had the opportunity to try this, but I hope to next week. I&#8217;d be eager to hear people&#8217;s experience giving this a go &#8211; it might be a great tool in determining what&#8217;s going on in Firefox when it&#8217;s hung<sup id=\"rf4-2699\"><a href=\"#fn4-2699\" title=\"I&#8217;m particularly interested in knowing if we can get Javascript stacks via this technique &#8211; I can see that being particularly useful with hung content processes.\" rel=\"footnote\">4<\/a><\/sup>!<\/li>\n<\/ol>\n<h2>Parameter vs. Argument<\/h2>\n<p>I noticed that when I talked about &#8220;things that I passed to functions<sup id=\"rf5-2699\"><a href=\"#fn5-2699\" title=\"Or methods.\" rel=\"footnote\">5<\/a><\/sup>&#8221;, I would use &#8220;arguments&#8221; and &#8220;parameters&#8221; interchangeably. I recently learned that there is more to those terms than I had originally thought.<\/p>\n<p><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/9kewt1b3.aspx\">According to this MSDN article<\/a>, an argument is what is passed in to a function by a caller. To the function, it has received parameters. It&#8217;s like two sides of a coin. Or, as the article puts it, like cars and parking spaces:<\/p>\n<blockquote><p>You can think of the parameter as a parking space and the argument as an automobile. Just as different automobiles can park in a parking space at different times, the calling code can pass a different argument to the same parameter every time that it calls the procedure.<sup id=\"rf6-2699\"><a href=\"#fn6-2699\" title=\"&lt;a href=&quot;https:\/\/msdn.microsoft.com\/en-us\/library\/9kewt1b3.aspx&quot;&gt;Source\" rel=\"footnote\">6<\/a><\/sup><\/a><\/p><\/blockquote>\n<p>Not that it really makes much difference, but I like knowing the details.<\/p>\n<hr class=\"footnotes\"><ol class=\"footnotes\" style=\"list-style-type:decimal\"><li id=\"fn1-2699\"><p >Unfortunately, this technique will not work for Windows. \ud83d\ude41 &nbsp;<a href=\"#rf1-2699\" class=\"backlink\" title=\"Return to footnote 1.\">&#8617;<\/a><\/p><\/li><li id=\"fn2-2699\"><p >Assuming you&#8217;re running a build after <a href=\"https:\/\/hg.mozilla.org\/integration\/mozilla-inbound\/rev\/d0fc7202b4cb\">this revision<\/a> landed.&nbsp;<a href=\"#rf2-2699\" class=\"backlink\" title=\"Return to footnote 2.\">&#8617;<\/a><\/p><\/li><li id=\"fn3-2699\"><p >A binary called dump_syms_mac in mstange&#8217;s toolkit, and nm on Linux&nbsp;<a href=\"#rf3-2699\" class=\"backlink\" title=\"Return to footnote 3.\">&#8617;<\/a><\/p><\/li><li id=\"fn4-2699\"><p >I&#8217;m particularly interested in knowing if we can get Javascript stacks via this technique &#8211; I can see that being particularly useful with hung content processes.&nbsp;<a href=\"#rf4-2699\" class=\"backlink\" title=\"Return to footnote 4.\">&#8617;<\/a><\/p><\/li><li id=\"fn5-2699\"><p >Or methods.&nbsp;<a href=\"#rf5-2699\" class=\"backlink\" title=\"Return to footnote 5.\">&#8617;<\/a><\/p><\/li><li id=\"fn6-2699\"><p ><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/9kewt1b3.aspx\">Source&nbsp;<a href=\"#rf6-2699\" class=\"backlink\" title=\"Return to footnote 6.\">&#8617;<\/a><\/p><\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>This is my second post in a weekly series, where I attempt to distill my week down into some lessons or facts that I&#8217;ve picked up. Let&#8217;s get to it! ES6 &#8211; what&#8217;s safe to use in browser development? As of March 27, 2015, ES6 classes are still not yet safe for use in production [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Things I've Learned This Week (March 30 - April 3, 2015) https:\/\/wp.me\/prmTy-Hx","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5,861,110],"tags":[1134,1129,1130,1128,1127,1018,1132,1121,1133,1135,1131],"class_list":["post-2699","post","type-post","status-publish","format-standard","hentry","category-computer-science","category-mozilla-2","category-musings","tag-arguments","tag-array-prototype-includes","tag-arraybuffer-transfer","tag-classes","tag-es6-harmony","tag-gecko","tag-hung","tag-lessons","tag-lldb","tag-parameters","tag-profile"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/prmTy-Hx","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/2699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/comments?post=2699"}],"version-history":[{"count":7,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/2699\/revisions"}],"predecessor-version":[{"id":2835,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/2699\/revisions\/2835"}],"wp:attachment":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/media?parent=2699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/categories?post=2699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/tags?post=2699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}