1
0

Compiler-Inlining.deploy.js 40 KB

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