Compiler-Inlining.js 67 KB

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