[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

Compliler's optimization map

There are some selectors that are optimized according to the default configuration of the compiler and that, in some cases change the semantics of that operations responding to the expected behaviors of the underliying ECMAScript implementation. This message optimization specification is initializated in Compiler#defaultOptimizationMap.

Althought S8's Classes may have differents implementations of methods with the following selectors, when detected in compilation time this is overriden by a optimized version of this. but in each of this enhanced implementations the expected behavior is restricted to the underliying platform's implementation (see http://www.ecma-international.org/ecma-262/6.0/index.html).


Selector compiled replacement template
class
'%receiver%.$klass'
isNil
'((%receiver% || nil) === nil)'
notNil
'((%receiver% || nil) !!== nil)'
whileTrue
'(function(){while(%receiver%()){};return nil})()'
whileFalse
'(function(){while(!!%receiver%()){};return nil})()'
ifTrue:
'((%receiver%).mustBeBoolean()==true ? %arg1%() : nil)'
ifFalse:
'((%receiver%).mustBeBoolean()==true ? nil : %arg1%())'
whileTrue:
'(function(){while(%receiver%()){%arg1%()};return nil})()'
whileFalse:
'(function(){var $1$;return ((($1$ = %receiver%)||nil)=== nil) ? %arg1%() : $1$;})()'
ifNil:
'(function(){var $1$;return ((($1$ = %receiver%)||nil)=== nil) ? %arg1%() : $1$;})()'
ifNotNil:
'(function(){var $1$;return ((($1$ = %receiver%)||nil)!!== nil) ? %arg1%() : $1$;})()'
+
'(%receiver% + %arg1%)'
-
'(%receiver% - %arg1%)'
*
'(%receiver% * %arg1%)'
/
'(%receiver% / %arg1%)'
>
'(%receiver% > %arg1%)'
<
'(%receiver% < %arg1%)'
>=
'(%receiver% >= %arg1%)'
<=
'(%receiver% <= %arg1%)'
=
'(%receiver% == %arg1%)'
==
'(%receiver% === %arg1%)'
===
'(%receiver% === %arg1%)'
||
'(%receiver% || %arg1%)'
basicAt:
'(%receiver%[%arg1%] || nil)'
timesRepeat:
'(function(){for(var $1$=%receiver%;$1$>0;$1$--){%arg1%()};return nil})()'
ifTrue:ifFalse:
'((%receiver%).mustBeBoolean()==true ? %arg1%() : %arg2%())'
ifFalse:ifTrue:
'((%receiver%).mustBeBoolean()==true ? %arg2%() : %arg1%())'
ifNil:ifNotNil:
'(((%receiver%)||nil)=== nil) ? %arg1%() : %arg2%()'
ifNotNil:ifNil:
'(((%receiver%)||nil)!!== nil) ? %arg1%() : %arg2%()'
basicAt:ifAbsent:
'(%receiver%[%arg1%] || %arg2%.value())'
basicAt:put: '(%receiver%[%arg1%]=(%arg2%))'