<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for JavaScript</title>
	<atom:link href="http://blog.mozilla.org/javascript/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.org/javascript</link>
	<description>All about Mozilla&#039;s JavaScript engine</description>
	<lastBuildDate>Tue, 28 May 2013 16:13:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>Comment on The Baseline Compiler Has Landed by Kannan Vijayan</title>
		<link>http://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/#comment-26638</link>
		<dc:creator>Kannan Vijayan</dc:creator>
		<pubDate>Tue, 28 May 2013 16:13:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/javascript/?p=240#comment-26638</guid>
		<description><![CDATA[Hi Steve,

Actually, all of those cases will be compiled with Ion.  The variables having values of different types only becomes an issue if the change happens after compilation.

Like, for example, if a function accepts an argument, and the first 100,000 times the function is called, the argument is an integer, and the 100,001th time, the function is called with a string, then it&#039;ll lead to some minor slowdown as the function is recompiled.

Having arrays with values of different types doesn&#039;t prevent ion compilation either.

In general, the best plan is to write clear, readable, well-designed javascript code.  That&#039;s the kind of code that both we and the other JS teams are going to be trying to optimize.

Cheers.]]></description>
		<content:encoded><![CDATA[<p>Hi Steve,</p>
<p>Actually, all of those cases will be compiled with Ion.  The variables having values of different types only becomes an issue if the change happens after compilation.</p>
<p>Like, for example, if a function accepts an argument, and the first 100,000 times the function is called, the argument is an integer, and the 100,001th time, the function is called with a string, then it&#8217;ll lead to some minor slowdown as the function is recompiled.</p>
<p>Having arrays with values of different types doesn&#8217;t prevent ion compilation either.</p>
<p>In general, the best plan is to write clear, readable, well-designed javascript code.  That&#8217;s the kind of code that both we and the other JS teams are going to be trying to optimize.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Baseline Compiler Has Landed by Steve</title>
		<link>http://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/#comment-26480</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 11 Apr 2013 07:49:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/javascript/?p=240#comment-26480</guid>
		<description><![CDATA[I have to confess most of this is above my head but I&#039;d appreciate it if Mozilla could issue some guidance on how to make sure regularly called functions or loops get passed up to IonMonkey and stay there.

For example, I gather from the above if I were to initiate a variable as a boolean but later in the function assign a string to it that would bump the function out of the fast running compiled code, is that correct?

How about arrays, are they more likely to get compiled and stay that way if every element is of the same type?

How about objects being passed to functions as parameters, should they always have the same members or are only the members the function uses important?

This is the kind of guidance that would be useful to someone like myself who writes JavaScript scripts but doesn&#039;t really understand what the interpreter does under the hood.

Thanks.]]></description>
		<content:encoded><![CDATA[<p>I have to confess most of this is above my head but I&#8217;d appreciate it if Mozilla could issue some guidance on how to make sure regularly called functions or loops get passed up to IonMonkey and stay there.</p>
<p>For example, I gather from the above if I were to initiate a variable as a boolean but later in the function assign a string to it that would bump the function out of the fast running compiled code, is that correct?</p>
<p>How about arrays, are they more likely to get compiled and stay that way if every element is of the same type?</p>
<p>How about objects being passed to functions as parameters, should they always have the same members or are only the members the function uses important?</p>
<p>This is the kind of guidance that would be useful to someone like myself who writes JavaScript scripts but doesn&#8217;t really understand what the interpreter does under the hood.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Baseline Compiler Has Landed by Kannan Vijayan</title>
		<link>http://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/#comment-26479</link>
		<dc:creator>Kannan Vijayan</dc:creator>
		<pubDate>Thu, 11 Apr 2013 00:17:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/javascript/?p=240#comment-26479</guid>
		<description><![CDATA[I think you&#039;re getting close.  Every op has its own chain, actually.  Jan and I have discussed putting up a blog post discussing the design in more detail.  There are some pressing matters to work on right now, but if the time is there we&#039;ll try to write something up.

If you&#039;re really curious, there&#039;s some some ascii-art and long comments in BaselineIC.h in the sources :)]]></description>
		<content:encoded><![CDATA[<p>I think you&#8217;re getting close.  Every op has its own chain, actually.  Jan and I have discussed putting up a blog post discussing the design in more detail.  There are some pressing matters to work on right now, but if the time is there we&#8217;ll try to write something up.</p>
<p>If you&#8217;re really curious, there&#8217;s some some ascii-art and long comments in BaselineIC.h in the sources <img src='http://blog.mozilla.org/javascript/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Baseline Compiler Has Landed by J. McNair</title>
		<link>http://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/#comment-26478</link>
		<dc:creator>J. McNair</dc:creator>
		<pubDate>Wed, 10 Apr 2013 23:47:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/javascript/?p=240#comment-26478</guid>
		<description><![CDATA[Thanks for replying! I guess you&#039;ve figured out that I am certainly not a compiler programmer, and I apologize for blowing up your blog post with long comments.  This should be the last one!

I admit I was thinking &quot;inlined code&quot; instead of &quot;inline cache&quot;, so I am sorry I was imagining Baseline as a crazy hybrid of TraceMonkey and Sun&#039;s Hotspot VM. So, every JS operation or byte-code is implemented as an inline cache with stub functions, Baseline uses the stubs to quickly chain those ICs  together in a freaky &quot;function pointer linked list&quot; or something, and then the whole chain is executed in sequence because the stubs are already filled in with the next needed IC. More or less it?

And that should mean that any dynamism is handled by modifying the chain (add/remove/swap ICs and stubs) or the individual &quot;links&quot; (e.g. your example with the CALL IC). This keeps Baseline from ever fully invalidating code, while limiting IC explosion, right?

Thanks for clarifying baseline&#039;s relationship with type inference, and upon rereading both posts, I now realize that most of the savings comes from disabling JM and using a system that is smarter and more efficient about using the existing type inference system.

I never advocated getting rid of the interpreter, I just wondered if there was a way to keep it portable, readable and hackable, with slightly better performance than it has. Not turn it into something it isn&#039;t. 

And I&#039;m sorry that I find all this really fascinating, and thank you all for your hard work!]]></description>
		<content:encoded><![CDATA[<p>Thanks for replying! I guess you&#8217;ve figured out that I am certainly not a compiler programmer, and I apologize for blowing up your blog post with long comments.  This should be the last one!</p>
<p>I admit I was thinking &#8220;inlined code&#8221; instead of &#8220;inline cache&#8221;, so I am sorry I was imagining Baseline as a crazy hybrid of TraceMonkey and Sun&#8217;s Hotspot VM. So, every JS operation or byte-code is implemented as an inline cache with stub functions, Baseline uses the stubs to quickly chain those ICs  together in a freaky &#8220;function pointer linked list&#8221; or something, and then the whole chain is executed in sequence because the stubs are already filled in with the next needed IC. More or less it?</p>
<p>And that should mean that any dynamism is handled by modifying the chain (add/remove/swap ICs and stubs) or the individual &#8220;links&#8221; (e.g. your example with the CALL IC). This keeps Baseline from ever fully invalidating code, while limiting IC explosion, right?</p>
<p>Thanks for clarifying baseline&#8217;s relationship with type inference, and upon rereading both posts, I now realize that most of the savings comes from disabling JM and using a system that is smarter and more efficient about using the existing type inference system.</p>
<p>I never advocated getting rid of the interpreter, I just wondered if there was a way to keep it portable, readable and hackable, with slightly better performance than it has. Not turn it into something it isn&#8217;t. </p>
<p>And I&#8217;m sorry that I find all this really fascinating, and thank you all for your hard work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Baseline Compiler Has Landed by J. McNair</title>
		<link>http://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/#comment-26477</link>
		<dc:creator>J. McNair</dc:creator>
		<pubDate>Wed, 10 Apr 2013 22:59:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/javascript/?p=240#comment-26477</guid>
		<description><![CDATA[I can help with this one! The developers stated it above, but it&#039;s no trouble to repeat that JaegerMonkey is going away, immediately. JM is already disabled when Baseline is turned on. As they explained, JM became too large and complex, it uses too much memory, and doesn&#039;t efficiently drive the Type Inference engine that guides Ion. 

The new status quo is
Cold = Interpreter (which will always be improved and shouldn&#039;t go away)
Room Temperature to Hot = Baseline which can provide type info to prepare Ion, if needed
Boiling to the Sun = Ion + TI

I agree that some data on how &quot;hot&quot; popular website JS functions are, from the perspective of the JS engines would be really neat. I bet there&#039;s already some kind of instrumentation in place to do this.

Odinmonkey is a separate compiler that reuses parts of Ion to statically compile a (restricted but mostly compatible) subset of JavaScript called &quot;asm.js&quot; into really fast, very type stable, machine code. I am hoping this compilation is off the main thread, already, lol.  JS developers have to specifically ask for OdinMonkey by including a special directive in function declarations that is easily ignored by JS engines that don&#039;t understand asm.js.  So, everyone can opt-in to better performance, for certain types of code, without breaking the web.]]></description>
		<content:encoded><![CDATA[<p>I can help with this one! The developers stated it above, but it&#8217;s no trouble to repeat that JaegerMonkey is going away, immediately. JM is already disabled when Baseline is turned on. As they explained, JM became too large and complex, it uses too much memory, and doesn&#8217;t efficiently drive the Type Inference engine that guides Ion. </p>
<p>The new status quo is<br />
Cold = Interpreter (which will always be improved and shouldn&#8217;t go away)<br />
Room Temperature to Hot = Baseline which can provide type info to prepare Ion, if needed<br />
Boiling to the Sun = Ion + TI</p>
<p>I agree that some data on how &#8220;hot&#8221; popular website JS functions are, from the perspective of the JS engines would be really neat. I bet there&#8217;s already some kind of instrumentation in place to do this.</p>
<p>Odinmonkey is a separate compiler that reuses parts of Ion to statically compile a (restricted but mostly compatible) subset of JavaScript called &#8220;asm.js&#8221; into really fast, very type stable, machine code. I am hoping this compilation is off the main thread, already, lol.  JS developers have to specifically ask for OdinMonkey by including a special directive in function declarations that is easily ignored by JS engines that don&#8217;t understand asm.js.  So, everyone can opt-in to better performance, for certain types of code, without breaking the web.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Baseline Compiler Has Landed by Rob Colburn</title>
		<link>http://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/#comment-26463</link>
		<dc:creator>Rob Colburn</dc:creator>
		<pubDate>Tue, 09 Apr 2013 17:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/javascript/?p=240#comment-26463</guid>
		<description><![CDATA[So, as I understand it… Spider hands off code to Baseline (or, sometimes Odin).  Based on heat and stability, Baseline will pass code to itself, then to Jaegar, then to Ion.  If code regresses (in terms of type stability), then it takes over and holds on to the hot, unstable.  Leaving:

Cold = Interpreter
Luke-Warm or Hot and Unstable = Baseline
Warm and Stable = Jaegar
Burning Hot and Stable = Ion

So, long-term is the plan to deprecate Jaegar?  My hunch would be that type-stable code tends to be either cold/luke-warm or burning hot, and not so much warm.

Side note: Would be interesting, if someone made histograms of popular website JS heuristics.]]></description>
		<content:encoded><![CDATA[<p>So, as I understand it… Spider hands off code to Baseline (or, sometimes Odin).  Based on heat and stability, Baseline will pass code to itself, then to Jaegar, then to Ion.  If code regresses (in terms of type stability), then it takes over and holds on to the hot, unstable.  Leaving:</p>
<p>Cold = Interpreter<br />
Luke-Warm or Hot and Unstable = Baseline<br />
Warm and Stable = Jaegar<br />
Burning Hot and Stable = Ion</p>
<p>So, long-term is the plan to deprecate Jaegar?  My hunch would be that type-stable code tends to be either cold/luke-warm or burning hot, and not so much warm.</p>
<p>Side note: Would be interesting, if someone made histograms of popular website JS heuristics.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Baseline Compiler Has Landed by Kannan Vijayan</title>
		<link>http://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/#comment-26462</link>
		<dc:creator>Kannan Vijayan</dc:creator>
		<pubDate>Tue, 09 Apr 2013 15:40:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/javascript/?p=240#comment-26462</guid>
		<description><![CDATA[This is unlikely.  It&#039;s hard to write a change that&#039;s enabled only on nightlies and disabled later (except by doing it manually).

We test heavily with the default settings, so there may be issues with different tunings that fuzzing and other testing didn&#039;t pick up.  If we were to make this a tunable setting, then it&#039;s something that would have to be tested to the same extent that the default is, and that takes away precious testing resources from the default configuration.

Also, from the measurements that we&#039;ve run, changing the constant here back and forth (even from 10 to 0) doesn&#039;t really make a big difference except in pathological cases.]]></description>
		<content:encoded><![CDATA[<p>This is unlikely.  It&#8217;s hard to write a change that&#8217;s enabled only on nightlies and disabled later (except by doing it manually).</p>
<p>We test heavily with the default settings, so there may be issues with different tunings that fuzzing and other testing didn&#8217;t pick up.  If we were to make this a tunable setting, then it&#8217;s something that would have to be tested to the same extent that the default is, and that takes away precious testing resources from the default configuration.</p>
<p>Also, from the measurements that we&#8217;ve run, changing the constant here back and forth (even from 10 to 0) doesn&#8217;t really make a big difference except in pathological cases.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Baseline Compiler Has Landed by Kannan Vijayan</title>
		<link>http://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/#comment-26461</link>
		<dc:creator>Kannan Vijayan</dc:creator>
		<pubDate>Tue, 09 Apr 2013 15:34:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/javascript/?p=240#comment-26461</guid>
		<description><![CDATA[1. Baseline sacrifices optimizations that rely on type-information.  E.g. passing around unboxed values because type-inference guarantees that some value will be an integer all the way through a computation.  It also doesn&#039;t emit its optimized code inline (as part of the main jitcode) - instead it pushes the optimized logic into the IC chains, which are dynamically modified at runtime.

2. The main JS compiles once, but that&#039;s because it uses ICs to implement almost every op.  The fallback-stub (last stub that does the default slowpath) for each IC chain implements logic to add new IC stubs.  This is pretty straightforward IC design.  We make some design choices here to make the IC chains more introspectable.

3. We limit the size of caches.  For some caches, we generalize stubs as the chain grows.  For example, with Call IC chains, we start off attaching IC stubs which store the actual callee function that&#039;s being invoked.  However, if a lot of callees are being called at that site, then the callee-specific stubs are removed, and a generic call stub is added.

4. We don&#039;t use the caches to store TI information.  We interface with TI by calling the usual VM functions to update TI&#039;s data structures.  However, since this is a slow C++ call, we use an IC to record what types have already been added to a type-set, so that we can avoid calling the slowpath most of the time.

5. The less memory will come about less because of baseline specifically, and more because baseline allows us to disable Jaeger, and disabling Jaeger allows us to remove some of the memory-heavy structures that Jaeger needs.

The interpreter is great as a portable, flexible environment where the team can prototype and implement new features without having to worry about how it&#039;ll be jitted or optimized.  It allows the feature people to do their work without being bogged down by optimization details, and the JIT people can come in later and make those features run fast.]]></description>
		<content:encoded><![CDATA[<p>1. Baseline sacrifices optimizations that rely on type-information.  E.g. passing around unboxed values because type-inference guarantees that some value will be an integer all the way through a computation.  It also doesn&#8217;t emit its optimized code inline (as part of the main jitcode) &#8211; instead it pushes the optimized logic into the IC chains, which are dynamically modified at runtime.</p>
<p>2. The main JS compiles once, but that&#8217;s because it uses ICs to implement almost every op.  The fallback-stub (last stub that does the default slowpath) for each IC chain implements logic to add new IC stubs.  This is pretty straightforward IC design.  We make some design choices here to make the IC chains more introspectable.</p>
<p>3. We limit the size of caches.  For some caches, we generalize stubs as the chain grows.  For example, with Call IC chains, we start off attaching IC stubs which store the actual callee function that&#8217;s being invoked.  However, if a lot of callees are being called at that site, then the callee-specific stubs are removed, and a generic call stub is added.</p>
<p>4. We don&#8217;t use the caches to store TI information.  We interface with TI by calling the usual VM functions to update TI&#8217;s data structures.  However, since this is a slow C++ call, we use an IC to record what types have already been added to a type-set, so that we can avoid calling the slowpath most of the time.</p>
<p>5. The less memory will come about less because of baseline specifically, and more because baseline allows us to disable Jaeger, and disabling Jaeger allows us to remove some of the memory-heavy structures that Jaeger needs.</p>
<p>The interpreter is great as a portable, flexible environment where the team can prototype and implement new features without having to worry about how it&#8217;ll be jitted or optimized.  It allows the feature people to do their work without being bogged down by optimization details, and the JIT people can come in later and make those features run fast.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Baseline Compiler Has Landed by J. McNair</title>
		<link>http://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/#comment-26460</link>
		<dc:creator>J. McNair</dc:creator>
		<pubDate>Tue, 09 Apr 2013 15:19:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/javascript/?p=240#comment-26460</guid>
		<description><![CDATA[Wait, so Baseline will do all of the following
1. be a much simpler JIT compiler that performs quickly, sacrificing most optimization
2. compile JS only ONCE; store the compiled code in multiple, branching, inline caches; and quickly execute code exclusively from the caches until Ion turns on. 
3. adapt to wildly dynamic JavaScript, without an explosion in number and size of caches
4. run most of TI and store type information for Ion in the same caches it uses for #2 
5. use less memory than JM+TI and decrease Ion&#039;s overall memory usage

You Mozilla people are a bit too clever for me. At this point, it&#039;s worth asking if there&#039;s any way to improve the interpreter&#039;s performance?]]></description>
		<content:encoded><![CDATA[<p>Wait, so Baseline will do all of the following<br />
1. be a much simpler JIT compiler that performs quickly, sacrificing most optimization<br />
2. compile JS only ONCE; store the compiled code in multiple, branching, inline caches; and quickly execute code exclusively from the caches until Ion turns on.<br />
3. adapt to wildly dynamic JavaScript, without an explosion in number and size of caches<br />
4. run most of TI and store type information for Ion in the same caches it uses for #2<br />
5. use less memory than JM+TI and decrease Ion&#8217;s overall memory usage</p>
<p>You Mozilla people are a bit too clever for me. At this point, it&#8217;s worth asking if there&#8217;s any way to improve the interpreter&#8217;s performance?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Baseline Compiler Has Landed by Jan de Mooij</title>
		<link>http://blog.mozilla.org/javascript/2013/04/05/the-baseline-compiler-has-landed/#comment-26459</link>
		<dc:creator>Jan de Mooij</dc:creator>
		<pubDate>Mon, 08 Apr 2013 11:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.org/javascript/?p=240#comment-26459</guid>
		<description><![CDATA[Yeah, JM does not compile anything with Baseline enabled and we hope we can remove it completely in the next cycle (Firefox 24). We are keeping it for the current release in case we have to pref it back on for some reason.]]></description>
		<content:encoded><![CDATA[<p>Yeah, JM does not compile anything with Baseline enabled and we hope we can remove it completely in the next cycle (Firefox 24). We are keeping it for the current release in case we have to pref it back on for some reason.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
