Compiler-Inlining.deploy.js 34 KB

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