Compiler-Inlining.js 67 KB

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