1
0

Compiler-Inlining.js 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335
  1. smalltalk.addPackage('Compiler-Inlining', {});
  2. smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining');
  3. smalltalk.IRInlinedAssignment.comment="I represent an inlined assignment instruction."
  4. smalltalk.addMethod(
  5. "_accept_",
  6. smalltalk.method({
  7. selector: "accept:",
  8. category: 'visiting',
  9. fn: function (aVisitor){
  10. var self=this;
  11. return smalltalk.send(aVisitor,"_visitIRInlinedAssignment_",[self]);
  12. },
  13. args: ["aVisitor"],
  14. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
  15. messageSends: ["visitIRInlinedAssignment:"],
  16. referencedClasses: []
  17. }),
  18. smalltalk.IRInlinedAssignment);
  19. smalltalk.addMethod(
  20. "_isInlined",
  21. smalltalk.method({
  22. selector: "isInlined",
  23. category: 'testing',
  24. fn: function (){
  25. var self=this;
  26. return true;
  27. },
  28. args: [],
  29. source: "isInlined\x0a\x09^ true",
  30. messageSends: [],
  31. referencedClasses: []
  32. }),
  33. smalltalk.IRInlinedAssignment);
  34. smalltalk.addClass('IRInlinedClosure', smalltalk.IRClosure, [], 'Compiler-Inlining');
  35. smalltalk.IRInlinedClosure.comment="I represent an inlined closure instruction."
  36. smalltalk.addMethod(
  37. "_accept_",
  38. smalltalk.method({
  39. selector: "accept:",
  40. category: 'visiting',
  41. fn: function (aVisitor){
  42. var self=this;
  43. smalltalk.send(aVisitor,"_visitIRInlinedClosure_",[self]);
  44. return self},
  45. args: ["aVisitor"],
  46. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  47. messageSends: ["visitIRInlinedClosure:"],
  48. referencedClasses: []
  49. }),
  50. smalltalk.IRInlinedClosure);
  51. smalltalk.addMethod(
  52. "_isInlined",
  53. smalltalk.method({
  54. selector: "isInlined",
  55. category: 'testing',
  56. fn: function (){
  57. var self=this;
  58. return true;
  59. },
  60. args: [],
  61. source: "isInlined\x0a\x09^ true",
  62. messageSends: [],
  63. referencedClasses: []
  64. }),
  65. smalltalk.IRInlinedClosure);
  66. smalltalk.addClass('IRInlinedReturn', smalltalk.IRReturn, [], 'Compiler-Inlining');
  67. smalltalk.IRInlinedReturn.comment="I represent an inlined local return instruction."
  68. smalltalk.addMethod(
  69. "_accept_",
  70. smalltalk.method({
  71. selector: "accept:",
  72. category: 'visiting',
  73. fn: function (aVisitor){
  74. var self=this;
  75. return smalltalk.send(aVisitor,"_visitIRInlinedReturn_",[self]);
  76. },
  77. args: ["aVisitor"],
  78. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
  79. messageSends: ["visitIRInlinedReturn:"],
  80. referencedClasses: []
  81. }),
  82. smalltalk.IRInlinedReturn);
  83. smalltalk.addMethod(
  84. "_isInlined",
  85. smalltalk.method({
  86. selector: "isInlined",
  87. category: 'testing',
  88. fn: function (){
  89. var self=this;
  90. return true;
  91. },
  92. args: [],
  93. source: "isInlined\x0a\x09^ true",
  94. messageSends: [],
  95. referencedClasses: []
  96. }),
  97. smalltalk.IRInlinedReturn);
  98. smalltalk.addClass('IRInlinedNonLocalReturn', smalltalk.IRInlinedReturn, [], 'Compiler-Inlining');
  99. smalltalk.IRInlinedNonLocalReturn.comment="I represent an inlined non local return instruction."
  100. smalltalk.addMethod(
  101. "_accept_",
  102. smalltalk.method({
  103. selector: "accept:",
  104. category: 'visiting',
  105. fn: function (aVisitor){
  106. var self=this;
  107. return smalltalk.send(aVisitor,"_visitIRInlinedNonLocalReturn_",[self]);
  108. },
  109. args: ["aVisitor"],
  110. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedNonLocalReturn: self",
  111. messageSends: ["visitIRInlinedNonLocalReturn:"],
  112. referencedClasses: []
  113. }),
  114. smalltalk.IRInlinedNonLocalReturn);
  115. smalltalk.addMethod(
  116. "_isInlined",
  117. smalltalk.method({
  118. selector: "isInlined",
  119. category: 'testing',
  120. fn: function (){
  121. var self=this;
  122. return true;
  123. },
  124. args: [],
  125. source: "isInlined\x0a\x09^ true",
  126. messageSends: [],
  127. referencedClasses: []
  128. }),
  129. smalltalk.IRInlinedNonLocalReturn);
  130. smalltalk.addClass('IRInlinedSend', smalltalk.IRSend, [], 'Compiler-Inlining');
  131. smalltalk.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions."
  132. smalltalk.addMethod(
  133. "_accept_",
  134. smalltalk.method({
  135. selector: "accept:",
  136. category: 'visiting',
  137. fn: function (aVisitor){
  138. var self=this;
  139. smalltalk.send(aVisitor,"_visitInlinedSend_",[self]);
  140. return self},
  141. args: ["aVisitor"],
  142. source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  143. messageSends: ["visitInlinedSend:"],
  144. referencedClasses: []
  145. }),
  146. smalltalk.IRInlinedSend);
  147. smalltalk.addMethod(
  148. "_isInlined",
  149. smalltalk.method({
  150. selector: "isInlined",
  151. category: 'testing',
  152. fn: function (){
  153. var self=this;
  154. return true;
  155. },
  156. args: [],
  157. source: "isInlined\x0a\x09^ true",
  158. messageSends: [],
  159. referencedClasses: []
  160. }),
  161. smalltalk.IRInlinedSend);
  162. smalltalk.addClass('IRInlinedIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  163. smalltalk.addMethod(
  164. "_accept_",
  165. smalltalk.method({
  166. selector: "accept:",
  167. category: 'visiting',
  168. fn: function (aVisitor){
  169. var self=this;
  170. smalltalk.send(aVisitor,"_visitIRInlinedIfFalse_",[self]);
  171. return self},
  172. args: ["aVisitor"],
  173. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  174. messageSends: ["visitIRInlinedIfFalse:"],
  175. referencedClasses: []
  176. }),
  177. smalltalk.IRInlinedIfFalse);
  178. smalltalk.addClass('IRInlinedIfTrue', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  179. smalltalk.addMethod(
  180. "_accept_",
  181. smalltalk.method({
  182. selector: "accept:",
  183. category: 'visiting',
  184. fn: function (aVisitor){
  185. var self=this;
  186. smalltalk.send(aVisitor,"_visitIRInlinedIfTrue_",[self]);
  187. return self},
  188. args: ["aVisitor"],
  189. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  190. messageSends: ["visitIRInlinedIfTrue:"],
  191. referencedClasses: []
  192. }),
  193. smalltalk.IRInlinedIfTrue);
  194. smalltalk.addClass('IRInlinedSequence', smalltalk.IRBlockSequence, [], 'Compiler-Inlining');
  195. smalltalk.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`)."
  196. smalltalk.addMethod(
  197. "_accept_",
  198. smalltalk.method({
  199. selector: "accept:",
  200. category: 'visiting',
  201. fn: function (aVisitor){
  202. var self=this;
  203. smalltalk.send(aVisitor,"_visitIRInlinedSequence_",[self]);
  204. return self},
  205. args: ["aVisitor"],
  206. source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  207. messageSends: ["visitIRInlinedSequence:"],
  208. referencedClasses: []
  209. }),
  210. smalltalk.IRInlinedSequence);
  211. smalltalk.addMethod(
  212. "_isInlined",
  213. smalltalk.method({
  214. selector: "isInlined",
  215. category: 'testing',
  216. fn: function (){
  217. var self=this;
  218. return true;
  219. },
  220. args: [],
  221. source: "isInlined\x0a\x09^ true",
  222. messageSends: [],
  223. referencedClasses: []
  224. }),
  225. smalltalk.IRInlinedSequence);
  226. smalltalk.addClass('IRAssigningInlinedSequence', smalltalk.IRInlinedSequence, ['assignTo'], 'Compiler-Inlining');
  227. smalltalk.addMethod(
  228. "_accept_",
  229. smalltalk.method({
  230. selector: "accept:",
  231. category: 'accessing',
  232. fn: function (aVisitor){
  233. var self=this;
  234. return smalltalk.send(aVisitor,"_visitIRAssigningInlinedSequence_",[self]);
  235. },
  236. args: ["aVisitor"],
  237. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRAssigningInlinedSequence: self",
  238. messageSends: ["visitIRAssigningInlinedSequence:"],
  239. referencedClasses: []
  240. }),
  241. smalltalk.IRAssigningInlinedSequence);
  242. smalltalk.addMethod(
  243. "_assignTo",
  244. smalltalk.method({
  245. selector: "assignTo",
  246. category: 'accessing',
  247. fn: function (){
  248. var self=this;
  249. return self["@assignTo"];
  250. },
  251. args: [],
  252. source: "assignTo\x0a\x09^ assignTo",
  253. messageSends: [],
  254. referencedClasses: []
  255. }),
  256. smalltalk.IRAssigningInlinedSequence);
  257. smalltalk.addMethod(
  258. "_assignTo_",
  259. smalltalk.method({
  260. selector: "assignTo:",
  261. category: 'accessing',
  262. fn: function (anIRInstruction){
  263. var self=this;
  264. self["@assignTo"]=anIRInstruction;
  265. return self},
  266. args: ["anIRInstruction"],
  267. source: "assignTo: anIRInstruction\x0a\x09assignTo := anIRInstruction",
  268. messageSends: [],
  269. referencedClasses: []
  270. }),
  271. smalltalk.IRAssigningInlinedSequence);
  272. smalltalk.addClass('IRReturningInlinedSequence', smalltalk.IRInlinedSequence, [], 'Compiler-Inlining');
  273. smalltalk.addMethod(
  274. "_accept_",
  275. smalltalk.method({
  276. selector: "accept:",
  277. category: 'visiting',
  278. fn: function (aVisitor){
  279. var self=this;
  280. return smalltalk.send(aVisitor,"_visitIRReturningInlinedSequence_",[self]);
  281. },
  282. args: ["aVisitor"],
  283. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRReturningInlinedSequence: self",
  284. messageSends: ["visitIRReturningInlinedSequence:"],
  285. referencedClasses: []
  286. }),
  287. smalltalk.IRReturningInlinedSequence);
  288. smalltalk.addClass('IRNonLocalReturningInlinedSequence', smalltalk.IRReturningInlinedSequence, [], 'Compiler-Inlining');
  289. smalltalk.addMethod(
  290. "_accept_",
  291. smalltalk.method({
  292. selector: "accept:",
  293. category: 'visiting',
  294. fn: function (aVisitor){
  295. var self=this;
  296. return smalltalk.send(aVisitor,"_visitIRNonLocalReturningInlinedSequence_",[self]);
  297. },
  298. args: ["aVisitor"],
  299. source: "accept: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturningInlinedSequence: self",
  300. messageSends: ["visitIRNonLocalReturningInlinedSequence:"],
  301. referencedClasses: []
  302. }),
  303. smalltalk.IRNonLocalReturningInlinedSequence);
  304. smalltalk.addClass('IRInliner', smalltalk.IRVisitor, [], 'Compiler-Inlining');
  305. smalltalk.IRInliner.comment="I visit an IR tree, inlining message sends and block closures.\x0a\x0aMessage selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`"
  306. smalltalk.addMethod(
  307. "_assignmentInliner",
  308. smalltalk.method({
  309. selector: "assignmentInliner",
  310. category: 'factory',
  311. fn: function (){
  312. var self=this;
  313. var $1,$2;
  314. $1=smalltalk.send((smalltalk.IRAssignmentInliner || IRAssignmentInliner),"_new",[]);
  315. smalltalk.send($1,"_translator_",[self]);
  316. $2=smalltalk.send($1,"_yourself",[]);
  317. return $2;
  318. },
  319. args: [],
  320. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  321. messageSends: ["translator:", "new", "yourself"],
  322. referencedClasses: ["IRAssignmentInliner"]
  323. }),
  324. smalltalk.IRInliner);
  325. smalltalk.addMethod(
  326. "_nonLocalReturnInliner",
  327. smalltalk.method({
  328. selector: "nonLocalReturnInliner",
  329. category: 'factory',
  330. fn: function (){
  331. var self=this;
  332. var $1,$2;
  333. $1=smalltalk.send((smalltalk.IRNonLocalReturnInliner || IRNonLocalReturnInliner),"_new",[]);
  334. smalltalk.send($1,"_translator_",[self]);
  335. $2=smalltalk.send($1,"_yourself",[]);
  336. return $2;
  337. },
  338. args: [],
  339. source: "nonLocalReturnInliner\x0a\x09^ IRNonLocalReturnInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  340. messageSends: ["translator:", "new", "yourself"],
  341. referencedClasses: ["IRNonLocalReturnInliner"]
  342. }),
  343. smalltalk.IRInliner);
  344. smalltalk.addMethod(
  345. "_returnInliner",
  346. smalltalk.method({
  347. selector: "returnInliner",
  348. category: 'factory',
  349. fn: function (){
  350. var self=this;
  351. var $1,$2;
  352. $1=smalltalk.send((smalltalk.IRReturnInliner || IRReturnInliner),"_new",[]);
  353. smalltalk.send($1,"_translator_",[self]);
  354. $2=smalltalk.send($1,"_yourself",[]);
  355. return $2;
  356. },
  357. args: [],
  358. source: "returnInliner\x0a\x09^ IRReturnInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  359. messageSends: ["translator:", "new", "yourself"],
  360. referencedClasses: ["IRReturnInliner"]
  361. }),
  362. smalltalk.IRInliner);
  363. smalltalk.addMethod(
  364. "_sendInliner",
  365. smalltalk.method({
  366. selector: "sendInliner",
  367. category: 'factory',
  368. fn: function (){
  369. var self=this;
  370. var $1,$2;
  371. $1=smalltalk.send((smalltalk.IRSendInliner || IRSendInliner),"_new",[]);
  372. smalltalk.send($1,"_translator_",[self]);
  373. $2=smalltalk.send($1,"_yourself",[]);
  374. return $2;
  375. },
  376. args: [],
  377. source: "sendInliner\x0a\x09^ IRSendInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  378. messageSends: ["translator:", "new", "yourself"],
  379. referencedClasses: ["IRSendInliner"]
  380. }),
  381. smalltalk.IRInliner);
  382. smalltalk.addMethod(
  383. "_shouldInlineAssignment_",
  384. smalltalk.method({
  385. selector: "shouldInlineAssignment:",
  386. category: 'testing',
  387. fn: function (anIRAssignment){
  388. var self=this;
  389. return smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment,"_isInlined",[]),"_not",[]),"_and_",[(function(){
  390. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[]),"_isSend",[]),"_and_",[(function(){
  391. return smalltalk.send(self,"_shouldInlineSend_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[])]);
  392. })]);
  393. })]);
  394. },
  395. args: ["anIRAssignment"],
  396. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [ \x0a\x09\x09anIRAssignment instructions last isSend and: [\x09\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
  397. messageSends: ["and:", "shouldInlineSend:", "last", "instructions", "isSend", "not", "isInlined"],
  398. referencedClasses: []
  399. }),
  400. smalltalk.IRInliner);
  401. smalltalk.addMethod(
  402. "_shouldInlineReturn_",
  403. smalltalk.method({
  404. selector: "shouldInlineReturn:",
  405. category: 'testing',
  406. fn: function (anIRReturn){
  407. var self=this;
  408. return smalltalk.send(smalltalk.send(smalltalk.send(anIRReturn,"_isInlined",[]),"_not",[]),"_and_",[(function(){
  409. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_first",[]),"_isSend",[]),"_and_",[(function(){
  410. return smalltalk.send(self,"_shouldInlineSend_",[smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_first",[])]);
  411. })]);
  412. })]);
  413. },
  414. args: ["anIRReturn"],
  415. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [ \x0a\x09\x09anIRReturn instructions first isSend and: [\x09\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
  416. messageSends: ["and:", "shouldInlineSend:", "first", "instructions", "isSend", "not", "isInlined"],
  417. referencedClasses: []
  418. }),
  419. smalltalk.IRInliner);
  420. smalltalk.addMethod(
  421. "_shouldInlineSend_",
  422. smalltalk.method({
  423. selector: "shouldInlineSend:",
  424. category: 'testing',
  425. fn: function (anIRSend){
  426. var self=this;
  427. return smalltalk.send(smalltalk.send(smalltalk.send(anIRSend,"_isInlined",[]),"_not",[]),"_and_",[(function(){
  428. return smalltalk.send((smalltalk.IRSendInliner || IRSendInliner),"_shouldInline_",[anIRSend]);
  429. })]);
  430. },
  431. args: ["anIRSend"],
  432. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  433. messageSends: ["and:", "shouldInline:", "not", "isInlined"],
  434. referencedClasses: ["IRSendInliner"]
  435. }),
  436. smalltalk.IRInliner);
  437. smalltalk.addMethod(
  438. "_transformNonLocalReturn_",
  439. smalltalk.method({
  440. selector: "transformNonLocalReturn:",
  441. category: 'visiting',
  442. fn: function (anIRNonLocalReturn){
  443. var self=this;
  444. var $1,$2;
  445. var localReturn;
  446. if(smalltalk.assert(smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_scope",[]),"_canInlineNonLocalReturns",[]))){
  447. smalltalk.send(smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_scope",[]),"_methodScope",[]),"_removeNonLocalReturn_",[smalltalk.send(anIRNonLocalReturn,"_scope",[])]);
  448. $1=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
  449. smalltalk.send($1,"_scope_",[smalltalk.send(anIRNonLocalReturn,"_scope",[])]);
  450. $2=smalltalk.send($1,"_yourself",[]);
  451. localReturn=$2;
  452. localReturn;
  453. smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_instructions",[]),"_do_",[(function(each){
  454. return smalltalk.send(localReturn,"_add_",[each]);
  455. })]);
  456. smalltalk.send(anIRNonLocalReturn,"_replaceWith_",[localReturn]);
  457. return localReturn;
  458. };
  459. return smalltalk.send(self,"_visitIRNonLocalReturn_",[anIRNonLocalReturn],smalltalk.IRVisitor);
  460. },
  461. args: ["anIRNonLocalReturn"],
  462. source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
  463. messageSends: ["ifTrue:", "removeNonLocalReturn:", "scope", "methodScope", "scope:", "new", "yourself", "do:", "add:", "instructions", "replaceWith:", "canInlineNonLocalReturns", "visitIRNonLocalReturn:"],
  464. referencedClasses: ["IRReturn"]
  465. }),
  466. smalltalk.IRInliner);
  467. smalltalk.addMethod(
  468. "_visitIRAssignment_",
  469. smalltalk.method({
  470. selector: "visitIRAssignment:",
  471. category: 'visiting',
  472. fn: function (anIRAssignment){
  473. var self=this;
  474. return smalltalk.send(smalltalk.send(self,"_shouldInlineAssignment_",[anIRAssignment]),"_ifTrue_ifFalse_",[(function(){
  475. return smalltalk.send(smalltalk.send(self,"_assignmentInliner",[]),"_inlineAssignment_",[anIRAssignment]);
  476. }),(function(){
  477. return smalltalk.send(self,"_visitIRAssignment_",[anIRAssignment],smalltalk.IRVisitor);
  478. })]);
  479. },
  480. args: ["anIRAssignment"],
  481. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment) \x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  482. messageSends: ["ifTrue:ifFalse:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:", "shouldInlineAssignment:"],
  483. referencedClasses: []
  484. }),
  485. smalltalk.IRInliner);
  486. smalltalk.addMethod(
  487. "_visitIRNonLocalReturn_",
  488. smalltalk.method({
  489. selector: "visitIRNonLocalReturn:",
  490. category: 'visiting',
  491. fn: function (anIRNonLocalReturn){
  492. var self=this;
  493. return smalltalk.send(smalltalk.send(self,"_shouldInlineReturn_",[anIRNonLocalReturn]),"_ifTrue_ifFalse_",[(function(){
  494. return smalltalk.send(smalltalk.send(self,"_nonLocalReturnInliner",[]),"_inlineReturn_",[anIRNonLocalReturn]);
  495. }),(function(){
  496. return smalltalk.send(self,"_transformNonLocalReturn_",[anIRNonLocalReturn]);
  497. })]);
  498. },
  499. args: ["anIRNonLocalReturn"],
  500. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ (self shouldInlineReturn: anIRNonLocalReturn) \x0a\x09\x09ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]\x0a\x09\x09ifFalse: [ self transformNonLocalReturn: anIRNonLocalReturn ]",
  501. messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "nonLocalReturnInliner", "transformNonLocalReturn:", "shouldInlineReturn:"],
  502. referencedClasses: []
  503. }),
  504. smalltalk.IRInliner);
  505. smalltalk.addMethod(
  506. "_visitIRReturn_",
  507. smalltalk.method({
  508. selector: "visitIRReturn:",
  509. category: 'visiting',
  510. fn: function (anIRReturn){
  511. var self=this;
  512. return smalltalk.send(smalltalk.send(self,"_shouldInlineReturn_",[anIRReturn]),"_ifTrue_ifFalse_",[(function(){
  513. return smalltalk.send(smalltalk.send(self,"_returnInliner",[]),"_inlineReturn_",[anIRReturn]);
  514. }),(function(){
  515. return smalltalk.send(self,"_visitIRReturn_",[anIRReturn],smalltalk.IRVisitor);
  516. })]);
  517. },
  518. args: ["anIRReturn"],
  519. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn) \x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  520. messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "returnInliner", "visitIRReturn:", "shouldInlineReturn:"],
  521. referencedClasses: []
  522. }),
  523. smalltalk.IRInliner);
  524. smalltalk.addMethod(
  525. "_visitIRSend_",
  526. smalltalk.method({
  527. selector: "visitIRSend:",
  528. category: 'visiting',
  529. fn: function (anIRSend){
  530. var self=this;
  531. return smalltalk.send(smalltalk.send(self,"_shouldInlineSend_",[anIRSend]),"_ifTrue_ifFalse_",[(function(){
  532. return smalltalk.send(smalltalk.send(self,"_sendInliner",[]),"_inlineSend_",[anIRSend]);
  533. }),(function(){
  534. return smalltalk.send(self,"_visitIRSend_",[anIRSend],smalltalk.IRVisitor);
  535. })]);
  536. },
  537. args: ["anIRSend"],
  538. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  539. messageSends: ["ifTrue:ifFalse:", "inlineSend:", "sendInliner", "visitIRSend:", "shouldInlineSend:"],
  540. referencedClasses: []
  541. }),
  542. smalltalk.IRInliner);
  543. smalltalk.addClass('IRInliningJSTranslator', smalltalk.IRJSTranslator, [], 'Compiler-Inlining');
  544. smalltalk.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance)."
  545. smalltalk.addMethod(
  546. "_visitIRAssigningInlinedSequence_",
  547. smalltalk.method({
  548. selector: "visitIRAssigningInlinedSequence:",
  549. category: 'visiting',
  550. fn: function (anIRInlinedSequence){
  551. var self=this;
  552. var $1,$2;
  553. smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_allButLast",[]),"_do_",[(function(each){
  554. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  555. return smalltalk.send(self,"_visit_",[each]);
  556. })]);
  557. })]);
  558. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  559. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_last",[]),"_canBeAssigned",[]),"_ifTrue_ifFalse_",[(function(){
  560. $1=smalltalk.send(self,"_stream",[]);
  561. smalltalk.send($1,"_nextPutAll_",[smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedSequence,"_assignTo",[]),"_variable",[]),"_alias",[])]);
  562. $2=smalltalk.send($1,"_nextPutAssignment",[]);
  563. $2;
  564. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_last",[])]);
  565. }),(function(){
  566. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_last",[])]);
  567. })]);
  568. })]);
  569. return self},
  570. args: ["anIRInlinedSequence"],
  571. source: "visitIRAssigningInlinedSequence: anIRInlinedSequence\x0a\x0a\x09anIRInlinedSequence instructions allButLast do: [ :each | \x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]].\x0a\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09anIRInlinedSequence instructions last canBeAssigned \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09self stream \x0a\x09\x09\x09\x09\x09nextPutAll: anIRInlinedSequence assignTo variable alias;\x0a \x09nextPutAssignment.\x0a\x09\x09\x09\x09self visit: anIRInlinedSequence instructions last ]\x0a\x09\x09\x09ifFalse: [ self visit: anIRInlinedSequence instructions last ]]",
  572. messageSends: ["do:", "nextPutStatementWith:", "visit:", "stream", "allButLast", "instructions", "ifTrue:ifFalse:", "nextPutAll:", "alias", "variable", "assignTo", "nextPutAssignment", "last", "canBeAssigned"],
  573. referencedClasses: []
  574. }),
  575. smalltalk.IRInliningJSTranslator);
  576. smalltalk.addMethod(
  577. "_visitIRInlinedAssignment_",
  578. smalltalk.method({
  579. selector: "visitIRInlinedAssignment:",
  580. category: 'visiting',
  581. fn: function (anIRInlinedAssignment){
  582. var self=this;
  583. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedAssignment,"_instructions",[]),"_last",[])]);
  584. return self},
  585. args: ["anIRInlinedAssignment"],
  586. source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
  587. messageSends: ["visit:", "last", "instructions"],
  588. referencedClasses: []
  589. }),
  590. smalltalk.IRInliningJSTranslator);
  591. smalltalk.addMethod(
  592. "_visitIRInlinedClosure_",
  593. smalltalk.method({
  594. selector: "visitIRInlinedClosure:",
  595. category: 'visiting',
  596. fn: function (anIRInlinedClosure){
  597. var self=this;
  598. smalltalk.send(smalltalk.send(anIRInlinedClosure,"_instructions",[]),"_do_",[(function(each){
  599. return smalltalk.send(self,"_visit_",[each]);
  600. })]);
  601. return self},
  602. args: ["anIRInlinedClosure"],
  603. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
  604. messageSends: ["do:", "visit:", "instructions"],
  605. referencedClasses: []
  606. }),
  607. smalltalk.IRInliningJSTranslator);
  608. smalltalk.addMethod(
  609. "_visitIRInlinedIfFalse_",
  610. smalltalk.method({
  611. selector: "visitIRInlinedIfFalse:",
  612. category: 'visiting',
  613. fn: function (anIRInlinedIfFalse){
  614. var self=this;
  615. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
  616. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["! smalltalk.assert("]);
  617. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfFalse,"_instructions",[]),"_first",[])]);
  618. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  619. }),(function(){
  620. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfFalse,"_instructions",[]),"_last",[])]);
  621. })]);
  622. return self},
  623. args: ["anIRInlinedIfFalse"],
  624. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [ \x0a\x09\x09self stream nextPutAll: '! smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
  625. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  626. referencedClasses: []
  627. }),
  628. smalltalk.IRInliningJSTranslator);
  629. smalltalk.addMethod(
  630. "_visitIRInlinedIfTrue_",
  631. smalltalk.method({
  632. selector: "visitIRInlinedIfTrue:",
  633. category: 'visiting',
  634. fn: function (anIRInlinedIfTrue){
  635. var self=this;
  636. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
  637. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.assert("]);
  638. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrue,"_instructions",[]),"_first",[])]);
  639. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
  640. }),(function(){
  641. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrue,"_instructions",[]),"_last",[])]);
  642. })]);
  643. return self},
  644. args: ["anIRInlinedIfTrue"],
  645. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [ \x0a\x09\x09self stream nextPutAll: 'smalltalk.assert('. \x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
  646. messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
  647. referencedClasses: []
  648. }),
  649. smalltalk.IRInliningJSTranslator);
  650. smalltalk.addMethod(
  651. "_visitIRInlinedNonLocalReturn_",
  652. smalltalk.method({
  653. selector: "visitIRInlinedNonLocalReturn:",
  654. category: 'visiting',
  655. fn: function (anIRInlinedReturn){
  656. var self=this;
  657. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  658. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedReturn,"_instructions",[]),"_last",[])]);
  659. })]);
  660. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnWith_",[(function(){
  661. })]);
  662. return self},
  663. args: ["anIRInlinedReturn"],
  664. source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
  665. messageSends: ["nextPutStatementWith:", "visit:", "last", "instructions", "stream", "nextPutNonLocalReturnWith:"],
  666. referencedClasses: []
  667. }),
  668. smalltalk.IRInliningJSTranslator);
  669. smalltalk.addMethod(
  670. "_visitIRInlinedReturn_",
  671. smalltalk.method({
  672. selector: "visitIRInlinedReturn:",
  673. category: 'visiting',
  674. fn: function (anIRInlinedReturn){
  675. var self=this;
  676. smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedReturn,"_instructions",[]),"_last",[])]);
  677. return self},
  678. args: ["anIRInlinedReturn"],
  679. source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
  680. messageSends: ["visit:", "last", "instructions"],
  681. referencedClasses: []
  682. }),
  683. smalltalk.IRInliningJSTranslator);
  684. smalltalk.addMethod(
  685. "_visitIRInlinedSequence_",
  686. smalltalk.method({
  687. selector: "visitIRInlinedSequence:",
  688. category: 'visiting',
  689. fn: function (anIRInlinedSequence){
  690. var self=this;
  691. smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_do_",[(function(each){
  692. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  693. return smalltalk.send(self,"_visit_",[each]);
  694. })]);
  695. })]);
  696. return self},
  697. args: ["anIRInlinedSequence"],
  698. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each | \x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
  699. messageSends: ["do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
  700. referencedClasses: []
  701. }),
  702. smalltalk.IRInliningJSTranslator);
  703. smalltalk.addMethod(
  704. "_visitIRNonLocalReturningInlinedSequence_",
  705. smalltalk.method({
  706. selector: "visitIRNonLocalReturningInlinedSequence:",
  707. category: 'visiting',
  708. fn: function (anIRInlinedSequence){
  709. var self=this;
  710. smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_allButLast",[]),"_do_",[(function(each){
  711. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  712. return smalltalk.send(self,"_visit_",[each]);
  713. })]);
  714. })]);
  715. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  716. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_last",[]),"_canBeAssigned",[]),"_ifTrue_ifFalse_",[(function(){
  717. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnWith_",[(function(){
  718. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_last",[])]);
  719. })]);
  720. }),(function(){
  721. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_last",[])]);
  722. })]);
  723. })]);
  724. return self},
  725. args: ["anIRInlinedSequence"],
  726. source: "visitIRNonLocalReturningInlinedSequence: anIRInlinedSequence\x0a\x0a\x09anIRInlinedSequence instructions allButLast do: [ :each | \x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]].\x0a\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09anIRInlinedSequence instructions last canBeAssigned \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09\x09\x09\x09self visit: anIRInlinedSequence instructions last ]]\x0a\x09\x09\x09ifFalse: [ self visit: anIRInlinedSequence instructions last ]]",
  727. messageSends: ["do:", "nextPutStatementWith:", "visit:", "stream", "allButLast", "instructions", "ifTrue:ifFalse:", "nextPutNonLocalReturnWith:", "last", "canBeAssigned"],
  728. referencedClasses: []
  729. }),
  730. smalltalk.IRInliningJSTranslator);
  731. smalltalk.addMethod(
  732. "_visitIRReturningInlinedSequence_",
  733. smalltalk.method({
  734. selector: "visitIRReturningInlinedSequence:",
  735. category: 'visiting',
  736. fn: function (anIRInlinedSequence){
  737. var self=this;
  738. smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_allButLast",[]),"_do_",[(function(each){
  739. return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  740. return smalltalk.send(self,"_visit_",[each]);
  741. })]);
  742. })]);
  743. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
  744. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_last",[]),"_canBeAssigned",[]),"_ifTrue_ifFalse_",[(function(){
  745. smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutReturn",[]);
  746. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_last",[])]);
  747. }),(function(){
  748. return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_last",[])]);
  749. })]);
  750. })]);
  751. return self},
  752. args: ["anIRInlinedSequence"],
  753. source: "visitIRReturningInlinedSequence: anIRInlinedSequence\x0a\x0a\x09anIRInlinedSequence instructions allButLast do: [ :each | \x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]].\x0a\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09anIRInlinedSequence instructions last canBeAssigned \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09self stream nextPutReturn.\x0a\x09\x09\x09\x09self visit: anIRInlinedSequence instructions last ]\x0a\x09\x09\x09ifFalse: [ self visit: anIRInlinedSequence instructions last ]]",
  754. messageSends: ["do:", "nextPutStatementWith:", "visit:", "stream", "allButLast", "instructions", "ifTrue:ifFalse:", "nextPutReturn", "last", "canBeAssigned"],
  755. referencedClasses: []
  756. }),
  757. smalltalk.IRInliningJSTranslator);
  758. smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
  759. smalltalk.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods."
  760. smalltalk.addMethod(
  761. "_ifFalse_",
  762. smalltalk.method({
  763. selector: "ifFalse:",
  764. category: 'inlining',
  765. fn: function (anIRInstruction){
  766. var self=this;
  767. var $1;
  768. var inlinedSend;
  769. var inlinedClosure;
  770. if(! smalltalk.assert(smalltalk.send(anIRInstruction,"_isClosure",[]))){
  771. smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
  772. };
  773. if(! smalltalk.assert(smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]))){
  774. smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
  775. };
  776. inlinedClosure=smalltalk.send(self,"_inlineClosure_",[anIRInstruction]);
  777. inlinedSend=smalltalk.send((smalltalk.IRInlinedIfFalse || IRInlinedIfFalse),"_new",[]);
  778. smalltalk.send(inlinedSend,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
  779. $1=smalltalk.send(inlinedSend,"_add_",[inlinedClosure]);
  780. smalltalk.send(smalltalk.send(self,"_send",[]),"_replaceWith_",[inlinedSend]);
  781. return inlinedSend;
  782. },
  783. args: ["anIRInstruction"],
  784. source: "ifFalse: anIRInstruction\x0a\x09| inlinedSend inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self inlineClosure: anIRInstruction.\x0a\x0a\x09inlinedSend := IRInlinedIfFalse new.\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09^ inlinedSend",
  785. messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "inlineClosure:", "new", "add:", "first", "instructions", "send", "replaceWith:"],
  786. referencedClasses: ["IRInlinedIfFalse"]
  787. }),
  788. smalltalk.IRSendInliner);
  789. smalltalk.addMethod(
  790. "_ifTrue_",
  791. smalltalk.method({
  792. selector: "ifTrue:",
  793. category: 'inlining',
  794. fn: function (anIRInstruction){
  795. var self=this;
  796. var $1;
  797. var inlinedSend;
  798. var inlinedClosure;
  799. if(! smalltalk.assert(smalltalk.send(anIRInstruction,"_isClosure",[]))){
  800. smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
  801. };
  802. if(! smalltalk.assert(smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]))){
  803. smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
  804. };
  805. inlinedClosure=smalltalk.send(self,"_inlineClosure_",[anIRInstruction]);
  806. inlinedSend=smalltalk.send((smalltalk.IRInlinedIfTrue || IRInlinedIfTrue),"_new",[]);
  807. smalltalk.send(inlinedSend,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
  808. $1=smalltalk.send(inlinedSend,"_add_",[inlinedClosure]);
  809. smalltalk.send(smalltalk.send(self,"_send",[]),"_replaceWith_",[inlinedSend]);
  810. return inlinedSend;
  811. },
  812. args: ["anIRInstruction"],
  813. source: "ifTrue: anIRInstruction\x0a\x09| inlinedSend inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self inlineClosure: anIRInstruction.\x0a\x0a\x09inlinedSend := IRInlinedIfTrue new.\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09^ inlinedSend",
  814. messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "inlineClosure:", "new", "add:", "first", "instructions", "send", "replaceWith:"],
  815. referencedClasses: ["IRInlinedIfTrue"]
  816. }),
  817. smalltalk.IRSendInliner);
  818. smalltalk.addMethod(
  819. "_inlineClosure_",
  820. smalltalk.method({
  821. selector: "inlineClosure:",
  822. category: 'inlining',
  823. fn: function (anIRClosure){
  824. var self=this;
  825. var inlinedClosure;
  826. var sequence;
  827. var statements;
  828. inlinedClosure=smalltalk.send(self,"_inlinedClosure",[]);
  829. smalltalk.send(inlinedClosure,"_scope_",[smalltalk.send(anIRClosure,"_scope",[])]);
  830. smalltalk.send(smalltalk.send(anIRClosure,"_instructions",[]),"_do_",[(function(each){
  831. if(! smalltalk.assert(smalltalk.send(each,"_isSequence",[]))){
  832. return smalltalk.send(inlinedClosure,"_add_",[each]);
  833. };
  834. })]);
  835. sequence=smalltalk.send(self,"_inlinedSequence",[]);
  836. smalltalk.send(inlinedClosure,"_add_",[sequence]);
  837. statements=smalltalk.send(smalltalk.send(smalltalk.send(anIRClosure,"_instructions",[]),"_last",[]),"_instructions",[]);
  838. smalltalk.send(statements,"_ifNotEmpty_",[(function(){
  839. smalltalk.send(smalltalk.send(statements,"_allButLast",[]),"_do_",[(function(each){
  840. return smalltalk.send(sequence,"_add_",[smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[each])]);
  841. })]);
  842. return smalltalk.send(smalltalk.send(smalltalk.send(statements,"_last",[]),"_isLocalReturn",[]),"_ifTrue_ifFalse_",[(function(){
  843. return smalltalk.send(sequence,"_add_",[smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(smalltalk.send(smalltalk.send(statements,"_last",[]),"_instructions",[]),"_first",[])])]);
  844. }),(function(){
  845. return smalltalk.send(sequence,"_add_",[smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(statements,"_last",[])])]);
  846. })]);
  847. })]);
  848. return inlinedClosure;
  849. },
  850. args: ["anIRClosure"],
  851. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure scope: anIRClosure scope.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure instructions do: [ :each | \x0a\x09\x09each isSequence ifFalse: [\x0a\x09\x09\x09inlinedClosure add: each ]].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: (self translator visit: each) ].\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09statements last isLocalReturn \x0a\x09\x09\x09ifTrue: [ sequence add: (self translator visit: statements last instructions first) ]\x0a\x09\x09\x09ifFalse: [ sequence add: (self translator visit: statements last) ]].\x0a\x0a\x09^ inlinedClosure",
  852. messageSends: ["inlinedClosure", "scope:", "scope", "do:", "ifFalse:", "add:", "isSequence", "instructions", "inlinedSequence", "last", "ifNotEmpty:", "visit:", "translator", "allButLast", "ifTrue:ifFalse:", "first", "isLocalReturn"],
  853. referencedClasses: []
  854. }),
  855. smalltalk.IRSendInliner);
  856. smalltalk.addMethod(
  857. "_inlineSend_",
  858. smalltalk.method({
  859. selector: "inlineSend:",
  860. category: 'inlining',
  861. fn: function (anIRSend){
  862. var self=this;
  863. smalltalk.send(self,"_send_",[anIRSend]);
  864. return smalltalk.send(self,"_perform_withArguments_",[smalltalk.send(smalltalk.send(self,"_send",[]),"_selector",[]),smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_allButFirst",[])]);
  865. },
  866. args: ["anIRSend"],
  867. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self perform: self send selector withArguments: self send instructions allButFirst",
  868. messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
  869. referencedClasses: []
  870. }),
  871. smalltalk.IRSendInliner);
  872. smalltalk.addMethod(
  873. "_inlinedClosure",
  874. smalltalk.method({
  875. selector: "inlinedClosure",
  876. category: 'factory',
  877. fn: function (){
  878. var self=this;
  879. return smalltalk.send((smalltalk.IRInlinedClosure || IRInlinedClosure),"_new",[]);
  880. },
  881. args: [],
  882. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  883. messageSends: ["new"],
  884. referencedClasses: ["IRInlinedClosure"]
  885. }),
  886. smalltalk.IRSendInliner);
  887. smalltalk.addMethod(
  888. "_inlinedSequence",
  889. smalltalk.method({
  890. selector: "inlinedSequence",
  891. category: 'factory',
  892. fn: function (){
  893. var self=this;
  894. return smalltalk.send((smalltalk.IRInlinedSequence || IRInlinedSequence),"_new",[]);
  895. },
  896. args: [],
  897. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  898. messageSends: ["new"],
  899. referencedClasses: ["IRInlinedSequence"]
  900. }),
  901. smalltalk.IRSendInliner);
  902. smalltalk.addMethod(
  903. "_inliningError_",
  904. smalltalk.method({
  905. selector: "inliningError:",
  906. category: 'error handling',
  907. fn: function (aString){
  908. var self=this;
  909. smalltalk.send((smalltalk.InliningError || InliningError),"_signal_",[aString]);
  910. return self},
  911. args: ["aString"],
  912. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  913. messageSends: ["signal:"],
  914. referencedClasses: ["InliningError"]
  915. }),
  916. smalltalk.IRSendInliner);
  917. smalltalk.addMethod(
  918. "_send",
  919. smalltalk.method({
  920. selector: "send",
  921. category: 'accessing',
  922. fn: function (){
  923. var self=this;
  924. return self["@send"];
  925. },
  926. args: [],
  927. source: "send\x0a\x09^ send",
  928. messageSends: [],
  929. referencedClasses: []
  930. }),
  931. smalltalk.IRSendInliner);
  932. smalltalk.addMethod(
  933. "_send_",
  934. smalltalk.method({
  935. selector: "send:",
  936. category: 'accessing',
  937. fn: function (anIRSend){
  938. var self=this;
  939. self["@send"]=anIRSend;
  940. return self},
  941. args: ["anIRSend"],
  942. source: "send: anIRSend\x0a\x09send := anIRSend",
  943. messageSends: [],
  944. referencedClasses: []
  945. }),
  946. smalltalk.IRSendInliner);
  947. smalltalk.addMethod(
  948. "_translator",
  949. smalltalk.method({
  950. selector: "translator",
  951. category: 'accessing',
  952. fn: function (){
  953. var self=this;
  954. return self["@translator"];
  955. },
  956. args: [],
  957. source: "translator\x0a\x09^ translator",
  958. messageSends: [],
  959. referencedClasses: []
  960. }),
  961. smalltalk.IRSendInliner);
  962. smalltalk.addMethod(
  963. "_translator_",
  964. smalltalk.method({
  965. selector: "translator:",
  966. category: 'accessing',
  967. fn: function (anASTTranslator){
  968. var self=this;
  969. self["@translator"]=anASTTranslator;
  970. return self},
  971. args: ["anASTTranslator"],
  972. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  973. messageSends: [],
  974. referencedClasses: []
  975. }),
  976. smalltalk.IRSendInliner);
  977. smalltalk.addMethod(
  978. "_inlinedSelectors",
  979. smalltalk.method({
  980. selector: "inlinedSelectors",
  981. category: 'accessing',
  982. fn: function (){
  983. var self=this;
  984. return ["ifTrue:", "ifFalse:"];
  985. },
  986. args: [],
  987. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:')",
  988. messageSends: [],
  989. referencedClasses: []
  990. }),
  991. smalltalk.IRSendInliner.klass);
  992. smalltalk.addMethod(
  993. "_shouldInline_",
  994. smalltalk.method({
  995. selector: "shouldInline:",
  996. category: 'accessing',
  997. fn: function (anIRInstruction){
  998. var self=this;
  999. var $early={};
  1000. try {
  1001. if(! smalltalk.assert(smalltalk.send(smalltalk.send(self,"_inlinedSelectors",[]),"_includes_",[smalltalk.send(anIRInstruction,"_selector",[])]))){
  1002. return false;
  1003. };
  1004. smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_instructions",[]),"_allButFirst",[]),"_do_",[(function(each){
  1005. if(! smalltalk.assert(smalltalk.send(each,"_isClosure",[]))){
  1006. throw $early=[false];
  1007. };
  1008. })]);
  1009. return true;
  1010. }
  1011. catch(e) {if(e===$early)return e[0]; throw e}
  1012. },
  1013. args: ["anIRInstruction"],
  1014. source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09anIRInstruction instructions allButFirst do: [ :each |\x0a\x09\x09each isClosure ifFalse: [ ^ false ]].\x0a\x09^ true",
  1015. messageSends: ["ifFalse:", "includes:", "selector", "inlinedSelectors", "do:", "isClosure", "allButFirst", "instructions"],
  1016. referencedClasses: []
  1017. }),
  1018. smalltalk.IRSendInliner.klass);
  1019. smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  1020. smalltalk.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions. \x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if(smalltalk.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};"
  1021. smalltalk.addMethod(
  1022. "_assignment",
  1023. smalltalk.method({
  1024. selector: "assignment",
  1025. category: 'accessing',
  1026. fn: function (){
  1027. var self=this;
  1028. return self["@assignment"];
  1029. },
  1030. args: [],
  1031. source: "assignment\x0a\x09^ assignment",
  1032. messageSends: [],
  1033. referencedClasses: []
  1034. }),
  1035. smalltalk.IRAssignmentInliner);
  1036. smalltalk.addMethod(
  1037. "_assignment_",
  1038. smalltalk.method({
  1039. selector: "assignment:",
  1040. category: 'accessing',
  1041. fn: function (aNode){
  1042. var self=this;
  1043. self["@assignment"]=aNode;
  1044. return self},
  1045. args: ["aNode"],
  1046. source: "assignment: aNode\x0a\x09assignment := aNode",
  1047. messageSends: [],
  1048. referencedClasses: []
  1049. }),
  1050. smalltalk.IRAssignmentInliner);
  1051. smalltalk.addMethod(
  1052. "_inlineAssignment_",
  1053. smalltalk.method({
  1054. selector: "inlineAssignment:",
  1055. category: 'inlining',
  1056. fn: function (anIRAssignment){
  1057. var self=this;
  1058. var inlinedAssignment;
  1059. smalltalk.send(self,"_assignment_",[anIRAssignment]);
  1060. inlinedAssignment=smalltalk.send((smalltalk.IRInlinedAssignment || IRInlinedAssignment),"_new",[]);
  1061. smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_do_",[(function(each){
  1062. return smalltalk.send(inlinedAssignment,"_add_",[each]);
  1063. })]);
  1064. smalltalk.send(anIRAssignment,"_replaceWith_",[inlinedAssignment]);
  1065. smalltalk.send(self,"_inlineSend_",[smalltalk.send(smalltalk.send(inlinedAssignment,"_instructions",[]),"_last",[])]);
  1066. return inlinedAssignment;
  1067. },
  1068. args: ["anIRAssignment"],
  1069. source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment",
  1070. messageSends: ["assignment:", "new", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
  1071. referencedClasses: ["IRInlinedAssignment"]
  1072. }),
  1073. smalltalk.IRAssignmentInliner);
  1074. smalltalk.addMethod(
  1075. "_inlinedSequence",
  1076. smalltalk.method({
  1077. selector: "inlinedSequence",
  1078. category: 'factory',
  1079. fn: function (){
  1080. var self=this;
  1081. var $1,$2;
  1082. $1=smalltalk.send((smalltalk.IRAssigningInlinedSequence || IRAssigningInlinedSequence),"_new",[]);
  1083. smalltalk.send($1,"_assignTo_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_assignment",[]),"_instructions",[]),"_first",[])]);
  1084. $2=smalltalk.send($1,"_yourself",[]);
  1085. return $2;
  1086. },
  1087. args: [],
  1088. source: "inlinedSequence\x0a\x09^ IRAssigningInlinedSequence new\x0a\x09\x09assignTo: self assignment instructions first;\x0a\x09\x09yourself",
  1089. messageSends: ["assignTo:", "first", "instructions", "assignment", "new", "yourself"],
  1090. referencedClasses: ["IRAssigningInlinedSequence"]
  1091. }),
  1092. smalltalk.IRAssignmentInliner);
  1093. smalltalk.addClass('IRReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  1094. smalltalk.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction."
  1095. smalltalk.addMethod(
  1096. "_inlineReturn_",
  1097. smalltalk.method({
  1098. selector: "inlineReturn:",
  1099. category: 'inlining',
  1100. fn: function (anIRReturn){
  1101. var self=this;
  1102. var return_;
  1103. return_=smalltalk.send(self,"_inlinedReturn",[]);
  1104. smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_do_",[(function(each){
  1105. return smalltalk.send(return_,"_add_",[each]);
  1106. })]);
  1107. smalltalk.send(anIRReturn,"_replaceWith_",[return_]);
  1108. smalltalk.send(self,"_inlineSend_",[smalltalk.send(smalltalk.send(return_,"_instructions",[]),"_last",[])]);
  1109. return return_;
  1110. },
  1111. args: ["anIRReturn"],
  1112. source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return",
  1113. messageSends: ["inlinedReturn", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
  1114. referencedClasses: []
  1115. }),
  1116. smalltalk.IRReturnInliner);
  1117. smalltalk.addMethod(
  1118. "_inlinedReturn",
  1119. smalltalk.method({
  1120. selector: "inlinedReturn",
  1121. category: 'factory',
  1122. fn: function (){
  1123. var self=this;
  1124. return smalltalk.send((smalltalk.IRInlinedReturn || IRInlinedReturn),"_new",[]);
  1125. },
  1126. args: [],
  1127. source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
  1128. messageSends: ["new"],
  1129. referencedClasses: ["IRInlinedReturn"]
  1130. }),
  1131. smalltalk.IRReturnInliner);
  1132. smalltalk.addMethod(
  1133. "_inlinedSequence",
  1134. smalltalk.method({
  1135. selector: "inlinedSequence",
  1136. category: 'factory',
  1137. fn: function (){
  1138. var self=this;
  1139. return smalltalk.send((smalltalk.IRReturningInlinedSequence || IRReturningInlinedSequence),"_new",[]);
  1140. },
  1141. args: [],
  1142. source: "inlinedSequence\x0a\x09^ IRReturningInlinedSequence new",
  1143. messageSends: ["new"],
  1144. referencedClasses: ["IRReturningInlinedSequence"]
  1145. }),
  1146. smalltalk.IRReturnInliner);
  1147. smalltalk.addClass('IRNonLocalReturnInliner', smalltalk.IRReturnInliner, [], 'Compiler-Inlining');
  1148. smalltalk.addMethod(
  1149. "_inlinedReturn",
  1150. smalltalk.method({
  1151. selector: "inlinedReturn",
  1152. category: 'factory',
  1153. fn: function (){
  1154. var self=this;
  1155. return smalltalk.send((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn),"_new",[]);
  1156. },
  1157. args: [],
  1158. source: "inlinedReturn\x0a\x09^ IRInlinedNonLocalReturn new",
  1159. messageSends: ["new"],
  1160. referencedClasses: ["IRInlinedNonLocalReturn"]
  1161. }),
  1162. smalltalk.IRNonLocalReturnInliner);
  1163. smalltalk.addMethod(
  1164. "_inlinedSequence",
  1165. smalltalk.method({
  1166. selector: "inlinedSequence",
  1167. category: 'factory',
  1168. fn: function (){
  1169. var self=this;
  1170. return smalltalk.send((smalltalk.IRNonLocalReturningInlinedSequence || IRNonLocalReturningInlinedSequence),"_new",[]);
  1171. },
  1172. args: [],
  1173. source: "inlinedSequence\x0a\x09^ IRNonLocalReturningInlinedSequence new",
  1174. messageSends: ["new"],
  1175. referencedClasses: ["IRNonLocalReturningInlinedSequence"]
  1176. }),
  1177. smalltalk.IRNonLocalReturnInliner);
  1178. smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
  1179. smalltalk.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output"
  1180. smalltalk.addMethod(
  1181. "_compileNode_",
  1182. smalltalk.method({
  1183. selector: "compileNode:",
  1184. category: 'compiling',
  1185. fn: function (aNode){
  1186. var self=this;
  1187. var $1,$2;
  1188. var ir;
  1189. var stream;
  1190. smalltalk.send(smalltalk.send(self,"_semanticAnalyzer",[]),"_visit_",[aNode]);
  1191. ir=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[aNode]);
  1192. smalltalk.send(smalltalk.send(self,"_inliner",[]),"_visit_",[ir]);
  1193. $1=smalltalk.send(self,"_irTranslator",[]);
  1194. smalltalk.send($1,"_visit_",[ir]);
  1195. $2=smalltalk.send($1,"_contents",[]);
  1196. return $2;
  1197. },
  1198. args: ["aNode"],
  1199. source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x09^ self irTranslator\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
  1200. messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "irTranslator", "contents"],
  1201. referencedClasses: []
  1202. }),
  1203. smalltalk.InliningCodeGenerator);
  1204. smalltalk.addMethod(
  1205. "_inliner",
  1206. smalltalk.method({
  1207. selector: "inliner",
  1208. category: 'compiling',
  1209. fn: function (){
  1210. var self=this;
  1211. return smalltalk.send((smalltalk.IRInliner || IRInliner),"_new",[]);
  1212. },
  1213. args: [],
  1214. source: "inliner\x0a\x09^ IRInliner new",
  1215. messageSends: ["new"],
  1216. referencedClasses: ["IRInliner"]
  1217. }),
  1218. smalltalk.InliningCodeGenerator);
  1219. smalltalk.addMethod(
  1220. "_irTranslator",
  1221. smalltalk.method({
  1222. selector: "irTranslator",
  1223. category: 'compiling',
  1224. fn: function (){
  1225. var self=this;
  1226. return smalltalk.send((smalltalk.IRInliningJSTranslator || IRInliningJSTranslator),"_new",[]);
  1227. },
  1228. args: [],
  1229. source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
  1230. messageSends: ["new"],
  1231. referencedClasses: ["IRInliningJSTranslator"]
  1232. }),
  1233. smalltalk.InliningCodeGenerator);