1
0

Compiler-Inlining.js 55 KB

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