Compiler-Inlining.deploy.js 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159
  1. smalltalk.addPackage('Compiler-Inlining');
  2. smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining');
  3. smalltalk.addMethod(
  4. smalltalk.method({
  5. selector: "accept:",
  6. fn: function (aVisitor){
  7. var self=this;
  8. return smalltalk.withContext(function($ctx1) {
  9. var $1;
  10. $1=_st(aVisitor)._visitIRInlinedAssignment_(self);
  11. return $1;
  12. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedAssignment)})},
  13. messageSends: ["visitIRInlinedAssignment:"]}),
  14. smalltalk.IRInlinedAssignment);
  15. smalltalk.addMethod(
  16. smalltalk.method({
  17. selector: "isInlined",
  18. fn: function (){
  19. var self=this;
  20. return smalltalk.withContext(function($ctx1) {
  21. return true;
  22. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedAssignment)})},
  23. messageSends: []}),
  24. smalltalk.IRInlinedAssignment);
  25. smalltalk.addClass('IRInlinedClosure', smalltalk.IRClosure, [], 'Compiler-Inlining');
  26. smalltalk.addMethod(
  27. smalltalk.method({
  28. selector: "accept:",
  29. fn: function (aVisitor){
  30. var self=this;
  31. return smalltalk.withContext(function($ctx1) {
  32. _st(aVisitor)._visitIRInlinedClosure_(self);
  33. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedClosure)})},
  34. messageSends: ["visitIRInlinedClosure:"]}),
  35. smalltalk.IRInlinedClosure);
  36. smalltalk.addMethod(
  37. smalltalk.method({
  38. selector: "isInlined",
  39. fn: function (){
  40. var self=this;
  41. return smalltalk.withContext(function($ctx1) {
  42. return true;
  43. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedClosure)})},
  44. messageSends: []}),
  45. smalltalk.IRInlinedClosure);
  46. smalltalk.addClass('IRInlinedReturn', smalltalk.IRReturn, [], 'Compiler-Inlining');
  47. smalltalk.addMethod(
  48. smalltalk.method({
  49. selector: "accept:",
  50. fn: function (aVisitor){
  51. var self=this;
  52. return smalltalk.withContext(function($ctx1) {
  53. var $1;
  54. $1=_st(aVisitor)._visitIRInlinedReturn_(self);
  55. return $1;
  56. }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedReturn)})},
  57. messageSends: ["visitIRInlinedReturn:"]}),
  58. smalltalk.IRInlinedReturn);
  59. smalltalk.addMethod(
  60. smalltalk.method({
  61. selector: "isInlined",
  62. fn: function (){
  63. var self=this;
  64. return smalltalk.withContext(function($ctx1) {
  65. return true;
  66. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedReturn)})},
  67. messageSends: []}),
  68. smalltalk.IRInlinedReturn);
  69. smalltalk.addClass('IRInlinedSend', smalltalk.IRSend, [], 'Compiler-Inlining');
  70. smalltalk.addMethod(
  71. smalltalk.method({
  72. selector: "accept:",
  73. fn: function (aVisitor){
  74. var self=this;
  75. return smalltalk.withContext(function($ctx1) {
  76. _st(aVisitor)._visitInlinedSend_(self);
  77. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedSend)})},
  78. messageSends: ["visitInlinedSend:"]}),
  79. smalltalk.IRInlinedSend);
  80. smalltalk.addMethod(
  81. smalltalk.method({
  82. selector: "isInlined",
  83. fn: function (){
  84. var self=this;
  85. return smalltalk.withContext(function($ctx1) {
  86. return true;
  87. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedSend)})},
  88. messageSends: []}),
  89. smalltalk.IRInlinedSend);
  90. smalltalk.addClass('IRInlinedIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  91. smalltalk.addMethod(
  92. smalltalk.method({
  93. selector: "accept:",
  94. fn: function (aVisitor){
  95. var self=this;
  96. return smalltalk.withContext(function($ctx1) {
  97. _st(aVisitor)._visitIRInlinedIfFalse_(self);
  98. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfFalse)})},
  99. messageSends: ["visitIRInlinedIfFalse:"]}),
  100. smalltalk.IRInlinedIfFalse);
  101. smalltalk.addClass('IRInlinedIfNilIfNotNil', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  102. smalltalk.addMethod(
  103. smalltalk.method({
  104. selector: "accept:",
  105. fn: function (aVisitor){
  106. var self=this;
  107. return smalltalk.withContext(function($ctx1) {
  108. _st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  109. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfNilIfNotNil)})},
  110. messageSends: ["visitIRInlinedIfNilIfNotNil:"]}),
  111. smalltalk.IRInlinedIfNilIfNotNil);
  112. smalltalk.addClass('IRInlinedIfTrue', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  113. smalltalk.addMethod(
  114. smalltalk.method({
  115. selector: "accept:",
  116. fn: function (aVisitor){
  117. var self=this;
  118. return smalltalk.withContext(function($ctx1) {
  119. _st(aVisitor)._visitIRInlinedIfTrue_(self);
  120. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfTrue)})},
  121. messageSends: ["visitIRInlinedIfTrue:"]}),
  122. smalltalk.IRInlinedIfTrue);
  123. smalltalk.addClass('IRInlinedIfTrueIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  124. smalltalk.addMethod(
  125. smalltalk.method({
  126. selector: "accept:",
  127. fn: function (aVisitor){
  128. var self=this;
  129. return smalltalk.withContext(function($ctx1) {
  130. _st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  131. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedIfTrueIfFalse)})},
  132. messageSends: ["visitIRInlinedIfTrueIfFalse:"]}),
  133. smalltalk.IRInlinedIfTrueIfFalse);
  134. smalltalk.addClass('IRInlinedSequence', smalltalk.IRBlockSequence, [], 'Compiler-Inlining');
  135. smalltalk.addMethod(
  136. smalltalk.method({
  137. selector: "accept:",
  138. fn: function (aVisitor){
  139. var self=this;
  140. return smalltalk.withContext(function($ctx1) {
  141. _st(aVisitor)._visitIRInlinedSequence_(self);
  142. return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},smalltalk.IRInlinedSequence)})},
  143. messageSends: ["visitIRInlinedSequence:"]}),
  144. smalltalk.IRInlinedSequence);
  145. smalltalk.addMethod(
  146. smalltalk.method({
  147. selector: "isInlined",
  148. fn: function (){
  149. var self=this;
  150. return smalltalk.withContext(function($ctx1) {
  151. return true;
  152. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},smalltalk.IRInlinedSequence)})},
  153. messageSends: []}),
  154. smalltalk.IRInlinedSequence);
  155. smalltalk.addClass('IRInliner', smalltalk.IRVisitor, [], 'Compiler-Inlining');
  156. smalltalk.addMethod(
  157. smalltalk.method({
  158. selector: "assignmentInliner",
  159. fn: function (){
  160. var self=this;
  161. function $IRAssignmentInliner(){return smalltalk.IRAssignmentInliner||(typeof IRAssignmentInliner=="undefined"?nil:IRAssignmentInliner)}
  162. return smalltalk.withContext(function($ctx1) {
  163. var $2,$3,$1;
  164. $2=_st($IRAssignmentInliner())._new();
  165. _st($2)._translator_(self);
  166. $3=_st($2)._yourself();
  167. $1=$3;
  168. return $1;
  169. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},smalltalk.IRInliner)})},
  170. messageSends: ["translator:", "new", "yourself"]}),
  171. smalltalk.IRInliner);
  172. smalltalk.addMethod(
  173. smalltalk.method({
  174. selector: "returnInliner",
  175. fn: function (){
  176. var self=this;
  177. function $IRReturnInliner(){return smalltalk.IRReturnInliner||(typeof IRReturnInliner=="undefined"?nil:IRReturnInliner)}
  178. return smalltalk.withContext(function($ctx1) {
  179. var $2,$3,$1;
  180. $2=_st($IRReturnInliner())._new();
  181. _st($2)._translator_(self);
  182. $3=_st($2)._yourself();
  183. $1=$3;
  184. return $1;
  185. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},smalltalk.IRInliner)})},
  186. messageSends: ["translator:", "new", "yourself"]}),
  187. smalltalk.IRInliner);
  188. smalltalk.addMethod(
  189. smalltalk.method({
  190. selector: "sendInliner",
  191. fn: function (){
  192. var self=this;
  193. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  194. return smalltalk.withContext(function($ctx1) {
  195. var $2,$3,$1;
  196. $2=_st($IRSendInliner())._new();
  197. _st($2)._translator_(self);
  198. $3=_st($2)._yourself();
  199. $1=$3;
  200. return $1;
  201. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},smalltalk.IRInliner)})},
  202. messageSends: ["translator:", "new", "yourself"]}),
  203. smalltalk.IRInliner);
  204. smalltalk.addMethod(
  205. smalltalk.method({
  206. selector: "shouldInlineAssignment:",
  207. fn: function (anIRAssignment){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. var $1;
  211. $1=_st(_st(_st(anIRAssignment)._isInlined())._not())._and_((function(){
  212. return smalltalk.withContext(function($ctx2) {
  213. return _st(_st(_st(_st(anIRAssignment)._instructions())._last())._isSend())._and_((function(){
  214. return smalltalk.withContext(function($ctx3) {
  215. return self._shouldInlineSend_(_st(_st(anIRAssignment)._instructions())._last());
  216. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  218. return $1;
  219. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRInliner)})},
  220. messageSends: ["and:", "shouldInlineSend:", "last", "instructions", "isSend", "not", "isInlined"]}),
  221. smalltalk.IRInliner);
  222. smalltalk.addMethod(
  223. smalltalk.method({
  224. selector: "shouldInlineReturn:",
  225. fn: function (anIRReturn){
  226. var self=this;
  227. return smalltalk.withContext(function($ctx1) {
  228. var $1;
  229. $1=_st(_st(_st(anIRReturn)._isInlined())._not())._and_((function(){
  230. return smalltalk.withContext(function($ctx2) {
  231. return _st(_st(_st(_st(anIRReturn)._instructions())._first())._isSend())._and_((function(){
  232. return smalltalk.withContext(function($ctx3) {
  233. return self._shouldInlineSend_(_st(_st(anIRReturn)._instructions())._first());
  234. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  235. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  236. return $1;
  237. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},smalltalk.IRInliner)})},
  238. messageSends: ["and:", "shouldInlineSend:", "first", "instructions", "isSend", "not", "isInlined"]}),
  239. smalltalk.IRInliner);
  240. smalltalk.addMethod(
  241. smalltalk.method({
  242. selector: "shouldInlineSend:",
  243. fn: function (anIRSend){
  244. var self=this;
  245. function $IRSendInliner(){return smalltalk.IRSendInliner||(typeof IRSendInliner=="undefined"?nil:IRSendInliner)}
  246. return smalltalk.withContext(function($ctx1) {
  247. var $1;
  248. $1=_st(_st(_st(anIRSend)._isInlined())._not())._and_((function(){
  249. return smalltalk.withContext(function($ctx2) {
  250. return _st($IRSendInliner())._shouldInline_(anIRSend);
  251. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  252. return $1;
  253. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},smalltalk.IRInliner)})},
  254. messageSends: ["and:", "shouldInline:", "not", "isInlined"]}),
  255. smalltalk.IRInliner);
  256. smalltalk.addMethod(
  257. smalltalk.method({
  258. selector: "transformNonLocalReturn:",
  259. fn: function (anIRNonLocalReturn){
  260. var self=this;
  261. var localReturn;
  262. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  263. return smalltalk.withContext(function($ctx1) {
  264. var $1,$2,$3,$4,$5;
  265. $1=_st(_st(anIRNonLocalReturn)._scope())._canInlineNonLocalReturns();
  266. if(smalltalk.assert($1)){
  267. _st(_st(_st(anIRNonLocalReturn)._scope())._methodScope())._removeNonLocalReturn_(_st(anIRNonLocalReturn)._scope());
  268. $2=_st($IRReturn())._new();
  269. _st($2)._scope_(_st(anIRNonLocalReturn)._scope());
  270. $3=_st($2)._yourself();
  271. localReturn=$3;
  272. localReturn;
  273. _st(_st(anIRNonLocalReturn)._instructions())._do_((function(each){
  274. return smalltalk.withContext(function($ctx2) {
  275. return _st(localReturn)._add_(each);
  276. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  277. _st(anIRNonLocalReturn)._replaceWith_(localReturn);
  278. $4=localReturn;
  279. return $4;
  280. };
  281. $5=smalltalk.IRInliner.superclass.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]);
  282. return $5;
  283. }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},smalltalk.IRInliner)})},
  284. messageSends: ["ifTrue:", "removeNonLocalReturn:", "scope", "methodScope", "scope:", "new", "yourself", "do:", "add:", "instructions", "replaceWith:", "canInlineNonLocalReturns", "visitIRNonLocalReturn:"]}),
  285. smalltalk.IRInliner);
  286. smalltalk.addMethod(
  287. smalltalk.method({
  288. selector: "visitIRAssignment:",
  289. fn: function (anIRAssignment){
  290. var self=this;
  291. return smalltalk.withContext(function($ctx1) {
  292. var $2,$1;
  293. $2=self._shouldInlineAssignment_(anIRAssignment);
  294. if(smalltalk.assert($2)){
  295. $1=_st(self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  296. } else {
  297. $1=smalltalk.IRInliner.superclass.fn.prototype._visitIRAssignment_.apply(_st(self), [anIRAssignment]);
  298. };
  299. return $1;
  300. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},smalltalk.IRInliner)})},
  301. messageSends: ["ifTrue:ifFalse:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:", "shouldInlineAssignment:"]}),
  302. smalltalk.IRInliner);
  303. smalltalk.addMethod(
  304. smalltalk.method({
  305. selector: "visitIRNonLocalReturn:",
  306. fn: function (anIRNonLocalReturn){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=self._transformNonLocalReturn_(anIRNonLocalReturn);
  311. return $1;
  312. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},smalltalk.IRInliner)})},
  313. messageSends: ["transformNonLocalReturn:"]}),
  314. smalltalk.IRInliner);
  315. smalltalk.addMethod(
  316. smalltalk.method({
  317. selector: "visitIRReturn:",
  318. fn: function (anIRReturn){
  319. var self=this;
  320. return smalltalk.withContext(function($ctx1) {
  321. var $2,$1;
  322. $2=self._shouldInlineReturn_(anIRReturn);
  323. if(smalltalk.assert($2)){
  324. $1=_st(self._returnInliner())._inlineReturn_(anIRReturn);
  325. } else {
  326. $1=smalltalk.IRInliner.superclass.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]);
  327. };
  328. return $1;
  329. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},smalltalk.IRInliner)})},
  330. messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "returnInliner", "visitIRReturn:", "shouldInlineReturn:"]}),
  331. smalltalk.IRInliner);
  332. smalltalk.addMethod(
  333. smalltalk.method({
  334. selector: "visitIRSend:",
  335. fn: function (anIRSend){
  336. var self=this;
  337. return smalltalk.withContext(function($ctx1) {
  338. var $2,$1;
  339. $2=self._shouldInlineSend_(anIRSend);
  340. if(smalltalk.assert($2)){
  341. $1=_st(self._sendInliner())._inlineSend_(anIRSend);
  342. } else {
  343. $1=smalltalk.IRInliner.superclass.fn.prototype._visitIRSend_.apply(_st(self), [anIRSend]);
  344. };
  345. return $1;
  346. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},smalltalk.IRInliner)})},
  347. messageSends: ["ifTrue:ifFalse:", "inlineSend:", "sendInliner", "visitIRSend:", "shouldInlineSend:"]}),
  348. smalltalk.IRInliner);
  349. smalltalk.addClass('IRInliningJSTranslator', smalltalk.IRJSTranslator, [], 'Compiler-Inlining');
  350. smalltalk.addMethod(
  351. smalltalk.method({
  352. selector: "visitIRInlinedAssignment:",
  353. fn: function (anIRInlinedAssignment){
  354. var self=this;
  355. return smalltalk.withContext(function($ctx1) {
  356. self._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last());
  357. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},smalltalk.IRInliningJSTranslator)})},
  358. messageSends: ["visit:", "last", "instructions"]}),
  359. smalltalk.IRInliningJSTranslator);
  360. smalltalk.addMethod(
  361. smalltalk.method({
  362. selector: "visitIRInlinedClosure:",
  363. fn: function (anIRInlinedClosure){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) {
  366. _st(self._stream())._nextPutVars_(_st(_st(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  367. return smalltalk.withContext(function($ctx2) {
  368. return _st(_st(each)._name())._asVariableName();
  369. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})));
  370. _st(_st(anIRInlinedClosure)._instructions())._do_((function(each){
  371. return smalltalk.withContext(function($ctx2) {
  372. return self._visit_(each);
  373. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  374. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},smalltalk.IRInliningJSTranslator)})},
  375. messageSends: ["nextPutVars:", "collect:", "asVariableName", "name", "tempDeclarations", "stream", "do:", "visit:", "instructions"]}),
  376. smalltalk.IRInliningJSTranslator);
  377. smalltalk.addMethod(
  378. smalltalk.method({
  379. selector: "visitIRInlinedIfFalse:",
  380. fn: function (anIRInlinedIfFalse){
  381. var self=this;
  382. return smalltalk.withContext(function($ctx1) {
  383. _st(self._stream())._nextPutIf_with_((function(){
  384. return smalltalk.withContext(function($ctx2) {
  385. _st(self._stream())._nextPutAll_("! smalltalk.assert(");
  386. self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._first());
  387. return _st(self._stream())._nextPutAll_(")");
  388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  389. return smalltalk.withContext(function($ctx2) {
  390. return self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
  391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  392. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},smalltalk.IRInliningJSTranslator)})},
  393. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"]}),
  394. smalltalk.IRInliningJSTranslator);
  395. smalltalk.addMethod(
  396. smalltalk.method({
  397. selector: "visitIRInlinedIfNil:",
  398. fn: function (anIRInlinedIfNil){
  399. var self=this;
  400. return smalltalk.withContext(function($ctx1) {
  401. _st(self._stream())._nextPutIf_with_((function(){
  402. return smalltalk.withContext(function($ctx2) {
  403. _st(self._stream())._nextPutAll_("($receiver = ");
  404. self._visit_(_st(_st(anIRInlinedIfNil)._instructions())._first());
  405. return _st(self._stream())._nextPutAll_(") == nil || $receiver == undefined");
  406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  407. return smalltalk.withContext(function($ctx2) {
  408. return self._visit_(_st(_st(anIRInlinedIfNil)._instructions())._last());
  409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  410. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNil:",{anIRInlinedIfNil:anIRInlinedIfNil},smalltalk.IRInliningJSTranslator)})},
  411. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"]}),
  412. smalltalk.IRInliningJSTranslator);
  413. smalltalk.addMethod(
  414. smalltalk.method({
  415. selector: "visitIRInlinedIfNilIfNotNil:",
  416. fn: function (anIRInlinedIfNilIfNotNil){
  417. var self=this;
  418. return smalltalk.withContext(function($ctx1) {
  419. _st(self._stream())._nextPutIfElse_with_with_((function(){
  420. return smalltalk.withContext(function($ctx2) {
  421. _st(self._stream())._nextPutAll_("($receiver = ");
  422. self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._first());
  423. return _st(self._stream())._nextPutAll_(") == nil || $receiver == undefined");
  424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  425. return smalltalk.withContext(function($ctx2) {
  426. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._second());
  427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  428. return smalltalk.withContext(function($ctx2) {
  429. return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third());
  430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  431. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},smalltalk.IRInliningJSTranslator)})},
  432. messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"]}),
  433. smalltalk.IRInliningJSTranslator);
  434. smalltalk.addMethod(
  435. smalltalk.method({
  436. selector: "visitIRInlinedIfTrue:",
  437. fn: function (anIRInlinedIfTrue){
  438. var self=this;
  439. return smalltalk.withContext(function($ctx1) {
  440. _st(self._stream())._nextPutIf_with_((function(){
  441. return smalltalk.withContext(function($ctx2) {
  442. _st(self._stream())._nextPutAll_("smalltalk.assert(");
  443. self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._first());
  444. return _st(self._stream())._nextPutAll_(")");
  445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  446. return smalltalk.withContext(function($ctx2) {
  447. return self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
  448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  449. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},smalltalk.IRInliningJSTranslator)})},
  450. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"]}),
  451. smalltalk.IRInliningJSTranslator);
  452. smalltalk.addMethod(
  453. smalltalk.method({
  454. selector: "visitIRInlinedIfTrueIfFalse:",
  455. fn: function (anIRInlinedIfTrueIfFalse){
  456. var self=this;
  457. return smalltalk.withContext(function($ctx1) {
  458. _st(self._stream())._nextPutIfElse_with_with_((function(){
  459. return smalltalk.withContext(function($ctx2) {
  460. _st(self._stream())._nextPutAll_("smalltalk.assert(");
  461. self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._first());
  462. return _st(self._stream())._nextPutAll_(")");
  463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  464. return smalltalk.withContext(function($ctx2) {
  465. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._second());
  466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  467. return smalltalk.withContext(function($ctx2) {
  468. return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third());
  469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  470. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},smalltalk.IRInliningJSTranslator)})},
  471. messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"]}),
  472. smalltalk.IRInliningJSTranslator);
  473. smalltalk.addMethod(
  474. smalltalk.method({
  475. selector: "visitIRInlinedNonLocalReturn:",
  476. fn: function (anIRInlinedReturn){
  477. var self=this;
  478. return smalltalk.withContext(function($ctx1) {
  479. _st(self._stream())._nextPutStatementWith_((function(){
  480. return smalltalk.withContext(function($ctx2) {
  481. return self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  483. _st(self._stream())._nextPutNonLocalReturnWith_((function(){
  484. return smalltalk.withContext(function($ctx2) {
  485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  486. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},smalltalk.IRInliningJSTranslator)})},
  487. messageSends: ["nextPutStatementWith:", "visit:", "last", "instructions", "stream", "nextPutNonLocalReturnWith:"]}),
  488. smalltalk.IRInliningJSTranslator);
  489. smalltalk.addMethod(
  490. smalltalk.method({
  491. selector: "visitIRInlinedReturn:",
  492. fn: function (anIRInlinedReturn){
  493. var self=this;
  494. return smalltalk.withContext(function($ctx1) {
  495. self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  496. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},smalltalk.IRInliningJSTranslator)})},
  497. messageSends: ["visit:", "last", "instructions"]}),
  498. smalltalk.IRInliningJSTranslator);
  499. smalltalk.addMethod(
  500. smalltalk.method({
  501. selector: "visitIRInlinedSequence:",
  502. fn: function (anIRInlinedSequence){
  503. var self=this;
  504. return smalltalk.withContext(function($ctx1) {
  505. _st(_st(anIRInlinedSequence)._instructions())._do_((function(each){
  506. return smalltalk.withContext(function($ctx2) {
  507. return _st(self._stream())._nextPutStatementWith_((function(){
  508. return smalltalk.withContext(function($ctx3) {
  509. return self._visit_(each);
  510. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  511. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  512. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},smalltalk.IRInliningJSTranslator)})},
  513. messageSends: ["do:", "nextPutStatementWith:", "visit:", "stream", "instructions"]}),
  514. smalltalk.IRInliningJSTranslator);
  515. smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
  516. smalltalk.addMethod(
  517. smalltalk.method({
  518. selector: "ifFalse:",
  519. fn: function (anIRInstruction){
  520. var self=this;
  521. function $IRInlinedIfFalse(){return smalltalk.IRInlinedIfFalse||(typeof IRInlinedIfFalse=="undefined"?nil:IRInlinedIfFalse)}
  522. return smalltalk.withContext(function($ctx1) {
  523. var $1;
  524. $1=self._inlinedSend_with_(_st($IRInlinedIfFalse())._new(),anIRInstruction);
  525. return $1;
  526. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  527. messageSends: ["inlinedSend:with:", "new"]}),
  528. smalltalk.IRSendInliner);
  529. smalltalk.addMethod(
  530. smalltalk.method({
  531. selector: "ifFalse:ifTrue:",
  532. fn: function (anIRInstruction,anotherIRInstruction){
  533. var self=this;
  534. return smalltalk.withContext(function($ctx1) {
  535. var $1;
  536. $1=self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  537. return $1;
  538. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  539. messageSends: ["perform:withArguments:"]}),
  540. smalltalk.IRSendInliner);
  541. smalltalk.addMethod(
  542. smalltalk.method({
  543. selector: "ifNil:",
  544. fn: function (anIRInstruction){
  545. var self=this;
  546. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  547. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  548. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  549. return smalltalk.withContext(function($ctx1) {
  550. var $2,$3,$4,$5,$1;
  551. $2=_st($IRClosure())._new();
  552. _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  553. $3=_st($IRBlockSequence())._new();
  554. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  555. $4=_st($3)._yourself();
  556. _st($2)._add_($4);
  557. $5=_st($2)._yourself();
  558. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,$5);
  559. return $1;
  560. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  561. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]}),
  562. smalltalk.IRSendInliner);
  563. smalltalk.addMethod(
  564. smalltalk.method({
  565. selector: "ifNil:ifNotNil:",
  566. fn: function (anIRInstruction,anotherIRInstruction){
  567. var self=this;
  568. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  569. return smalltalk.withContext(function($ctx1) {
  570. var $1;
  571. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anIRInstruction,anotherIRInstruction);
  572. return $1;
  573. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  574. messageSends: ["inlinedSend:with:with:", "new"]}),
  575. smalltalk.IRSendInliner);
  576. smalltalk.addMethod(
  577. smalltalk.method({
  578. selector: "ifNotNil:",
  579. fn: function (anIRInstruction){
  580. var self=this;
  581. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  582. function $IRClosure(){return smalltalk.IRClosure||(typeof IRClosure=="undefined"?nil:IRClosure)}
  583. function $IRBlockSequence(){return smalltalk.IRBlockSequence||(typeof IRBlockSequence=="undefined"?nil:IRBlockSequence)}
  584. return smalltalk.withContext(function($ctx1) {
  585. var $2,$3,$4,$5,$1;
  586. $2=_st($IRClosure())._new();
  587. _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  588. $3=_st($IRBlockSequence())._new();
  589. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  590. $4=_st($3)._yourself();
  591. _st($2)._add_($4);
  592. $5=_st($2)._yourself();
  593. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),$5,anIRInstruction);
  594. return $1;
  595. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  596. messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]}),
  597. smalltalk.IRSendInliner);
  598. smalltalk.addMethod(
  599. smalltalk.method({
  600. selector: "ifNotNil:ifNil:",
  601. fn: function (anIRInstruction,anotherIRInstruction){
  602. var self=this;
  603. function $IRInlinedIfNilIfNotNil(){return smalltalk.IRInlinedIfNilIfNotNil||(typeof IRInlinedIfNilIfNotNil=="undefined"?nil:IRInlinedIfNilIfNotNil)}
  604. return smalltalk.withContext(function($ctx1) {
  605. var $1;
  606. $1=self._inlinedSend_with_with_(_st($IRInlinedIfNilIfNotNil())._new(),anotherIRInstruction,anIRInstruction);
  607. return $1;
  608. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  609. messageSends: ["inlinedSend:with:with:", "new"]}),
  610. smalltalk.IRSendInliner);
  611. smalltalk.addMethod(
  612. smalltalk.method({
  613. selector: "ifTrue:",
  614. fn: function (anIRInstruction){
  615. var self=this;
  616. function $IRInlinedIfTrue(){return smalltalk.IRInlinedIfTrue||(typeof IRInlinedIfTrue=="undefined"?nil:IRInlinedIfTrue)}
  617. return smalltalk.withContext(function($ctx1) {
  618. var $1;
  619. $1=self._inlinedSend_with_(_st($IRInlinedIfTrue())._new(),anIRInstruction);
  620. return $1;
  621. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner)})},
  622. messageSends: ["inlinedSend:with:", "new"]}),
  623. smalltalk.IRSendInliner);
  624. smalltalk.addMethod(
  625. smalltalk.method({
  626. selector: "ifTrue:ifFalse:",
  627. fn: function (anIRInstruction,anotherIRInstruction){
  628. var self=this;
  629. function $IRInlinedIfTrueIfFalse(){return smalltalk.IRInlinedIfTrueIfFalse||(typeof IRInlinedIfTrueIfFalse=="undefined"?nil:IRInlinedIfTrueIfFalse)}
  630. return smalltalk.withContext(function($ctx1) {
  631. var $1;
  632. $1=self._inlinedSend_with_with_(_st($IRInlinedIfTrueIfFalse())._new(),anIRInstruction,anotherIRInstruction);
  633. return $1;
  634. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},smalltalk.IRSendInliner)})},
  635. messageSends: ["inlinedSend:with:with:", "new"]}),
  636. smalltalk.IRSendInliner);
  637. smalltalk.addMethod(
  638. smalltalk.method({
  639. selector: "inlineClosure:",
  640. fn: function (anIRClosure){
  641. var self=this;
  642. var inlinedClosure,sequence,statements;
  643. function $IRTempDeclaration(){return smalltalk.IRTempDeclaration||(typeof IRTempDeclaration=="undefined"?nil:IRTempDeclaration)}
  644. function $AliasVar(){return smalltalk.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
  645. function $IRVariable(){return smalltalk.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
  646. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  647. return smalltalk.withContext(function($ctx1) {
  648. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10;
  649. inlinedClosure=self._inlinedClosure();
  650. _st(inlinedClosure)._scope_(_st(anIRClosure)._scope());
  651. _st(_st(anIRClosure)._tempDeclarations())._do_((function(each){
  652. return smalltalk.withContext(function($ctx2) {
  653. return _st(inlinedClosure)._add_(each);
  654. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  655. sequence=self._inlinedSequence();
  656. _st(_st(anIRClosure)._arguments())._do_((function(each){
  657. return smalltalk.withContext(function($ctx2) {
  658. $1=_st($IRTempDeclaration())._new();
  659. _st($1)._name_(each);
  660. $2=_st($1)._yourself();
  661. _st(inlinedClosure)._add_($2);
  662. $3=_st($IRAssignment())._new();
  663. $4=_st($AliasVar())._new();
  664. _st($4)._scope_(_st(inlinedClosure)._scope());
  665. _st($4)._name_(each);
  666. $5=_st($4)._yourself();
  667. _st($3)._add_(_st(_st($IRVariable())._new())._variable_($5));
  668. $6=_st($AliasVar())._new();
  669. _st($6)._scope_(_st(inlinedClosure)._scope());
  670. _st($6)._name_("$receiver");
  671. $7=_st($6)._yourself();
  672. _st($3)._add_(_st(_st($IRVariable())._new())._variable_($7));
  673. $8=_st($3)._yourself();
  674. return _st(sequence)._add_($8);
  675. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  676. _st(inlinedClosure)._add_(sequence);
  677. statements=_st(_st(_st(anIRClosure)._instructions())._last())._instructions();
  678. _st(statements)._ifNotEmpty_((function(){
  679. return smalltalk.withContext(function($ctx2) {
  680. _st(_st(statements)._allButLast())._do_((function(each){
  681. return smalltalk.withContext(function($ctx3) {
  682. return _st(sequence)._add_(each);
  683. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2)})}));
  684. $9=_st(_st(_st(statements)._last())._isReturn())._and_((function(){
  685. return smalltalk.withContext(function($ctx3) {
  686. return _st(_st(statements)._last())._isBlockReturn();
  687. }, function($ctx3) {$ctx3.fillBlock({},$ctx2)})}));
  688. if(smalltalk.assert($9)){
  689. return _st(sequence)._add_(_st(_st(_st(statements)._last())._instructions())._first());
  690. } else {
  691. return _st(sequence)._add_(_st(statements)._last());
  692. };
  693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  694. $10=inlinedClosure;
  695. return $10;
  696. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},smalltalk.IRSendInliner)})},
  697. messageSends: ["inlinedClosure", "scope:", "scope", "do:", "add:", "tempDeclarations", "inlinedSequence", "name:", "new", "yourself", "variable:", "arguments", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "first", "and:", "isBlockReturn", "isReturn"]}),
  698. smalltalk.IRSendInliner);
  699. smalltalk.addMethod(
  700. smalltalk.method({
  701. selector: "inlineSend:",
  702. fn: function (anIRSend){
  703. var self=this;
  704. return smalltalk.withContext(function($ctx1) {
  705. var $1;
  706. self._send_(anIRSend);
  707. $1=self._perform_withArguments_(_st(self._send())._selector(),_st(_st(self._send())._instructions())._allButFirst());
  708. return $1;
  709. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},smalltalk.IRSendInliner)})},
  710. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]}),
  711. smalltalk.IRSendInliner);
  712. smalltalk.addMethod(
  713. smalltalk.method({
  714. selector: "inlinedClosure",
  715. fn: function (){
  716. var self=this;
  717. function $IRInlinedClosure(){return smalltalk.IRInlinedClosure||(typeof IRInlinedClosure=="undefined"?nil:IRInlinedClosure)}
  718. return smalltalk.withContext(function($ctx1) {
  719. var $1;
  720. $1=_st($IRInlinedClosure())._new();
  721. return $1;
  722. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},smalltalk.IRSendInliner)})},
  723. messageSends: ["new"]}),
  724. smalltalk.IRSendInliner);
  725. smalltalk.addMethod(
  726. smalltalk.method({
  727. selector: "inlinedSend:with:",
  728. fn: function (inlinedSend,anIRInstruction){
  729. var self=this;
  730. var inlinedClosure;
  731. return smalltalk.withContext(function($ctx1) {
  732. var $1,$2,$3,$4,$5;
  733. $1=_st(anIRInstruction)._isClosure();
  734. if(! smalltalk.assert($1)){
  735. self._inliningError_("Message argument should be a block");
  736. };
  737. $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
  738. if(! smalltalk.assert($2)){
  739. self._inliningError_("Inlined block should have zero argument");
  740. };
  741. inlinedClosure=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  742. $3=inlinedSend;
  743. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  744. $4=_st($3)._add_(inlinedClosure);
  745. _st(self._send())._replaceWith_(inlinedSend);
  746. $5=inlinedSend;
  747. return $5;
  748. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},smalltalk.IRSendInliner)})},
  749. messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"]}),
  750. smalltalk.IRSendInliner);
  751. smalltalk.addMethod(
  752. smalltalk.method({
  753. selector: "inlinedSend:with:with:",
  754. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  755. var self=this;
  756. var inlinedClosure1,inlinedClosure2;
  757. return smalltalk.withContext(function($ctx1) {
  758. var $1,$2,$3,$4,$5;
  759. $1=_st(anIRInstruction)._isClosure();
  760. if(! smalltalk.assert($1)){
  761. self._inliningError_("Message argument should be a block");
  762. };
  763. $2=_st(anotherIRInstruction)._isClosure();
  764. if(! smalltalk.assert($2)){
  765. self._inliningError_("Message argument should be a block");
  766. };
  767. inlinedClosure1=_st(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
  768. inlinedClosure2=_st(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
  769. $3=inlinedSend;
  770. _st($3)._add_(_st(_st(self._send())._instructions())._first());
  771. _st($3)._add_(inlinedClosure1);
  772. $4=_st($3)._add_(inlinedClosure2);
  773. _st(self._send())._replaceWith_(inlinedSend);
  774. $5=inlinedSend;
  775. return $5;
  776. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},smalltalk.IRSendInliner)})},
  777. messageSends: ["ifFalse:", "inliningError:", "isClosure", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"]}),
  778. smalltalk.IRSendInliner);
  779. smalltalk.addMethod(
  780. smalltalk.method({
  781. selector: "inlinedSequence",
  782. fn: function (){
  783. var self=this;
  784. function $IRInlinedSequence(){return smalltalk.IRInlinedSequence||(typeof IRInlinedSequence=="undefined"?nil:IRInlinedSequence)}
  785. return smalltalk.withContext(function($ctx1) {
  786. var $1;
  787. $1=_st($IRInlinedSequence())._new();
  788. return $1;
  789. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},smalltalk.IRSendInliner)})},
  790. messageSends: ["new"]}),
  791. smalltalk.IRSendInliner);
  792. smalltalk.addMethod(
  793. smalltalk.method({
  794. selector: "inliningError:",
  795. fn: function (aString){
  796. var self=this;
  797. function $InliningError(){return smalltalk.InliningError||(typeof InliningError=="undefined"?nil:InliningError)}
  798. return smalltalk.withContext(function($ctx1) {
  799. _st($InliningError())._signal_(aString);
  800. return self}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},smalltalk.IRSendInliner)})},
  801. messageSends: ["signal:"]}),
  802. smalltalk.IRSendInliner);
  803. smalltalk.addMethod(
  804. smalltalk.method({
  805. selector: "send",
  806. fn: function (){
  807. var self=this;
  808. return smalltalk.withContext(function($ctx1) {
  809. var $1;
  810. $1=self["@send"];
  811. return $1;
  812. }, function($ctx1) {$ctx1.fill(self,"send",{},smalltalk.IRSendInliner)})},
  813. messageSends: []}),
  814. smalltalk.IRSendInliner);
  815. smalltalk.addMethod(
  816. smalltalk.method({
  817. selector: "send:",
  818. fn: function (anIRSend){
  819. var self=this;
  820. return smalltalk.withContext(function($ctx1) {
  821. self["@send"]=anIRSend;
  822. return self}, function($ctx1) {$ctx1.fill(self,"send:",{anIRSend:anIRSend},smalltalk.IRSendInliner)})},
  823. messageSends: []}),
  824. smalltalk.IRSendInliner);
  825. smalltalk.addMethod(
  826. smalltalk.method({
  827. selector: "translator",
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1;
  832. $1=self["@translator"];
  833. return $1;
  834. }, function($ctx1) {$ctx1.fill(self,"translator",{},smalltalk.IRSendInliner)})},
  835. messageSends: []}),
  836. smalltalk.IRSendInliner);
  837. smalltalk.addMethod(
  838. smalltalk.method({
  839. selector: "translator:",
  840. fn: function (anASTTranslator){
  841. var self=this;
  842. return smalltalk.withContext(function($ctx1) {
  843. self["@translator"]=anASTTranslator;
  844. return self}, function($ctx1) {$ctx1.fill(self,"translator:",{anASTTranslator:anASTTranslator},smalltalk.IRSendInliner)})},
  845. messageSends: []}),
  846. smalltalk.IRSendInliner);
  847. smalltalk.addMethod(
  848. smalltalk.method({
  849. selector: "inlinedSelectors",
  850. fn: function (){
  851. var self=this;
  852. return smalltalk.withContext(function($ctx1) {
  853. var $1;
  854. $1=["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  855. return $1;
  856. }, function($ctx1) {$ctx1.fill(self,"inlinedSelectors",{},smalltalk.IRSendInliner.klass)})},
  857. messageSends: []}),
  858. smalltalk.IRSendInliner.klass);
  859. smalltalk.addMethod(
  860. smalltalk.method({
  861. selector: "shouldInline:",
  862. fn: function (anIRInstruction){
  863. var self=this;
  864. return smalltalk.withContext(function($ctx1) {
  865. var $1,$2;
  866. var $early={};
  867. try {
  868. $1=_st(self._inlinedSelectors())._includes_(_st(anIRInstruction)._selector());
  869. if(! smalltalk.assert($1)){
  870. return false;
  871. };
  872. _st(_st(_st(anIRInstruction)._instructions())._allButFirst())._do_((function(each){
  873. return smalltalk.withContext(function($ctx2) {
  874. $2=_st(each)._isClosure();
  875. if(! smalltalk.assert($2)){
  876. throw $early=[false];
  877. };
  878. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  879. return true;
  880. }
  881. catch(e) {if(e===$early)return e[0]; throw e}
  882. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},smalltalk.IRSendInliner.klass)})},
  883. messageSends: ["ifFalse:", "includes:", "selector", "inlinedSelectors", "do:", "isClosure", "allButFirst", "instructions"]}),
  884. smalltalk.IRSendInliner.klass);
  885. smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  886. smalltalk.addMethod(
  887. smalltalk.method({
  888. selector: "assignment",
  889. fn: function (){
  890. var self=this;
  891. return smalltalk.withContext(function($ctx1) {
  892. var $1;
  893. $1=self["@assignment"];
  894. return $1;
  895. }, function($ctx1) {$ctx1.fill(self,"assignment",{},smalltalk.IRAssignmentInliner)})},
  896. messageSends: []}),
  897. smalltalk.IRAssignmentInliner);
  898. smalltalk.addMethod(
  899. smalltalk.method({
  900. selector: "assignment:",
  901. fn: function (aNode){
  902. var self=this;
  903. return smalltalk.withContext(function($ctx1) {
  904. self["@assignment"]=aNode;
  905. return self}, function($ctx1) {$ctx1.fill(self,"assignment:",{aNode:aNode},smalltalk.IRAssignmentInliner)})},
  906. messageSends: []}),
  907. smalltalk.IRAssignmentInliner);
  908. smalltalk.addMethod(
  909. smalltalk.method({
  910. selector: "inlineAssignment:",
  911. fn: function (anIRAssignment){
  912. var self=this;
  913. var inlinedAssignment;
  914. function $IRInlinedAssignment(){return smalltalk.IRInlinedAssignment||(typeof IRInlinedAssignment=="undefined"?nil:IRInlinedAssignment)}
  915. return smalltalk.withContext(function($ctx1) {
  916. var $1;
  917. self._assignment_(anIRAssignment);
  918. inlinedAssignment=_st($IRInlinedAssignment())._new();
  919. _st(_st(anIRAssignment)._instructions())._do_((function(each){
  920. return smalltalk.withContext(function($ctx2) {
  921. return _st(inlinedAssignment)._add_(each);
  922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  923. _st(anIRAssignment)._replaceWith_(inlinedAssignment);
  924. self._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last());
  925. $1=inlinedAssignment;
  926. return $1;
  927. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},smalltalk.IRAssignmentInliner)})},
  928. messageSends: ["assignment:", "new", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"]}),
  929. smalltalk.IRAssignmentInliner);
  930. smalltalk.addMethod(
  931. smalltalk.method({
  932. selector: "inlineClosure:",
  933. fn: function (anIRClosure){
  934. var self=this;
  935. var inlinedClosure,statements;
  936. function $IRAssignment(){return smalltalk.IRAssignment||(typeof IRAssignment=="undefined"?nil:IRAssignment)}
  937. return smalltalk.withContext(function($ctx1) {
  938. var $1,$2,$3,$4;
  939. inlinedClosure=smalltalk.IRAssignmentInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  940. statements=_st(_st(_st(inlinedClosure)._instructions())._last())._instructions();
  941. _st(statements)._ifNotEmpty_((function(){
  942. return smalltalk.withContext(function($ctx2) {
  943. $1=_st(_st(statements)._last())._canBeAssigned();
  944. if(smalltalk.assert($1)){
  945. $2=_st($IRAssignment())._new();
  946. _st($2)._add_(_st(_st(self._assignment())._instructions())._first());
  947. _st($2)._add_(_st(_st(statements)._last())._copy());
  948. $3=_st($2)._yourself();
  949. return _st(_st(statements)._last())._replaceWith_($3);
  950. };
  951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  952. $4=inlinedClosure;
  953. return $4;
  954. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},smalltalk.IRAssignmentInliner)})},
  955. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "replaceWith:", "add:", "first", "assignment", "new", "copy", "yourself", "canBeAssigned"]}),
  956. smalltalk.IRAssignmentInliner);
  957. smalltalk.addClass('IRReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  958. smalltalk.addMethod(
  959. smalltalk.method({
  960. selector: "inlineClosure:",
  961. fn: function (anIRClosure){
  962. var self=this;
  963. var closure,statements;
  964. function $IRReturn(){return smalltalk.IRReturn||(typeof IRReturn=="undefined"?nil:IRReturn)}
  965. return smalltalk.withContext(function($ctx1) {
  966. var $1,$2,$3,$4;
  967. closure=smalltalk.IRReturnInliner.superclass.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  968. statements=_st(_st(_st(closure)._instructions())._last())._instructions();
  969. _st(statements)._ifNotEmpty_((function(){
  970. return smalltalk.withContext(function($ctx2) {
  971. $1=_st(_st(statements)._last())._isReturn();
  972. if(! smalltalk.assert($1)){
  973. $2=_st($IRReturn())._new();
  974. _st($2)._add_(_st(_st(statements)._last())._copy());
  975. $3=_st($2)._yourself();
  976. return _st(_st(statements)._last())._replaceWith_($3);
  977. };
  978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  979. $4=closure;
  980. return $4;
  981. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},smalltalk.IRReturnInliner)})},
  982. messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "replaceWith:", "add:", "copy", "new", "yourself", "isReturn"]}),
  983. smalltalk.IRReturnInliner);
  984. smalltalk.addMethod(
  985. smalltalk.method({
  986. selector: "inlineReturn:",
  987. fn: function (anIRReturn){
  988. var self=this;
  989. var return_;
  990. return smalltalk.withContext(function($ctx1) {
  991. var $1;
  992. return_=self._inlinedReturn();
  993. _st(_st(anIRReturn)._instructions())._do_((function(each){
  994. return smalltalk.withContext(function($ctx2) {
  995. return _st(return_)._add_(each);
  996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  997. _st(anIRReturn)._replaceWith_(return_);
  998. self._inlineSend_(_st(_st(return_)._instructions())._last());
  999. $1=return_;
  1000. return $1;
  1001. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},smalltalk.IRReturnInliner)})},
  1002. messageSends: ["inlinedReturn", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"]}),
  1003. smalltalk.IRReturnInliner);
  1004. smalltalk.addMethod(
  1005. smalltalk.method({
  1006. selector: "inlinedReturn",
  1007. fn: function (){
  1008. var self=this;
  1009. function $IRInlinedReturn(){return smalltalk.IRInlinedReturn||(typeof IRInlinedReturn=="undefined"?nil:IRInlinedReturn)}
  1010. return smalltalk.withContext(function($ctx1) {
  1011. var $1;
  1012. $1=_st($IRInlinedReturn())._new();
  1013. return $1;
  1014. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},smalltalk.IRReturnInliner)})},
  1015. messageSends: ["new"]}),
  1016. smalltalk.IRReturnInliner);
  1017. smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
  1018. smalltalk.addMethod(
  1019. smalltalk.method({
  1020. selector: "compileNode:",
  1021. fn: function (aNode){
  1022. var self=this;
  1023. var ir,stream;
  1024. return smalltalk.withContext(function($ctx1) {
  1025. var $2,$3,$1;
  1026. _st(self._semanticAnalyzer())._visit_(aNode);
  1027. ir=_st(self._translator())._visit_(aNode);
  1028. _st(self._inliner())._visit_(ir);
  1029. $2=self._irTranslator();
  1030. _st($2)._currentClass_(self._currentClass());
  1031. _st($2)._visit_(ir);
  1032. $3=_st($2)._contents();
  1033. $1=$3;
  1034. return $1;
  1035. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},smalltalk.InliningCodeGenerator)})},
  1036. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "currentClass", "irTranslator", "contents"]}),
  1037. smalltalk.InliningCodeGenerator);
  1038. smalltalk.addMethod(
  1039. smalltalk.method({
  1040. selector: "inliner",
  1041. fn: function (){
  1042. var self=this;
  1043. function $IRInliner(){return smalltalk.IRInliner||(typeof IRInliner=="undefined"?nil:IRInliner)}
  1044. return smalltalk.withContext(function($ctx1) {
  1045. var $1;
  1046. $1=_st($IRInliner())._new();
  1047. return $1;
  1048. }, function($ctx1) {$ctx1.fill(self,"inliner",{},smalltalk.InliningCodeGenerator)})},
  1049. messageSends: ["new"]}),
  1050. smalltalk.InliningCodeGenerator);
  1051. smalltalk.addMethod(
  1052. smalltalk.method({
  1053. selector: "irTranslator",
  1054. fn: function (){
  1055. var self=this;
  1056. function $IRInliningJSTranslator(){return smalltalk.IRInliningJSTranslator||(typeof IRInliningJSTranslator=="undefined"?nil:IRInliningJSTranslator)}
  1057. return smalltalk.withContext(function($ctx1) {
  1058. var $1;
  1059. $1=_st($IRInliningJSTranslator())._new();
  1060. return $1;
  1061. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},smalltalk.InliningCodeGenerator)})},
  1062. messageSends: ["new"]}),
  1063. smalltalk.InliningCodeGenerator);