1
0

Compiler-Inlining.deploy.js 32 KB

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