1
0

Compiler-Inlining.deploy.js 38 KB

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