Compiler-Inlining.js 96 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468
  1. define(["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Core", "amber/core/Compiler-IR", "amber/core/Compiler-Semantic", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Compiler-Inlining");
  4. $pkg.innerEval = function (expr) { return eval(expr); };
  5. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  6. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  7. $core.addMethod(
  8. $core.method({
  9. selector: "visitSendNode:",
  10. protocol: "visiting",
  11. //>>excludeStart("ide", pragmas.excludeIdeData);
  12. args: ["aNode"],
  13. source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeAliased: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09(IRSendInliner inlinedSelectorsNeedingIdempotentReceiver includes: aNode selector) ifTrue: [\x0a\x09\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ] ].\x0a\x0a\x09^ super visitSendNode: aNode",
  14. referencedClasses: ["IRSendInliner"],
  15. //>>excludeEnd("ide");
  16. pragmas: [],
  17. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeAliased:", "ifNotNil:", "receiver", "inlinedSelectorsNeedingIdempotentReceiver", "visitSendNode:"]
  18. }, function ($methodClass){ return function (aNode){
  19. var self=this,$self=this;
  20. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21. return $core.withContext(function($ctx1) {
  22. //>>excludeEnd("ctx");
  23. var $1;
  24. if(!$core.assert($recv(aNode)._superSend())){
  25. if($core.assert([$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_([$recv(aNode)._selector()
  26. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27. ,$ctx1.sendIdx["selector"]=1
  28. //>>excludeEnd("ctx");
  29. ][0])
  30. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31. ,$ctx1.sendIdx["includes:"]=1
  32. //>>excludeEnd("ctx");
  33. ][0])){
  34. [$recv(aNode)._shouldBeAliased_(true)
  35. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36. ,$ctx1.sendIdx["shouldBeAliased:"]=1
  37. //>>excludeEnd("ctx");
  38. ][0];
  39. $1=$recv(aNode)._receiver();
  40. if($1 == null || $1.a$nil){
  41. $1;
  42. } else {
  43. var receiver;
  44. receiver=$1;
  45. if($core.assert($recv($recv($globals.IRSendInliner)._inlinedSelectorsNeedingIdempotentReceiver())._includes_($recv(aNode)._selector()))){
  46. $recv(receiver)._shouldBeAliased_(true);
  47. }
  48. }
  49. }
  50. }
  51. return [(
  52. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53. $ctx1.supercall = true,
  54. //>>excludeEnd("ctx");
  55. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.call($self,aNode))
  56. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57. ,$ctx1.supercall = false
  58. //>>excludeEnd("ctx");
  59. ][0];
  60. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})});
  62. //>>excludeEnd("ctx");
  63. }; }),
  64. $globals.ASTPreInliner);
  65. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  66. //>>excludeStart("ide", pragmas.excludeIdeData);
  67. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  68. //>>excludeEnd("ide");
  69. $core.addMethod(
  70. $core.method({
  71. selector: "acceptDagVisitor:",
  72. protocol: "visiting",
  73. //>>excludeStart("ide", pragmas.excludeIdeData);
  74. args: ["aVisitor"],
  75. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  76. referencedClasses: [],
  77. //>>excludeEnd("ide");
  78. pragmas: [],
  79. messageSends: ["visitIRInlinedClosure:"]
  80. }, function ($methodClass){ return function (aVisitor){
  81. var self=this,$self=this;
  82. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  83. return $core.withContext(function($ctx1) {
  84. //>>excludeEnd("ctx");
  85. $recv(aVisitor)._visitIRInlinedClosure_(self);
  86. return self;
  87. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  88. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  89. //>>excludeEnd("ctx");
  90. }; }),
  91. $globals.IRInlinedClosure);
  92. $core.addMethod(
  93. $core.method({
  94. selector: "isInlined",
  95. protocol: "testing",
  96. //>>excludeStart("ide", pragmas.excludeIdeData);
  97. args: [],
  98. source: "isInlined\x0a\x09^ true",
  99. referencedClasses: [],
  100. //>>excludeEnd("ide");
  101. pragmas: [],
  102. messageSends: []
  103. }, function ($methodClass){ return function (){
  104. var self=this,$self=this;
  105. return true;
  106. }; }),
  107. $globals.IRInlinedClosure);
  108. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  109. //>>excludeStart("ide", pragmas.excludeIdeData);
  110. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  111. //>>excludeEnd("ide");
  112. $core.addMethod(
  113. $core.method({
  114. selector: "acceptDagVisitor:",
  115. protocol: "visiting",
  116. //>>excludeStart("ide", pragmas.excludeIdeData);
  117. args: ["aVisitor"],
  118. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  119. referencedClasses: [],
  120. //>>excludeEnd("ide");
  121. pragmas: [],
  122. messageSends: ["visitInlinedSend:"]
  123. }, function ($methodClass){ return function (aVisitor){
  124. var self=this,$self=this;
  125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  126. return $core.withContext(function($ctx1) {
  127. //>>excludeEnd("ctx");
  128. $recv(aVisitor)._visitInlinedSend_(self);
  129. return self;
  130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  131. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  132. //>>excludeEnd("ctx");
  133. }; }),
  134. $globals.IRInlinedSend);
  135. $core.addMethod(
  136. $core.method({
  137. selector: "internalVariables",
  138. protocol: "accessing",
  139. //>>excludeStart("ide", pragmas.excludeIdeData);
  140. args: [],
  141. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  142. referencedClasses: [],
  143. //>>excludeEnd("ide");
  144. pragmas: [],
  145. messageSends: []
  146. }, function ($methodClass){ return function (){
  147. var self=this,$self=this;
  148. return [];
  149. }; }),
  150. $globals.IRInlinedSend);
  151. $core.addMethod(
  152. $core.method({
  153. selector: "isInlined",
  154. protocol: "testing",
  155. //>>excludeStart("ide", pragmas.excludeIdeData);
  156. args: [],
  157. source: "isInlined\x0a\x09^ true",
  158. referencedClasses: [],
  159. //>>excludeEnd("ide");
  160. pragmas: [],
  161. messageSends: []
  162. }, function ($methodClass){ return function (){
  163. var self=this,$self=this;
  164. return true;
  165. }; }),
  166. $globals.IRInlinedSend);
  167. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  168. //>>excludeStart("ide", pragmas.excludeIdeData);
  169. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  170. //>>excludeEnd("ide");
  171. $core.addMethod(
  172. $core.method({
  173. selector: "acceptDagVisitor:",
  174. protocol: "visiting",
  175. //>>excludeStart("ide", pragmas.excludeIdeData);
  176. args: ["aVisitor"],
  177. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  178. referencedClasses: [],
  179. //>>excludeEnd("ide");
  180. pragmas: [],
  181. messageSends: ["visitIRInlinedIfFalse:"]
  182. }, function ($methodClass){ return function (aVisitor){
  183. var self=this,$self=this;
  184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  185. return $core.withContext(function($ctx1) {
  186. //>>excludeEnd("ctx");
  187. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  188. return self;
  189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  190. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  191. //>>excludeEnd("ctx");
  192. }; }),
  193. $globals.IRInlinedIfFalse);
  194. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  195. //>>excludeStart("ide", pragmas.excludeIdeData);
  196. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  197. //>>excludeEnd("ide");
  198. $core.addMethod(
  199. $core.method({
  200. selector: "acceptDagVisitor:",
  201. protocol: "visiting",
  202. //>>excludeStart("ide", pragmas.excludeIdeData);
  203. args: ["aVisitor"],
  204. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  205. referencedClasses: [],
  206. //>>excludeEnd("ide");
  207. pragmas: [],
  208. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  209. }, function ($methodClass){ return function (aVisitor){
  210. var self=this,$self=this;
  211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  212. return $core.withContext(function($ctx1) {
  213. //>>excludeEnd("ctx");
  214. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  215. return self;
  216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  217. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  218. //>>excludeEnd("ctx");
  219. }; }),
  220. $globals.IRInlinedIfNilIfNotNil);
  221. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  222. //>>excludeStart("ide", pragmas.excludeIdeData);
  223. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  224. //>>excludeEnd("ide");
  225. $core.addMethod(
  226. $core.method({
  227. selector: "acceptDagVisitor:",
  228. protocol: "visiting",
  229. //>>excludeStart("ide", pragmas.excludeIdeData);
  230. args: ["aVisitor"],
  231. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  232. referencedClasses: [],
  233. //>>excludeEnd("ide");
  234. pragmas: [],
  235. messageSends: ["visitIRInlinedIfTrue:"]
  236. }, function ($methodClass){ return function (aVisitor){
  237. var self=this,$self=this;
  238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  239. return $core.withContext(function($ctx1) {
  240. //>>excludeEnd("ctx");
  241. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  242. return self;
  243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  244. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  245. //>>excludeEnd("ctx");
  246. }; }),
  247. $globals.IRInlinedIfTrue);
  248. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  249. //>>excludeStart("ide", pragmas.excludeIdeData);
  250. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  251. //>>excludeEnd("ide");
  252. $core.addMethod(
  253. $core.method({
  254. selector: "acceptDagVisitor:",
  255. protocol: "visiting",
  256. //>>excludeStart("ide", pragmas.excludeIdeData);
  257. args: ["aVisitor"],
  258. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  259. referencedClasses: [],
  260. //>>excludeEnd("ide");
  261. pragmas: [],
  262. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  263. }, function ($methodClass){ return function (aVisitor){
  264. var self=this,$self=this;
  265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  266. return $core.withContext(function($ctx1) {
  267. //>>excludeEnd("ctx");
  268. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  269. return self;
  270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  271. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  272. //>>excludeEnd("ctx");
  273. }; }),
  274. $globals.IRInlinedIfTrueIfFalse);
  275. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  276. //>>excludeStart("ide", pragmas.excludeIdeData);
  277. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  278. //>>excludeEnd("ide");
  279. $core.addMethod(
  280. $core.method({
  281. selector: "acceptDagVisitor:",
  282. protocol: "visiting",
  283. //>>excludeStart("ide", pragmas.excludeIdeData);
  284. args: ["aVisitor"],
  285. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  286. referencedClasses: [],
  287. //>>excludeEnd("ide");
  288. pragmas: [],
  289. messageSends: ["visitIRInlinedSequence:"]
  290. }, function ($methodClass){ return function (aVisitor){
  291. var self=this,$self=this;
  292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  293. return $core.withContext(function($ctx1) {
  294. //>>excludeEnd("ctx");
  295. $recv(aVisitor)._visitIRInlinedSequence_(self);
  296. return self;
  297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  298. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})});
  299. //>>excludeEnd("ctx");
  300. }; }),
  301. $globals.IRInlinedSequence);
  302. $core.addMethod(
  303. $core.method({
  304. selector: "isInlined",
  305. protocol: "testing",
  306. //>>excludeStart("ide", pragmas.excludeIdeData);
  307. args: [],
  308. source: "isInlined\x0a\x09^ true",
  309. referencedClasses: [],
  310. //>>excludeEnd("ide");
  311. pragmas: [],
  312. messageSends: []
  313. }, function ($methodClass){ return function (){
  314. var self=this,$self=this;
  315. return true;
  316. }; }),
  317. $globals.IRInlinedSequence);
  318. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  319. //>>excludeStart("ide", pragmas.excludeIdeData);
  320. $globals.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`";
  321. //>>excludeEnd("ide");
  322. $core.addMethod(
  323. $core.method({
  324. selector: "assignmentInliner",
  325. protocol: "factory",
  326. //>>excludeStart("ide", pragmas.excludeIdeData);
  327. args: [],
  328. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  329. referencedClasses: ["IRAssignmentInliner"],
  330. //>>excludeEnd("ide");
  331. pragmas: [],
  332. messageSends: ["translator:", "new", "yourself"]
  333. }, function ($methodClass){ return function (){
  334. var self=this,$self=this;
  335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  336. return $core.withContext(function($ctx1) {
  337. //>>excludeEnd("ctx");
  338. var $1;
  339. $1=$recv($globals.IRAssignmentInliner)._new();
  340. $recv($1)._translator_(self);
  341. return $recv($1)._yourself();
  342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  343. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{})});
  344. //>>excludeEnd("ctx");
  345. }; }),
  346. $globals.IRInliner);
  347. $core.addMethod(
  348. $core.method({
  349. selector: "flattenedReturn:",
  350. protocol: "visiting",
  351. //>>excludeStart("ide", pragmas.excludeIdeData);
  352. args: ["anIRNonLocalReturn"],
  353. source: "flattenedReturn: anIRNonLocalReturn\x0a\x09| localReturn |\x0a\x09localReturn := IRReturn new\x0a\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09yourself.\x0a\x09anIRNonLocalReturn dagChildren do: [ :each | localReturn add: each ].\x0a\x09^ localReturn",
  354. referencedClasses: ["IRReturn"],
  355. //>>excludeEnd("ide");
  356. pragmas: [],
  357. messageSends: ["scope:", "new", "scope", "yourself", "do:", "dagChildren", "add:"]
  358. }, function ($methodClass){ return function (anIRNonLocalReturn){
  359. var self=this,$self=this;
  360. var localReturn;
  361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  362. return $core.withContext(function($ctx1) {
  363. //>>excludeEnd("ctx");
  364. var $1;
  365. $1=$recv($globals.IRReturn)._new();
  366. $recv($1)._scope_($recv(anIRNonLocalReturn)._scope());
  367. localReturn=$recv($1)._yourself();
  368. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  370. return $core.withContext(function($ctx2) {
  371. //>>excludeEnd("ctx");
  372. return $recv(localReturn)._add_(each);
  373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  375. //>>excludeEnd("ctx");
  376. }));
  377. return localReturn;
  378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  379. }, function($ctx1) {$ctx1.fill(self,"flattenedReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn})});
  380. //>>excludeEnd("ctx");
  381. }; }),
  382. $globals.IRInliner);
  383. $core.addMethod(
  384. $core.method({
  385. selector: "nonLocalReturnInliner",
  386. protocol: "factory",
  387. //>>excludeStart("ide", pragmas.excludeIdeData);
  388. args: [],
  389. source: "nonLocalReturnInliner\x0a\x09^ IRNonLocalReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  390. referencedClasses: ["IRNonLocalReturnInliner"],
  391. //>>excludeEnd("ide");
  392. pragmas: [],
  393. messageSends: ["translator:", "new", "yourself"]
  394. }, function ($methodClass){ return function (){
  395. var self=this,$self=this;
  396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  397. return $core.withContext(function($ctx1) {
  398. //>>excludeEnd("ctx");
  399. var $1;
  400. $1=$recv($globals.IRNonLocalReturnInliner)._new();
  401. $recv($1)._translator_(self);
  402. return $recv($1)._yourself();
  403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  404. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturnInliner",{})});
  405. //>>excludeEnd("ctx");
  406. }; }),
  407. $globals.IRInliner);
  408. $core.addMethod(
  409. $core.method({
  410. selector: "returnInliner",
  411. protocol: "factory",
  412. //>>excludeStart("ide", pragmas.excludeIdeData);
  413. args: [],
  414. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  415. referencedClasses: ["IRReturnInliner"],
  416. //>>excludeEnd("ide");
  417. pragmas: [],
  418. messageSends: ["translator:", "new", "yourself"]
  419. }, function ($methodClass){ return function (){
  420. var self=this,$self=this;
  421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  422. return $core.withContext(function($ctx1) {
  423. //>>excludeEnd("ctx");
  424. var $1;
  425. $1=$recv($globals.IRReturnInliner)._new();
  426. $recv($1)._translator_(self);
  427. return $recv($1)._yourself();
  428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  429. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{})});
  430. //>>excludeEnd("ctx");
  431. }; }),
  432. $globals.IRInliner);
  433. $core.addMethod(
  434. $core.method({
  435. selector: "sendInliner",
  436. protocol: "factory",
  437. //>>excludeStart("ide", pragmas.excludeIdeData);
  438. args: [],
  439. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  440. referencedClasses: ["IRSendInliner"],
  441. //>>excludeEnd("ide");
  442. pragmas: [],
  443. messageSends: ["translator:", "new", "yourself"]
  444. }, function ($methodClass){ return function (){
  445. var self=this,$self=this;
  446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  447. return $core.withContext(function($ctx1) {
  448. //>>excludeEnd("ctx");
  449. var $1;
  450. $1=$recv($globals.IRSendInliner)._new();
  451. $recv($1)._translator_(self);
  452. return $recv($1)._yourself();
  453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  454. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{})});
  455. //>>excludeEnd("ctx");
  456. }; }),
  457. $globals.IRInliner);
  458. $core.addMethod(
  459. $core.method({
  460. selector: "shouldInlineAssignment:",
  461. protocol: "testing",
  462. //>>excludeStart("ide", pragmas.excludeIdeData);
  463. args: ["anIRAssignment"],
  464. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  465. referencedClasses: [],
  466. //>>excludeEnd("ide");
  467. pragmas: [],
  468. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  469. }, function ($methodClass){ return function (anIRAssignment){
  470. var self=this,$self=this;
  471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  472. return $core.withContext(function($ctx1) {
  473. //>>excludeEnd("ctx");
  474. return [$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  476. return $core.withContext(function($ctx2) {
  477. //>>excludeEnd("ctx");
  478. return $recv($recv([$recv(anIRAssignment)._right()
  479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  480. ,$ctx2.sendIdx["right"]=1
  481. //>>excludeEnd("ctx");
  482. ][0])._isSend())._and_((function(){
  483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  484. return $core.withContext(function($ctx3) {
  485. //>>excludeEnd("ctx");
  486. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  488. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  489. //>>excludeEnd("ctx");
  490. }));
  491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  493. //>>excludeEnd("ctx");
  494. }))
  495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  496. ,$ctx1.sendIdx["and:"]=1
  497. //>>excludeEnd("ctx");
  498. ][0];
  499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  500. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment})});
  501. //>>excludeEnd("ctx");
  502. }; }),
  503. $globals.IRInliner);
  504. $core.addMethod(
  505. $core.method({
  506. selector: "shouldInlineReturn:",
  507. protocol: "testing",
  508. //>>excludeStart("ide", pragmas.excludeIdeData);
  509. args: ["anIRReturn"],
  510. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  511. referencedClasses: [],
  512. //>>excludeEnd("ide");
  513. pragmas: [],
  514. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  515. }, function ($methodClass){ return function (anIRReturn){
  516. var self=this,$self=this;
  517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  518. return $core.withContext(function($ctx1) {
  519. //>>excludeEnd("ctx");
  520. return [$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  522. return $core.withContext(function($ctx2) {
  523. //>>excludeEnd("ctx");
  524. return $recv($recv([$recv(anIRReturn)._expression()
  525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  526. ,$ctx2.sendIdx["expression"]=1
  527. //>>excludeEnd("ctx");
  528. ][0])._isSend())._and_((function(){
  529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  530. return $core.withContext(function($ctx3) {
  531. //>>excludeEnd("ctx");
  532. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  534. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  535. //>>excludeEnd("ctx");
  536. }));
  537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  539. //>>excludeEnd("ctx");
  540. }))
  541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  542. ,$ctx1.sendIdx["and:"]=1
  543. //>>excludeEnd("ctx");
  544. ][0];
  545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  546. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn})});
  547. //>>excludeEnd("ctx");
  548. }; }),
  549. $globals.IRInliner);
  550. $core.addMethod(
  551. $core.method({
  552. selector: "shouldInlineSend:",
  553. protocol: "testing",
  554. //>>excludeStart("ide", pragmas.excludeIdeData);
  555. args: ["anIRSend"],
  556. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  557. referencedClasses: ["IRSendInliner"],
  558. //>>excludeEnd("ide");
  559. pragmas: [],
  560. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  561. }, function ($methodClass){ return function (anIRSend){
  562. var self=this,$self=this;
  563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  564. return $core.withContext(function($ctx1) {
  565. //>>excludeEnd("ctx");
  566. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  568. return $core.withContext(function($ctx2) {
  569. //>>excludeEnd("ctx");
  570. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  573. //>>excludeEnd("ctx");
  574. }));
  575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  576. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend})});
  577. //>>excludeEnd("ctx");
  578. }; }),
  579. $globals.IRInliner);
  580. $core.addMethod(
  581. $core.method({
  582. selector: "visitIRAssignment:",
  583. protocol: "visiting",
  584. //>>excludeStart("ide", pragmas.excludeIdeData);
  585. args: ["anIRAssignment"],
  586. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  587. referencedClasses: [],
  588. //>>excludeEnd("ide");
  589. pragmas: [],
  590. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  591. }, function ($methodClass){ return function (anIRAssignment){
  592. var self=this,$self=this;
  593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  594. return $core.withContext(function($ctx1) {
  595. //>>excludeEnd("ctx");
  596. if($core.assert($self._shouldInlineAssignment_(anIRAssignment))){
  597. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  598. } else {
  599. return [(
  600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  601. $ctx1.supercall = true,
  602. //>>excludeEnd("ctx");
  603. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.call($self,anIRAssignment))
  604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  605. ,$ctx1.supercall = false
  606. //>>excludeEnd("ctx");
  607. ][0];
  608. }
  609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  610. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})});
  611. //>>excludeEnd("ctx");
  612. }; }),
  613. $globals.IRInliner);
  614. $core.addMethod(
  615. $core.method({
  616. selector: "visitIRNonLocalReturn:",
  617. protocol: "visiting",
  618. //>>excludeStart("ide", pragmas.excludeIdeData);
  619. args: ["anIRNonLocalReturn"],
  620. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09anIRNonLocalReturn scope canFlattenNonLocalReturns ifTrue: [\x0a\x09\x09| localReturn |\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := self flattenedReturn: anIRNonLocalReturn.\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ self visitIRReturn: localReturn ].\x0a\x09^ (self shouldInlineReturn: anIRNonLocalReturn)\x0a\x09\x09ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]\x0a\x09\x09ifFalse: [ super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  621. referencedClasses: [],
  622. //>>excludeEnd("ide");
  623. pragmas: [],
  624. messageSends: ["ifTrue:", "canFlattenNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "flattenedReturn:", "replaceWith:", "visitIRReturn:", "ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "nonLocalReturnInliner", "visitIRNonLocalReturn:"]
  625. }, function ($methodClass){ return function (anIRNonLocalReturn){
  626. var self=this,$self=this;
  627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  628. return $core.withContext(function($ctx1) {
  629. //>>excludeEnd("ctx");
  630. if($core.assert($recv([$recv(anIRNonLocalReturn)._scope()
  631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  632. ,$ctx1.sendIdx["scope"]=1
  633. //>>excludeEnd("ctx");
  634. ][0])._canFlattenNonLocalReturns())){
  635. var localReturn;
  636. $recv($recv([$recv(anIRNonLocalReturn)._scope()
  637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  638. ,$ctx1.sendIdx["scope"]=2
  639. //>>excludeEnd("ctx");
  640. ][0])._methodScope())._removeNonLocalReturn_($recv(anIRNonLocalReturn)._scope());
  641. localReturn=$self._flattenedReturn_(anIRNonLocalReturn);
  642. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  643. return $self._visitIRReturn_(localReturn);
  644. }
  645. if($core.assert($self._shouldInlineReturn_(anIRNonLocalReturn))){
  646. return $recv($self._nonLocalReturnInliner())._inlineReturn_(anIRNonLocalReturn);
  647. } else {
  648. return [(
  649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  650. $ctx1.supercall = true,
  651. //>>excludeEnd("ctx");
  652. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.call($self,anIRNonLocalReturn))
  653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  654. ,$ctx1.supercall = false
  655. //>>excludeEnd("ctx");
  656. ][0];
  657. }
  658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  659. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn})});
  660. //>>excludeEnd("ctx");
  661. }; }),
  662. $globals.IRInliner);
  663. $core.addMethod(
  664. $core.method({
  665. selector: "visitIRReturn:",
  666. protocol: "visiting",
  667. //>>excludeStart("ide", pragmas.excludeIdeData);
  668. args: ["anIRReturn"],
  669. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  670. referencedClasses: [],
  671. //>>excludeEnd("ide");
  672. pragmas: [],
  673. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  674. }, function ($methodClass){ return function (anIRReturn){
  675. var self=this,$self=this;
  676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  677. return $core.withContext(function($ctx1) {
  678. //>>excludeEnd("ctx");
  679. if($core.assert($self._shouldInlineReturn_(anIRReturn))){
  680. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  681. } else {
  682. return [(
  683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  684. $ctx1.supercall = true,
  685. //>>excludeEnd("ctx");
  686. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.call($self,anIRReturn))
  687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  688. ,$ctx1.supercall = false
  689. //>>excludeEnd("ctx");
  690. ][0];
  691. }
  692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  693. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})});
  694. //>>excludeEnd("ctx");
  695. }; }),
  696. $globals.IRInliner);
  697. $core.addMethod(
  698. $core.method({
  699. selector: "visitIRSend:",
  700. protocol: "visiting",
  701. //>>excludeStart("ide", pragmas.excludeIdeData);
  702. args: ["anIRSend"],
  703. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  704. referencedClasses: [],
  705. //>>excludeEnd("ide");
  706. pragmas: [],
  707. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  708. }, function ($methodClass){ return function (anIRSend){
  709. var self=this,$self=this;
  710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  711. return $core.withContext(function($ctx1) {
  712. //>>excludeEnd("ctx");
  713. if($core.assert($self._shouldInlineSend_(anIRSend))){
  714. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  715. } else {
  716. return [(
  717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  718. $ctx1.supercall = true,
  719. //>>excludeEnd("ctx");
  720. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.call($self,anIRSend))
  721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  722. ,$ctx1.supercall = false
  723. //>>excludeEnd("ctx");
  724. ][0];
  725. }
  726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  727. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend})});
  728. //>>excludeEnd("ctx");
  729. }; }),
  730. $globals.IRInliner);
  731. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  732. //>>excludeStart("ide", pragmas.excludeIdeData);
  733. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  734. //>>excludeEnd("ide");
  735. $core.addMethod(
  736. $core.method({
  737. selector: "visitIRInlinedClosure:",
  738. protocol: "visiting",
  739. //>>excludeStart("ide", pragmas.excludeIdeData);
  740. args: ["anIRInlinedClosure"],
  741. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAllChildren: anIRInlinedClosure",
  742. referencedClasses: [],
  743. //>>excludeEnd("ide");
  744. pragmas: [],
  745. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAllChildren:"]
  746. }, function ($methodClass){ return function (anIRInlinedClosure){
  747. var self=this,$self=this;
  748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  749. return $core.withContext(function($ctx1) {
  750. //>>excludeEnd("ctx");
  751. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  753. return $core.withContext(function($ctx2) {
  754. //>>excludeEnd("ctx");
  755. return $recv($recv(each)._name())._asVariableName();
  756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  757. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  758. //>>excludeEnd("ctx");
  759. })));
  760. $self._visitAllChildren_(anIRInlinedClosure);
  761. return self;
  762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  763. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure})});
  764. //>>excludeEnd("ctx");
  765. }; }),
  766. $globals.IRInliningJSTranslator);
  767. $core.addMethod(
  768. $core.method({
  769. selector: "visitIRInlinedIfFalse:",
  770. protocol: "visiting",
  771. //>>excludeStart("ide", pragmas.excludeIdeData);
  772. args: ["anIRInlinedIfFalse"],
  773. source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse dagChildren first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfFalse dagChildren last ]",
  774. referencedClasses: [],
  775. //>>excludeEnd("ide");
  776. pragmas: [],
  777. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  778. }, function ($methodClass){ return function (anIRInlinedIfFalse){
  779. var self=this,$self=this;
  780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  781. return $core.withContext(function($ctx1) {
  782. //>>excludeEnd("ctx");
  783. $recv([$self._stream()
  784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  785. ,$ctx1.sendIdx["stream"]=1
  786. //>>excludeEnd("ctx");
  787. ][0])._nextPutIf_then_((function(){
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. return $core.withContext(function($ctx2) {
  790. //>>excludeEnd("ctx");
  791. [$recv([$self._stream()
  792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  793. ,$ctx2.sendIdx["stream"]=2
  794. //>>excludeEnd("ctx");
  795. ][0])._nextPutAll_("!$core.assert(")
  796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  797. ,$ctx2.sendIdx["nextPutAll:"]=1
  798. //>>excludeEnd("ctx");
  799. ][0];
  800. [$self._visit_($recv([$recv(anIRInlinedIfFalse)._dagChildren()
  801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  802. ,$ctx2.sendIdx["dagChildren"]=1
  803. //>>excludeEnd("ctx");
  804. ][0])._first())
  805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  806. ,$ctx2.sendIdx["visit:"]=1
  807. //>>excludeEnd("ctx");
  808. ][0];
  809. return $recv($self._stream())._nextPutAll_(")");
  810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  811. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  812. //>>excludeEnd("ctx");
  813. }),(function(){
  814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  815. return $core.withContext(function($ctx2) {
  816. //>>excludeEnd("ctx");
  817. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  820. //>>excludeEnd("ctx");
  821. }));
  822. return self;
  823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  824. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse})});
  825. //>>excludeEnd("ctx");
  826. }; }),
  827. $globals.IRInliningJSTranslator);
  828. $core.addMethod(
  829. $core.method({
  830. selector: "visitIRInlinedIfNilIfNotNil:",
  831. protocol: "visiting",
  832. //>>excludeStart("ide", pragmas.excludeIdeData);
  833. args: ["anIRInlinedIfNilIfNotNil"],
  834. source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ' == null || '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: '.a$nil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]",
  835. referencedClasses: [],
  836. //>>excludeEnd("ide");
  837. pragmas: [],
  838. messageSends: ["nextPutIf:then:else:", "stream", "visit:", "first", "dagChildren", "nextPutAll:", "second", "third"]
  839. }, function ($methodClass){ return function (anIRInlinedIfNilIfNotNil){
  840. var self=this,$self=this;
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. return $core.withContext(function($ctx1) {
  843. //>>excludeEnd("ctx");
  844. $recv([$self._stream()
  845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  846. ,$ctx1.sendIdx["stream"]=1
  847. //>>excludeEnd("ctx");
  848. ][0])._nextPutIf_then_else_((function(){
  849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  850. return $core.withContext(function($ctx2) {
  851. //>>excludeEnd("ctx");
  852. [$self._visit_([$recv([$recv(anIRInlinedIfNilIfNotNil)._dagChildren()
  853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  854. ,$ctx2.sendIdx["dagChildren"]=1
  855. //>>excludeEnd("ctx");
  856. ][0])._first()
  857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  858. ,$ctx2.sendIdx["first"]=1
  859. //>>excludeEnd("ctx");
  860. ][0])
  861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  862. ,$ctx2.sendIdx["visit:"]=1
  863. //>>excludeEnd("ctx");
  864. ][0];
  865. [$recv([$self._stream()
  866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  867. ,$ctx2.sendIdx["stream"]=2
  868. //>>excludeEnd("ctx");
  869. ][0])._nextPutAll_(" == null || ")
  870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  871. ,$ctx2.sendIdx["nextPutAll:"]=1
  872. //>>excludeEnd("ctx");
  873. ][0];
  874. [$self._visit_($recv([$recv(anIRInlinedIfNilIfNotNil)._dagChildren()
  875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  876. ,$ctx2.sendIdx["dagChildren"]=2
  877. //>>excludeEnd("ctx");
  878. ][0])._first())
  879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  880. ,$ctx2.sendIdx["visit:"]=2
  881. //>>excludeEnd("ctx");
  882. ][0];
  883. return $recv($self._stream())._nextPutAll_(".a$nil");
  884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  886. //>>excludeEnd("ctx");
  887. }),(function(){
  888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  889. return $core.withContext(function($ctx2) {
  890. //>>excludeEnd("ctx");
  891. return [$self._visit_($recv([$recv(anIRInlinedIfNilIfNotNil)._dagChildren()
  892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  893. ,$ctx2.sendIdx["dagChildren"]=3
  894. //>>excludeEnd("ctx");
  895. ][0])._second())
  896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  897. ,$ctx2.sendIdx["visit:"]=3
  898. //>>excludeEnd("ctx");
  899. ][0];
  900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  902. //>>excludeEnd("ctx");
  903. }),(function(){
  904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  905. return $core.withContext(function($ctx2) {
  906. //>>excludeEnd("ctx");
  907. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  910. //>>excludeEnd("ctx");
  911. }));
  912. return self;
  913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  914. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil})});
  915. //>>excludeEnd("ctx");
  916. }; }),
  917. $globals.IRInliningJSTranslator);
  918. $core.addMethod(
  919. $core.method({
  920. selector: "visitIRInlinedIfTrue:",
  921. protocol: "visiting",
  922. //>>excludeStart("ide", pragmas.excludeIdeData);
  923. args: ["anIRInlinedIfTrue"],
  924. source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue dagChildren first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrue dagChildren last ]",
  925. referencedClasses: [],
  926. //>>excludeEnd("ide");
  927. pragmas: [],
  928. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  929. }, function ($methodClass){ return function (anIRInlinedIfTrue){
  930. var self=this,$self=this;
  931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  932. return $core.withContext(function($ctx1) {
  933. //>>excludeEnd("ctx");
  934. $recv([$self._stream()
  935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  936. ,$ctx1.sendIdx["stream"]=1
  937. //>>excludeEnd("ctx");
  938. ][0])._nextPutIf_then_((function(){
  939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  940. return $core.withContext(function($ctx2) {
  941. //>>excludeEnd("ctx");
  942. [$recv([$self._stream()
  943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  944. ,$ctx2.sendIdx["stream"]=2
  945. //>>excludeEnd("ctx");
  946. ][0])._nextPutAll_("$core.assert(")
  947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  948. ,$ctx2.sendIdx["nextPutAll:"]=1
  949. //>>excludeEnd("ctx");
  950. ][0];
  951. [$self._visit_($recv([$recv(anIRInlinedIfTrue)._dagChildren()
  952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  953. ,$ctx2.sendIdx["dagChildren"]=1
  954. //>>excludeEnd("ctx");
  955. ][0])._first())
  956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  957. ,$ctx2.sendIdx["visit:"]=1
  958. //>>excludeEnd("ctx");
  959. ][0];
  960. return $recv($self._stream())._nextPutAll_(")");
  961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  963. //>>excludeEnd("ctx");
  964. }),(function(){
  965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  966. return $core.withContext(function($ctx2) {
  967. //>>excludeEnd("ctx");
  968. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  971. //>>excludeEnd("ctx");
  972. }));
  973. return self;
  974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  975. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue})});
  976. //>>excludeEnd("ctx");
  977. }; }),
  978. $globals.IRInliningJSTranslator);
  979. $core.addMethod(
  980. $core.method({
  981. selector: "visitIRInlinedIfTrueIfFalse:",
  982. protocol: "visiting",
  983. //>>excludeStart("ide", pragmas.excludeIdeData);
  984. args: ["anIRInlinedIfTrueIfFalse"],
  985. source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrueIfFalse dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfTrueIfFalse dagChildren third ]",
  986. referencedClasses: [],
  987. //>>excludeEnd("ide");
  988. pragmas: [],
  989. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  990. }, function ($methodClass){ return function (anIRInlinedIfTrueIfFalse){
  991. var self=this,$self=this;
  992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  993. return $core.withContext(function($ctx1) {
  994. //>>excludeEnd("ctx");
  995. $recv([$self._stream()
  996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  997. ,$ctx1.sendIdx["stream"]=1
  998. //>>excludeEnd("ctx");
  999. ][0])._nextPutIf_then_else_((function(){
  1000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1001. return $core.withContext(function($ctx2) {
  1002. //>>excludeEnd("ctx");
  1003. [$recv([$self._stream()
  1004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1005. ,$ctx2.sendIdx["stream"]=2
  1006. //>>excludeEnd("ctx");
  1007. ][0])._nextPutAll_("$core.assert(")
  1008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1009. ,$ctx2.sendIdx["nextPutAll:"]=1
  1010. //>>excludeEnd("ctx");
  1011. ][0];
  1012. [$self._visit_($recv([$recv(anIRInlinedIfTrueIfFalse)._dagChildren()
  1013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1014. ,$ctx2.sendIdx["dagChildren"]=1
  1015. //>>excludeEnd("ctx");
  1016. ][0])._first())
  1017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1018. ,$ctx2.sendIdx["visit:"]=1
  1019. //>>excludeEnd("ctx");
  1020. ][0];
  1021. return $recv($self._stream())._nextPutAll_(")");
  1022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1023. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1024. //>>excludeEnd("ctx");
  1025. }),(function(){
  1026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1027. return $core.withContext(function($ctx2) {
  1028. //>>excludeEnd("ctx");
  1029. return [$self._visit_($recv([$recv(anIRInlinedIfTrueIfFalse)._dagChildren()
  1030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1031. ,$ctx2.sendIdx["dagChildren"]=2
  1032. //>>excludeEnd("ctx");
  1033. ][0])._second())
  1034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1035. ,$ctx2.sendIdx["visit:"]=2
  1036. //>>excludeEnd("ctx");
  1037. ][0];
  1038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  1040. //>>excludeEnd("ctx");
  1041. }),(function(){
  1042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1043. return $core.withContext(function($ctx2) {
  1044. //>>excludeEnd("ctx");
  1045. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  1046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1047. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  1048. //>>excludeEnd("ctx");
  1049. }));
  1050. return self;
  1051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1052. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse})});
  1053. //>>excludeEnd("ctx");
  1054. }; }),
  1055. $globals.IRInliningJSTranslator);
  1056. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  1057. //>>excludeStart("ide", pragmas.excludeIdeData);
  1058. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  1059. //>>excludeEnd("ide");
  1060. $core.addMethod(
  1061. $core.method({
  1062. selector: "ifFalse:",
  1063. protocol: "inlining",
  1064. //>>excludeStart("ide", pragmas.excludeIdeData);
  1065. args: ["anIRInstruction"],
  1066. source: "ifFalse: anIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  1067. referencedClasses: ["IRInlinedIfFalse"],
  1068. //>>excludeEnd("ide");
  1069. pragmas: [],
  1070. messageSends: ["mustBeNiladicClosure:", "inlinedSend:withBlock:", "new"]
  1071. }, function ($methodClass){ return function (anIRInstruction){
  1072. var self=this,$self=this;
  1073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1074. return $core.withContext(function($ctx1) {
  1075. //>>excludeEnd("ctx");
  1076. $self._mustBeNiladicClosure_(anIRInstruction);
  1077. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  1078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1079. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction})});
  1080. //>>excludeEnd("ctx");
  1081. }; }),
  1082. $globals.IRSendInliner);
  1083. $core.addMethod(
  1084. $core.method({
  1085. selector: "ifFalse:ifTrue:",
  1086. protocol: "inlining",
  1087. //>>excludeStart("ide", pragmas.excludeIdeData);
  1088. args: ["anIRInstruction", "anotherIRInstruction"],
  1089. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09self mustBeNiladicClosure: anotherIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  1090. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  1091. //>>excludeEnd("ide");
  1092. pragmas: [],
  1093. messageSends: ["mustBeNiladicClosure:", "inlinedSend:withBlock:withBlock:", "new"]
  1094. }, function ($methodClass){ return function (anIRInstruction,anotherIRInstruction){
  1095. var self=this,$self=this;
  1096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1097. return $core.withContext(function($ctx1) {
  1098. //>>excludeEnd("ctx");
  1099. [$self._mustBeNiladicClosure_(anIRInstruction)
  1100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1101. ,$ctx1.sendIdx["mustBeNiladicClosure:"]=1
  1102. //>>excludeEnd("ctx");
  1103. ][0];
  1104. $self._mustBeNiladicClosure_(anotherIRInstruction);
  1105. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anotherIRInstruction,anIRInstruction);
  1106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1107. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  1108. //>>excludeEnd("ctx");
  1109. }; }),
  1110. $globals.IRSendInliner);
  1111. $core.addMethod(
  1112. $core.method({
  1113. selector: "ifNil:",
  1114. protocol: "inlining",
  1115. //>>excludeStart("ide", pragmas.excludeIdeData);
  1116. args: ["anIRInstruction"],
  1117. source: "ifNil: anIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: anIRInstruction\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
  1118. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  1119. //>>excludeEnd("ide");
  1120. pragmas: [],
  1121. messageSends: ["mustBeNiladicClosure:", "inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  1122. }, function ($methodClass){ return function (anIRInstruction){
  1123. var self=this,$self=this;
  1124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1125. return $core.withContext(function($ctx1) {
  1126. //>>excludeEnd("ctx");
  1127. var $1,$2,$3;
  1128. $self._mustBeNiladicClosure_(anIRInstruction);
  1129. $1=[$recv($globals.IRInlinedIfNilIfNotNil)._new()
  1130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1131. ,$ctx1.sendIdx["new"]=1
  1132. //>>excludeEnd("ctx");
  1133. ][0];
  1134. $2=[$recv($globals.IRClosure)._new()
  1135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1136. ,$ctx1.sendIdx["new"]=2
  1137. //>>excludeEnd("ctx");
  1138. ][0];
  1139. $recv($2)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  1140. $3=$recv($globals.IRBlockSequence)._new();
  1141. $recv($3)._add_($recv($self._send())._receiver());
  1142. [$recv($2)._add_([$recv($3)._yourself()
  1143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1144. ,$ctx1.sendIdx["yourself"]=1
  1145. //>>excludeEnd("ctx");
  1146. ][0])
  1147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1148. ,$ctx1.sendIdx["add:"]=1
  1149. //>>excludeEnd("ctx");
  1150. ][0];
  1151. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$recv($2)._yourself());
  1152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1153. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction})});
  1154. //>>excludeEnd("ctx");
  1155. }; }),
  1156. $globals.IRSendInliner);
  1157. $core.addMethod(
  1158. $core.method({
  1159. selector: "ifNil:ifNotNil:",
  1160. protocol: "inlining",
  1161. //>>excludeStart("ide", pragmas.excludeIdeData);
  1162. args: ["anIRInstruction", "anotherIRInstruction"],
  1163. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09self mustBeNiladicOrUnaryClosure: anotherIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  1164. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  1165. //>>excludeEnd("ide");
  1166. pragmas: [],
  1167. messageSends: ["mustBeNiladicClosure:", "mustBeNiladicOrUnaryClosure:", "inlinedSend:withBlock:withBlock:", "new"]
  1168. }, function ($methodClass){ return function (anIRInstruction,anotherIRInstruction){
  1169. var self=this,$self=this;
  1170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1171. return $core.withContext(function($ctx1) {
  1172. //>>excludeEnd("ctx");
  1173. $self._mustBeNiladicClosure_(anIRInstruction);
  1174. $self._mustBeNiladicOrUnaryClosure_(anotherIRInstruction);
  1175. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  1176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1177. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  1178. //>>excludeEnd("ctx");
  1179. }; }),
  1180. $globals.IRSendInliner);
  1181. $core.addMethod(
  1182. $core.method({
  1183. selector: "ifNotNil:",
  1184. protocol: "inlining",
  1185. //>>excludeStart("ide", pragmas.excludeIdeData);
  1186. args: ["anIRInstruction"],
  1187. source: "ifNotNil: anIRInstruction\x0a\x09self mustBeNiladicOrUnaryClosure: anIRInstruction.\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
  1188. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  1189. //>>excludeEnd("ide");
  1190. pragmas: [],
  1191. messageSends: ["mustBeNiladicOrUnaryClosure:", "inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  1192. }, function ($methodClass){ return function (anIRInstruction){
  1193. var self=this,$self=this;
  1194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1195. return $core.withContext(function($ctx1) {
  1196. //>>excludeEnd("ctx");
  1197. var $1,$2,$3;
  1198. $self._mustBeNiladicOrUnaryClosure_(anIRInstruction);
  1199. $1=[$recv($globals.IRInlinedIfNilIfNotNil)._new()
  1200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1201. ,$ctx1.sendIdx["new"]=1
  1202. //>>excludeEnd("ctx");
  1203. ][0];
  1204. $2=[$recv($globals.IRClosure)._new()
  1205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1206. ,$ctx1.sendIdx["new"]=2
  1207. //>>excludeEnd("ctx");
  1208. ][0];
  1209. $recv($2)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  1210. $3=$recv($globals.IRBlockSequence)._new();
  1211. $recv($3)._add_($recv($self._send())._receiver());
  1212. [$recv($2)._add_([$recv($3)._yourself()
  1213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1214. ,$ctx1.sendIdx["yourself"]=1
  1215. //>>excludeEnd("ctx");
  1216. ][0])
  1217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1218. ,$ctx1.sendIdx["add:"]=1
  1219. //>>excludeEnd("ctx");
  1220. ][0];
  1221. return $self._inlinedSend_withBlock_withBlock_($1,$recv($2)._yourself(),anIRInstruction);
  1222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1223. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction})});
  1224. //>>excludeEnd("ctx");
  1225. }; }),
  1226. $globals.IRSendInliner);
  1227. $core.addMethod(
  1228. $core.method({
  1229. selector: "ifNotNil:ifNil:",
  1230. protocol: "inlining",
  1231. //>>excludeStart("ide", pragmas.excludeIdeData);
  1232. args: ["anIRInstruction", "anotherIRInstruction"],
  1233. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09self mustBeNiladicOrUnaryClosure: anIRInstruction.\x0a\x09self mustBeNiladicClosure: anotherIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  1234. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  1235. //>>excludeEnd("ide");
  1236. pragmas: [],
  1237. messageSends: ["mustBeNiladicOrUnaryClosure:", "mustBeNiladicClosure:", "inlinedSend:withBlock:withBlock:", "new"]
  1238. }, function ($methodClass){ return function (anIRInstruction,anotherIRInstruction){
  1239. var self=this,$self=this;
  1240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1241. return $core.withContext(function($ctx1) {
  1242. //>>excludeEnd("ctx");
  1243. $self._mustBeNiladicOrUnaryClosure_(anIRInstruction);
  1244. $self._mustBeNiladicClosure_(anotherIRInstruction);
  1245. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  1246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1247. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  1248. //>>excludeEnd("ctx");
  1249. }; }),
  1250. $globals.IRSendInliner);
  1251. $core.addMethod(
  1252. $core.method({
  1253. selector: "ifTrue:",
  1254. protocol: "inlining",
  1255. //>>excludeStart("ide", pragmas.excludeIdeData);
  1256. args: ["anIRInstruction"],
  1257. source: "ifTrue: anIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  1258. referencedClasses: ["IRInlinedIfTrue"],
  1259. //>>excludeEnd("ide");
  1260. pragmas: [],
  1261. messageSends: ["mustBeNiladicClosure:", "inlinedSend:withBlock:", "new"]
  1262. }, function ($methodClass){ return function (anIRInstruction){
  1263. var self=this,$self=this;
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. return $core.withContext(function($ctx1) {
  1266. //>>excludeEnd("ctx");
  1267. $self._mustBeNiladicClosure_(anIRInstruction);
  1268. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  1269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1270. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction})});
  1271. //>>excludeEnd("ctx");
  1272. }; }),
  1273. $globals.IRSendInliner);
  1274. $core.addMethod(
  1275. $core.method({
  1276. selector: "ifTrue:ifFalse:",
  1277. protocol: "inlining",
  1278. //>>excludeStart("ide", pragmas.excludeIdeData);
  1279. args: ["anIRInstruction", "anotherIRInstruction"],
  1280. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09self mustBeNiladicClosure: anIRInstruction.\x0a\x09self mustBeNiladicClosure: anotherIRInstruction.\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  1281. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  1282. //>>excludeEnd("ide");
  1283. pragmas: [],
  1284. messageSends: ["mustBeNiladicClosure:", "inlinedSend:withBlock:withBlock:", "new"]
  1285. }, function ($methodClass){ return function (anIRInstruction,anotherIRInstruction){
  1286. var self=this,$self=this;
  1287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1288. return $core.withContext(function($ctx1) {
  1289. //>>excludeEnd("ctx");
  1290. [$self._mustBeNiladicClosure_(anIRInstruction)
  1291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1292. ,$ctx1.sendIdx["mustBeNiladicClosure:"]=1
  1293. //>>excludeEnd("ctx");
  1294. ][0];
  1295. $self._mustBeNiladicClosure_(anotherIRInstruction);
  1296. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  1297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1298. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction})});
  1299. //>>excludeEnd("ctx");
  1300. }; }),
  1301. $globals.IRSendInliner);
  1302. $core.addMethod(
  1303. $core.method({
  1304. selector: "inlineClosure:",
  1305. protocol: "inlining",
  1306. //>>excludeStart("ide", pragmas.excludeIdeData);
  1307. args: ["anIRClosure"],
  1308. source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\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: (ArgVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: self send receiver;\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 sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures change local returns into result value itself\x22\x0a\x09\x09sequence add: statements last asInlinedBlockResult ].\x0a\x0a\x09^ inlinedClosure",
  1309. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "ArgVar"],
  1310. //>>excludeEnd("ide");
  1311. pragmas: [],
  1312. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "receiver", "send", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  1313. }, function ($methodClass){ return function (anIRClosure){
  1314. var self=this,$self=this;
  1315. var inlinedClosure,sequence,statements;
  1316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1317. return $core.withContext(function($ctx1) {
  1318. //>>excludeEnd("ctx");
  1319. var $1,$2,$3,$4,$5,$6,$7;
  1320. inlinedClosure=$self._inlinedClosure();
  1321. $1=inlinedClosure;
  1322. [$recv($1)._scope_([$recv(anIRClosure)._scope()
  1323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1324. ,$ctx1.sendIdx["scope"]=1
  1325. //>>excludeEnd("ctx");
  1326. ][0])
  1327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1328. ,$ctx1.sendIdx["scope:"]=1
  1329. //>>excludeEnd("ctx");
  1330. ][0];
  1331. $recv($1)._parent_($recv(anIRClosure)._parent());
  1332. [$recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  1333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1334. return $core.withContext(function($ctx2) {
  1335. //>>excludeEnd("ctx");
  1336. return [$recv(inlinedClosure)._add_(each)
  1337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1338. ,$ctx2.sendIdx["add:"]=1
  1339. //>>excludeEnd("ctx");
  1340. ][0];
  1341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1343. //>>excludeEnd("ctx");
  1344. }))
  1345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1346. ,$ctx1.sendIdx["do:"]=1
  1347. //>>excludeEnd("ctx");
  1348. ][0];
  1349. sequence=$self._inlinedSequence();
  1350. [$recv($recv(anIRClosure)._arguments())._do_((function(each){
  1351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1352. return $core.withContext(function($ctx2) {
  1353. //>>excludeEnd("ctx");
  1354. $2=inlinedClosure;
  1355. $3=[$recv($globals.IRTempDeclaration)._new()
  1356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1357. ,$ctx2.sendIdx["new"]=1
  1358. //>>excludeEnd("ctx");
  1359. ][0];
  1360. [$recv($3)._name_(each)
  1361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1362. ,$ctx2.sendIdx["name:"]=1
  1363. //>>excludeEnd("ctx");
  1364. ][0];
  1365. [$recv($2)._add_([$recv($3)._yourself()
  1366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1367. ,$ctx2.sendIdx["yourself"]=1
  1368. //>>excludeEnd("ctx");
  1369. ][0])
  1370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1371. ,$ctx2.sendIdx["add:"]=2
  1372. //>>excludeEnd("ctx");
  1373. ][0];
  1374. $4=sequence;
  1375. $5=[$recv($globals.IRAssignment)._new()
  1376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1377. ,$ctx2.sendIdx["new"]=2
  1378. //>>excludeEnd("ctx");
  1379. ][0];
  1380. $6=[$recv($globals.IRVariable)._new()
  1381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1382. ,$ctx2.sendIdx["new"]=3
  1383. //>>excludeEnd("ctx");
  1384. ][0];
  1385. $7=$recv($globals.ArgVar)._new();
  1386. $recv($7)._scope_($recv(inlinedClosure)._scope());
  1387. $recv($7)._name_(each);
  1388. [$recv($5)._add_($recv($6)._variable_([$recv($7)._yourself()
  1389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1390. ,$ctx2.sendIdx["yourself"]=2
  1391. //>>excludeEnd("ctx");
  1392. ][0]))
  1393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1394. ,$ctx2.sendIdx["add:"]=4
  1395. //>>excludeEnd("ctx");
  1396. ][0];
  1397. [$recv($5)._add_($recv($self._send())._receiver())
  1398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1399. ,$ctx2.sendIdx["add:"]=5
  1400. //>>excludeEnd("ctx");
  1401. ][0];
  1402. return [$recv($4)._add_($recv($5)._yourself())
  1403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1404. ,$ctx2.sendIdx["add:"]=3
  1405. //>>excludeEnd("ctx");
  1406. ][0];
  1407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  1409. //>>excludeEnd("ctx");
  1410. }))
  1411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1412. ,$ctx1.sendIdx["do:"]=2
  1413. //>>excludeEnd("ctx");
  1414. ][0];
  1415. [$recv(inlinedClosure)._add_(sequence)
  1416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1417. ,$ctx1.sendIdx["add:"]=6
  1418. //>>excludeEnd("ctx");
  1419. ][0];
  1420. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  1421. $recv(statements)._ifNotEmpty_((function(){
  1422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1423. return $core.withContext(function($ctx2) {
  1424. //>>excludeEnd("ctx");
  1425. $recv($recv(statements)._allButLast())._do_((function(each){
  1426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1427. return $core.withContext(function($ctx3) {
  1428. //>>excludeEnd("ctx");
  1429. return [$recv(sequence)._add_(each)
  1430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1431. ,$ctx3.sendIdx["add:"]=7
  1432. //>>excludeEnd("ctx");
  1433. ][0];
  1434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1435. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  1436. //>>excludeEnd("ctx");
  1437. }));
  1438. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  1439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  1441. //>>excludeEnd("ctx");
  1442. }));
  1443. return inlinedClosure;
  1444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1445. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements})});
  1446. //>>excludeEnd("ctx");
  1447. }; }),
  1448. $globals.IRSendInliner);
  1449. $core.addMethod(
  1450. $core.method({
  1451. selector: "inlineSend:",
  1452. protocol: "inlining",
  1453. //>>excludeStart("ide", pragmas.excludeIdeData);
  1454. args: ["anIRSend"],
  1455. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  1456. referencedClasses: [],
  1457. //>>excludeEnd("ide");
  1458. pragmas: [],
  1459. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  1460. }, function ($methodClass){ return function (anIRSend){
  1461. var self=this,$self=this;
  1462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1463. return $core.withContext(function($ctx1) {
  1464. //>>excludeEnd("ctx");
  1465. $self._send_(anIRSend);
  1466. return $self._perform_withArguments_($recv([$self._send()
  1467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1468. ,$ctx1.sendIdx["send"]=1
  1469. //>>excludeEnd("ctx");
  1470. ][0])._selector(),$recv($self._send())._arguments());
  1471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1472. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend})});
  1473. //>>excludeEnd("ctx");
  1474. }; }),
  1475. $globals.IRSendInliner);
  1476. $core.addMethod(
  1477. $core.method({
  1478. selector: "inlineSend:andReplace:",
  1479. protocol: "private",
  1480. //>>excludeStart("ide", pragmas.excludeIdeData);
  1481. args: ["anIRSend", "anIRInstruction"],
  1482. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  1483. referencedClasses: [],
  1484. //>>excludeEnd("ide");
  1485. pragmas: [],
  1486. messageSends: ["replaceWith:", "inlineSend:"]
  1487. }, function ($methodClass){ return function (anIRSend,anIRInstruction){
  1488. var self=this,$self=this;
  1489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1490. return $core.withContext(function($ctx1) {
  1491. //>>excludeEnd("ctx");
  1492. $recv(anIRInstruction)._replaceWith_(anIRSend);
  1493. return $self._inlineSend_(anIRSend);
  1494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1495. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction})});
  1496. //>>excludeEnd("ctx");
  1497. }; }),
  1498. $globals.IRSendInliner);
  1499. $core.addMethod(
  1500. $core.method({
  1501. selector: "inlinedClosure",
  1502. protocol: "factory",
  1503. //>>excludeStart("ide", pragmas.excludeIdeData);
  1504. args: [],
  1505. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  1506. referencedClasses: ["IRInlinedClosure"],
  1507. //>>excludeEnd("ide");
  1508. pragmas: [],
  1509. messageSends: ["new"]
  1510. }, function ($methodClass){ return function (){
  1511. var self=this,$self=this;
  1512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1513. return $core.withContext(function($ctx1) {
  1514. //>>excludeEnd("ctx");
  1515. return $recv($globals.IRInlinedClosure)._new();
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{})});
  1518. //>>excludeEnd("ctx");
  1519. }; }),
  1520. $globals.IRSendInliner);
  1521. $core.addMethod(
  1522. $core.method({
  1523. selector: "inlinedClosure:wrapFinalValueIn:",
  1524. protocol: "inlining",
  1525. //>>excludeStart("ide", pragmas.excludeIdeData);
  1526. args: ["closure", "aBlock"],
  1527. source: "inlinedClosure: closure wrapFinalValueIn: aBlock\x0a\x09| sequence final |\x0a\x0a\x09sequence := closure sequence.\x0a\x09\x0a\x09sequence dagChildren ifEmpty: [ sequence add: (IRVariable new\x0a\x09\x09variable: (closure scope pseudoVars at: 'nil');\x0a\x09\x09yourself) ].\x0a\x09final := sequence dagChildren last.\x0a\x09final yieldsValue ifTrue: [ sequence replace: final with: (aBlock value: final) ].\x0a\x0a\x09^ closure",
  1528. referencedClasses: ["IRVariable"],
  1529. //>>excludeEnd("ide");
  1530. pragmas: [],
  1531. messageSends: ["sequence", "ifEmpty:", "dagChildren", "add:", "variable:", "new", "at:", "pseudoVars", "scope", "yourself", "last", "ifTrue:", "yieldsValue", "replace:with:", "value:"]
  1532. }, function ($methodClass){ return function (closure,aBlock){
  1533. var self=this,$self=this;
  1534. var sequence,final;
  1535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1536. return $core.withContext(function($ctx1) {
  1537. //>>excludeEnd("ctx");
  1538. var $1,$2;
  1539. sequence=$recv(closure)._sequence();
  1540. $recv([$recv(sequence)._dagChildren()
  1541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1542. ,$ctx1.sendIdx["dagChildren"]=1
  1543. //>>excludeEnd("ctx");
  1544. ][0])._ifEmpty_((function(){
  1545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1546. return $core.withContext(function($ctx2) {
  1547. //>>excludeEnd("ctx");
  1548. $1=sequence;
  1549. $2=$recv($globals.IRVariable)._new();
  1550. $recv($2)._variable_($recv($recv($recv(closure)._scope())._pseudoVars())._at_("nil"));
  1551. return $recv($1)._add_($recv($2)._yourself());
  1552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1554. //>>excludeEnd("ctx");
  1555. }));
  1556. final=$recv($recv(sequence)._dagChildren())._last();
  1557. if($core.assert($recv(final)._yieldsValue())){
  1558. $recv(sequence)._replace_with_(final,$recv(aBlock)._value_(final));
  1559. }
  1560. return closure;
  1561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1562. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure:wrapFinalValueIn:",{closure:closure,aBlock:aBlock,sequence:sequence,final:final})});
  1563. //>>excludeEnd("ctx");
  1564. }; }),
  1565. $globals.IRSendInliner);
  1566. $core.addMethod(
  1567. $core.method({
  1568. selector: "inlinedSend:withBlock:",
  1569. protocol: "private",
  1570. //>>excludeStart("ide", pragmas.excludeIdeData);
  1571. args: ["inlinedSend", "anIRInstruction"],
  1572. source: "inlinedSend: inlinedSend withBlock: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send receiver;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
  1573. referencedClasses: [],
  1574. //>>excludeEnd("ide");
  1575. pragmas: [],
  1576. messageSends: ["visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  1577. }, function ($methodClass){ return function (inlinedSend,anIRInstruction){
  1578. var self=this,$self=this;
  1579. var inlinedClosure;
  1580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1581. return $core.withContext(function($ctx1) {
  1582. //>>excludeEnd("ctx");
  1583. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  1584. [$recv(inlinedSend)._add_($recv([$self._send()
  1585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1586. ,$ctx1.sendIdx["send"]=1
  1587. //>>excludeEnd("ctx");
  1588. ][0])._receiver())
  1589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1590. ,$ctx1.sendIdx["add:"]=1
  1591. //>>excludeEnd("ctx");
  1592. ][0];
  1593. $recv(inlinedSend)._add_(inlinedClosure);
  1594. $recv($self._send())._replaceWith_(inlinedSend);
  1595. $recv([$recv($recv(inlinedSend)._method())._internalVariables()
  1596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1597. ,$ctx1.sendIdx["internalVariables"]=1
  1598. //>>excludeEnd("ctx");
  1599. ][0])._addAll_($recv(inlinedSend)._internalVariables());
  1600. return inlinedSend;
  1601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1602. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure})});
  1603. //>>excludeEnd("ctx");
  1604. }; }),
  1605. $globals.IRSendInliner);
  1606. $core.addMethod(
  1607. $core.method({
  1608. selector: "inlinedSend:withBlock:withBlock:",
  1609. protocol: "private",
  1610. //>>excludeStart("ide", pragmas.excludeIdeData);
  1611. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  1612. source: "inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\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 receiver;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
  1613. referencedClasses: [],
  1614. //>>excludeEnd("ide");
  1615. pragmas: [],
  1616. messageSends: ["visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  1617. }, function ($methodClass){ return function (inlinedSend,anIRInstruction,anotherIRInstruction){
  1618. var self=this,$self=this;
  1619. var inlinedClosure1,inlinedClosure2;
  1620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1621. return $core.withContext(function($ctx1) {
  1622. //>>excludeEnd("ctx");
  1623. inlinedClosure1=[$recv([$self._translator()
  1624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1625. ,$ctx1.sendIdx["translator"]=1
  1626. //>>excludeEnd("ctx");
  1627. ][0])._visit_([$self._inlineClosure_(anIRInstruction)
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. ,$ctx1.sendIdx["inlineClosure:"]=1
  1630. //>>excludeEnd("ctx");
  1631. ][0])
  1632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1633. ,$ctx1.sendIdx["visit:"]=1
  1634. //>>excludeEnd("ctx");
  1635. ][0];
  1636. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  1637. [$recv(inlinedSend)._add_($recv([$self._send()
  1638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1639. ,$ctx1.sendIdx["send"]=1
  1640. //>>excludeEnd("ctx");
  1641. ][0])._receiver())
  1642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1643. ,$ctx1.sendIdx["add:"]=1
  1644. //>>excludeEnd("ctx");
  1645. ][0];
  1646. [$recv(inlinedSend)._add_(inlinedClosure1)
  1647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1648. ,$ctx1.sendIdx["add:"]=2
  1649. //>>excludeEnd("ctx");
  1650. ][0];
  1651. $recv(inlinedSend)._add_(inlinedClosure2);
  1652. $recv($self._send())._replaceWith_(inlinedSend);
  1653. $recv([$recv($recv(inlinedSend)._method())._internalVariables()
  1654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1655. ,$ctx1.sendIdx["internalVariables"]=1
  1656. //>>excludeEnd("ctx");
  1657. ][0])._addAll_($recv(inlinedSend)._internalVariables());
  1658. return inlinedSend;
  1659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1660. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2})});
  1661. //>>excludeEnd("ctx");
  1662. }; }),
  1663. $globals.IRSendInliner);
  1664. $core.addMethod(
  1665. $core.method({
  1666. selector: "inlinedSequence",
  1667. protocol: "factory",
  1668. //>>excludeStart("ide", pragmas.excludeIdeData);
  1669. args: [],
  1670. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  1671. referencedClasses: ["IRInlinedSequence"],
  1672. //>>excludeEnd("ide");
  1673. pragmas: [],
  1674. messageSends: ["new"]
  1675. }, function ($methodClass){ return function (){
  1676. var self=this,$self=this;
  1677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1678. return $core.withContext(function($ctx1) {
  1679. //>>excludeEnd("ctx");
  1680. return $recv($globals.IRInlinedSequence)._new();
  1681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1682. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{})});
  1683. //>>excludeEnd("ctx");
  1684. }; }),
  1685. $globals.IRSendInliner);
  1686. $core.addMethod(
  1687. $core.method({
  1688. selector: "inliningError:",
  1689. protocol: "error handling",
  1690. //>>excludeStart("ide", pragmas.excludeIdeData);
  1691. args: ["aString"],
  1692. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  1693. referencedClasses: ["InliningError"],
  1694. //>>excludeEnd("ide");
  1695. pragmas: [],
  1696. messageSends: ["signal:"]
  1697. }, function ($methodClass){ return function (aString){
  1698. var self=this,$self=this;
  1699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1700. return $core.withContext(function($ctx1) {
  1701. //>>excludeEnd("ctx");
  1702. $recv($globals.InliningError)._signal_(aString);
  1703. return self;
  1704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1705. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString})});
  1706. //>>excludeEnd("ctx");
  1707. }; }),
  1708. $globals.IRSendInliner);
  1709. $core.addMethod(
  1710. $core.method({
  1711. selector: "mustBeNiladicClosure:",
  1712. protocol: "testing",
  1713. //>>excludeStart("ide", pragmas.excludeIdeData);
  1714. args: ["anIRInstruction"],
  1715. source: "mustBeNiladicClosure: anIRInstruction\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' ]",
  1716. referencedClasses: [],
  1717. //>>excludeEnd("ide");
  1718. pragmas: [],
  1719. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments"]
  1720. }, function ($methodClass){ return function (anIRInstruction){
  1721. var self=this,$self=this;
  1722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1723. return $core.withContext(function($ctx1) {
  1724. //>>excludeEnd("ctx");
  1725. if(!$core.assert($recv(anIRInstruction)._isClosure())){
  1726. [$self._inliningError_("Message argument should be a block")
  1727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1728. ,$ctx1.sendIdx["inliningError:"]=1
  1729. //>>excludeEnd("ctx");
  1730. ][0];
  1731. }
  1732. if(!$core.assert($recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0)))){
  1733. $self._inliningError_("Inlined block should have zero argument");
  1734. }
  1735. return self;
  1736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1737. }, function($ctx1) {$ctx1.fill(self,"mustBeNiladicClosure:",{anIRInstruction:anIRInstruction})});
  1738. //>>excludeEnd("ctx");
  1739. }; }),
  1740. $globals.IRSendInliner);
  1741. $core.addMethod(
  1742. $core.method({
  1743. selector: "mustBeNiladicOrUnaryClosure:",
  1744. protocol: "testing",
  1745. //>>excludeStart("ide", pragmas.excludeIdeData);
  1746. args: ["anIRInstruction"],
  1747. source: "mustBeNiladicOrUnaryClosure: anIRInstruction\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size <= 1 ifFalse: [ self inliningError: 'Inlined block should have at most one argument' ]",
  1748. referencedClasses: [],
  1749. //>>excludeEnd("ide");
  1750. pragmas: [],
  1751. messageSends: ["ifFalse:", "isClosure", "inliningError:", "<=", "size", "arguments"]
  1752. }, function ($methodClass){ return function (anIRInstruction){
  1753. var self=this,$self=this;
  1754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1755. return $core.withContext(function($ctx1) {
  1756. //>>excludeEnd("ctx");
  1757. if(!$core.assert($recv(anIRInstruction)._isClosure())){
  1758. [$self._inliningError_("Message argument should be a block")
  1759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1760. ,$ctx1.sendIdx["inliningError:"]=1
  1761. //>>excludeEnd("ctx");
  1762. ][0];
  1763. }
  1764. if(!$core.assert($recv($recv($recv(anIRInstruction)._arguments())._size()).__lt_eq((1)))){
  1765. $self._inliningError_("Inlined block should have at most one argument");
  1766. }
  1767. return self;
  1768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1769. }, function($ctx1) {$ctx1.fill(self,"mustBeNiladicOrUnaryClosure:",{anIRInstruction:anIRInstruction})});
  1770. //>>excludeEnd("ctx");
  1771. }; }),
  1772. $globals.IRSendInliner);
  1773. $core.addMethod(
  1774. $core.method({
  1775. selector: "send",
  1776. protocol: "accessing",
  1777. //>>excludeStart("ide", pragmas.excludeIdeData);
  1778. args: [],
  1779. source: "send\x0a\x09^ send",
  1780. referencedClasses: [],
  1781. //>>excludeEnd("ide");
  1782. pragmas: [],
  1783. messageSends: []
  1784. }, function ($methodClass){ return function (){
  1785. var self=this,$self=this;
  1786. return $self.send;
  1787. }; }),
  1788. $globals.IRSendInliner);
  1789. $core.addMethod(
  1790. $core.method({
  1791. selector: "send:",
  1792. protocol: "accessing",
  1793. //>>excludeStart("ide", pragmas.excludeIdeData);
  1794. args: ["anIRSend"],
  1795. source: "send: anIRSend\x0a\x09send := anIRSend",
  1796. referencedClasses: [],
  1797. //>>excludeEnd("ide");
  1798. pragmas: [],
  1799. messageSends: []
  1800. }, function ($methodClass){ return function (anIRSend){
  1801. var self=this,$self=this;
  1802. $self.send=anIRSend;
  1803. return self;
  1804. }; }),
  1805. $globals.IRSendInliner);
  1806. $core.addMethod(
  1807. $core.method({
  1808. selector: "translator",
  1809. protocol: "accessing",
  1810. //>>excludeStart("ide", pragmas.excludeIdeData);
  1811. args: [],
  1812. source: "translator\x0a\x09^ translator",
  1813. referencedClasses: [],
  1814. //>>excludeEnd("ide");
  1815. pragmas: [],
  1816. messageSends: []
  1817. }, function ($methodClass){ return function (){
  1818. var self=this,$self=this;
  1819. return $self.translator;
  1820. }; }),
  1821. $globals.IRSendInliner);
  1822. $core.addMethod(
  1823. $core.method({
  1824. selector: "translator:",
  1825. protocol: "accessing",
  1826. //>>excludeStart("ide", pragmas.excludeIdeData);
  1827. args: ["anASTTranslator"],
  1828. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  1829. referencedClasses: [],
  1830. //>>excludeEnd("ide");
  1831. pragmas: [],
  1832. messageSends: []
  1833. }, function ($methodClass){ return function (anASTTranslator){
  1834. var self=this,$self=this;
  1835. $self.translator=anASTTranslator;
  1836. return self;
  1837. }; }),
  1838. $globals.IRSendInliner);
  1839. $core.addMethod(
  1840. $core.method({
  1841. selector: "inlinedSelectors",
  1842. protocol: "accessing",
  1843. //>>excludeStart("ide", pragmas.excludeIdeData);
  1844. args: [],
  1845. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  1846. referencedClasses: [],
  1847. //>>excludeEnd("ide");
  1848. pragmas: [],
  1849. messageSends: []
  1850. }, function ($methodClass){ return function (){
  1851. var self=this,$self=this;
  1852. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  1853. }; }),
  1854. $globals.IRSendInliner.a$cls);
  1855. $core.addMethod(
  1856. $core.method({
  1857. selector: "inlinedSelectorsNeedingIdempotentReceiver",
  1858. protocol: "accessing",
  1859. //>>excludeStart("ide", pragmas.excludeIdeData);
  1860. args: [],
  1861. source: "inlinedSelectorsNeedingIdempotentReceiver\x0a\x09^ #('ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  1862. referencedClasses: [],
  1863. //>>excludeEnd("ide");
  1864. pragmas: [],
  1865. messageSends: []
  1866. }, function ($methodClass){ return function (){
  1867. var self=this,$self=this;
  1868. return ["ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  1869. }; }),
  1870. $globals.IRSendInliner.a$cls);
  1871. $core.addMethod(
  1872. $core.method({
  1873. selector: "shouldInline:",
  1874. protocol: "accessing",
  1875. //>>excludeStart("ide", pragmas.excludeIdeData);
  1876. args: ["anIRSend"],
  1877. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09anIRSend receiver isSuper ifTrue: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  1878. referencedClasses: [],
  1879. //>>excludeEnd("ide");
  1880. pragmas: [],
  1881. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "ifTrue:", "isSuper", "receiver", "allSatisfy:", "arguments", "isClosure"]
  1882. }, function ($methodClass){ return function (anIRSend){
  1883. var self=this,$self=this;
  1884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1885. return $core.withContext(function($ctx1) {
  1886. //>>excludeEnd("ctx");
  1887. if(!$core.assert($recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector()))){
  1888. return false;
  1889. }
  1890. if($core.assert($recv($recv(anIRSend)._receiver())._isSuper())){
  1891. return false;
  1892. }
  1893. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  1894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1895. return $core.withContext(function($ctx2) {
  1896. //>>excludeEnd("ctx");
  1897. return $recv(each)._isClosure();
  1898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1899. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  1900. //>>excludeEnd("ctx");
  1901. }));
  1902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1903. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend})});
  1904. //>>excludeEnd("ctx");
  1905. }; }),
  1906. $globals.IRSendInliner.a$cls);
  1907. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  1908. //>>excludeStart("ide", pragmas.excludeIdeData);
  1909. $globals.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($core.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};";
  1910. //>>excludeEnd("ide");
  1911. $core.addMethod(
  1912. $core.method({
  1913. selector: "inlineAssignment:",
  1914. protocol: "inlining",
  1915. //>>excludeStart("ide", pragmas.excludeIdeData);
  1916. args: ["anIRAssignment"],
  1917. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  1918. referencedClasses: [],
  1919. //>>excludeEnd("ide");
  1920. pragmas: [],
  1921. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  1922. }, function ($methodClass){ return function (anIRAssignment){
  1923. var self=this,$self=this;
  1924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1925. return $core.withContext(function($ctx1) {
  1926. //>>excludeEnd("ctx");
  1927. $self._target_($recv(anIRAssignment)._left());
  1928. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment})});
  1931. //>>excludeEnd("ctx");
  1932. }; }),
  1933. $globals.IRAssignmentInliner);
  1934. $core.addMethod(
  1935. $core.method({
  1936. selector: "inlineClosure:",
  1937. protocol: "inlining",
  1938. //>>excludeStart("ide", pragmas.excludeIdeData);
  1939. args: ["anIRClosure"],
  1940. source: "inlineClosure: anIRClosure\x0a\x09^ self\x0a\x09\x09inlinedClosure: (super inlineClosure: anIRClosure)\x0a\x09\x09wrapFinalValueIn: [ :final |\x0a\x09\x09\x09IRAssignment new\x0a\x09\x09\x09\x09add: self target;\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself ]",
  1941. referencedClasses: ["IRAssignment"],
  1942. //>>excludeEnd("ide");
  1943. pragmas: [],
  1944. messageSends: ["inlinedClosure:wrapFinalValueIn:", "inlineClosure:", "add:", "new", "target", "copy", "yourself"]
  1945. }, function ($methodClass){ return function (anIRClosure){
  1946. var self=this,$self=this;
  1947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1948. return $core.withContext(function($ctx1) {
  1949. //>>excludeEnd("ctx");
  1950. var $1;
  1951. return $self._inlinedClosure_wrapFinalValueIn_([(
  1952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1953. $ctx1.supercall = true,
  1954. //>>excludeEnd("ctx");
  1955. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.call($self,anIRClosure))
  1956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1957. ,$ctx1.supercall = false
  1958. //>>excludeEnd("ctx");
  1959. ][0],(function(final){
  1960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1961. return $core.withContext(function($ctx2) {
  1962. //>>excludeEnd("ctx");
  1963. $1=$recv($globals.IRAssignment)._new();
  1964. [$recv($1)._add_($self._target())
  1965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1966. ,$ctx2.sendIdx["add:"]=1
  1967. //>>excludeEnd("ctx");
  1968. ][0];
  1969. $recv($1)._add_($recv(final)._copy());
  1970. return $recv($1)._yourself();
  1971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1972. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  1973. //>>excludeEnd("ctx");
  1974. }));
  1975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1976. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure})});
  1977. //>>excludeEnd("ctx");
  1978. }; }),
  1979. $globals.IRAssignmentInliner);
  1980. $core.addMethod(
  1981. $core.method({
  1982. selector: "target",
  1983. protocol: "accessing",
  1984. //>>excludeStart("ide", pragmas.excludeIdeData);
  1985. args: [],
  1986. source: "target\x0a\x09^ target",
  1987. referencedClasses: [],
  1988. //>>excludeEnd("ide");
  1989. pragmas: [],
  1990. messageSends: []
  1991. }, function ($methodClass){ return function (){
  1992. var self=this,$self=this;
  1993. return $self.target;
  1994. }; }),
  1995. $globals.IRAssignmentInliner);
  1996. $core.addMethod(
  1997. $core.method({
  1998. selector: "target:",
  1999. protocol: "accessing",
  2000. //>>excludeStart("ide", pragmas.excludeIdeData);
  2001. args: ["anObject"],
  2002. source: "target: anObject\x0a\x09target := anObject",
  2003. referencedClasses: [],
  2004. //>>excludeEnd("ide");
  2005. pragmas: [],
  2006. messageSends: []
  2007. }, function ($methodClass){ return function (anObject){
  2008. var self=this,$self=this;
  2009. $self.target=anObject;
  2010. return self;
  2011. }; }),
  2012. $globals.IRAssignmentInliner);
  2013. $core.addClass("IRNonLocalReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  2014. //>>excludeStart("ide", pragmas.excludeIdeData);
  2015. $globals.IRNonLocalReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  2016. //>>excludeEnd("ide");
  2017. $core.addMethod(
  2018. $core.method({
  2019. selector: "inlineClosure:",
  2020. protocol: "inlining",
  2021. //>>excludeStart("ide", pragmas.excludeIdeData);
  2022. args: ["anIRClosure"],
  2023. source: "inlineClosure: anIRClosure\x0a\x09^ self\x0a\x09\x09inlinedClosure: (super inlineClosure: anIRClosure)\x0a\x09\x09wrapFinalValueIn: [ :final |\x0a\x09\x09\x09IRNonLocalReturn new\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself ]",
  2024. referencedClasses: ["IRNonLocalReturn"],
  2025. //>>excludeEnd("ide");
  2026. pragmas: [],
  2027. messageSends: ["inlinedClosure:wrapFinalValueIn:", "inlineClosure:", "add:", "new", "copy", "yourself"]
  2028. }, function ($methodClass){ return function (anIRClosure){
  2029. var self=this,$self=this;
  2030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2031. return $core.withContext(function($ctx1) {
  2032. //>>excludeEnd("ctx");
  2033. var $1;
  2034. return $self._inlinedClosure_wrapFinalValueIn_([(
  2035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2036. $ctx1.supercall = true,
  2037. //>>excludeEnd("ctx");
  2038. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.call($self,anIRClosure))
  2039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2040. ,$ctx1.supercall = false
  2041. //>>excludeEnd("ctx");
  2042. ][0],(function(final){
  2043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2044. return $core.withContext(function($ctx2) {
  2045. //>>excludeEnd("ctx");
  2046. $1=$recv($globals.IRNonLocalReturn)._new();
  2047. $recv($1)._add_($recv(final)._copy());
  2048. return $recv($1)._yourself();
  2049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2050. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  2051. //>>excludeEnd("ctx");
  2052. }));
  2053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2054. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure})});
  2055. //>>excludeEnd("ctx");
  2056. }; }),
  2057. $globals.IRNonLocalReturnInliner);
  2058. $core.addMethod(
  2059. $core.method({
  2060. selector: "inlineReturn:",
  2061. protocol: "inlining",
  2062. //>>excludeStart("ide", pragmas.excludeIdeData);
  2063. args: ["anIRReturn"],
  2064. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  2065. referencedClasses: [],
  2066. //>>excludeEnd("ide");
  2067. pragmas: [],
  2068. messageSends: ["inlineSend:andReplace:", "expression"]
  2069. }, function ($methodClass){ return function (anIRReturn){
  2070. var self=this,$self=this;
  2071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2072. return $core.withContext(function($ctx1) {
  2073. //>>excludeEnd("ctx");
  2074. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  2075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2076. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn})});
  2077. //>>excludeEnd("ctx");
  2078. }; }),
  2079. $globals.IRNonLocalReturnInliner);
  2080. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  2081. //>>excludeStart("ide", pragmas.excludeIdeData);
  2082. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  2083. //>>excludeEnd("ide");
  2084. $core.addMethod(
  2085. $core.method({
  2086. selector: "inlineClosure:",
  2087. protocol: "inlining",
  2088. //>>excludeStart("ide", pragmas.excludeIdeData);
  2089. args: ["anIRClosure"],
  2090. source: "inlineClosure: anIRClosure\x0a\x09^ self\x0a\x09\x09inlinedClosure: (super inlineClosure: anIRClosure)\x0a\x09\x09wrapFinalValueIn: [ :final |\x0a\x09\x09\x09IRReturn new\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself ]",
  2091. referencedClasses: ["IRReturn"],
  2092. //>>excludeEnd("ide");
  2093. pragmas: [],
  2094. messageSends: ["inlinedClosure:wrapFinalValueIn:", "inlineClosure:", "add:", "new", "copy", "yourself"]
  2095. }, function ($methodClass){ return function (anIRClosure){
  2096. var self=this,$self=this;
  2097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2098. return $core.withContext(function($ctx1) {
  2099. //>>excludeEnd("ctx");
  2100. var $1;
  2101. return $self._inlinedClosure_wrapFinalValueIn_([(
  2102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2103. $ctx1.supercall = true,
  2104. //>>excludeEnd("ctx");
  2105. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.call($self,anIRClosure))
  2106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2107. ,$ctx1.supercall = false
  2108. //>>excludeEnd("ctx");
  2109. ][0],(function(final){
  2110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2111. return $core.withContext(function($ctx2) {
  2112. //>>excludeEnd("ctx");
  2113. $1=$recv($globals.IRReturn)._new();
  2114. $recv($1)._add_($recv(final)._copy());
  2115. return $recv($1)._yourself();
  2116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2117. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  2118. //>>excludeEnd("ctx");
  2119. }));
  2120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2121. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure})});
  2122. //>>excludeEnd("ctx");
  2123. }; }),
  2124. $globals.IRReturnInliner);
  2125. $core.addMethod(
  2126. $core.method({
  2127. selector: "inlineReturn:",
  2128. protocol: "inlining",
  2129. //>>excludeStart("ide", pragmas.excludeIdeData);
  2130. args: ["anIRReturn"],
  2131. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  2132. referencedClasses: [],
  2133. //>>excludeEnd("ide");
  2134. pragmas: [],
  2135. messageSends: ["inlineSend:andReplace:", "expression"]
  2136. }, function ($methodClass){ return function (anIRReturn){
  2137. var self=this,$self=this;
  2138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2139. return $core.withContext(function($ctx1) {
  2140. //>>excludeEnd("ctx");
  2141. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn})});
  2144. //>>excludeEnd("ctx");
  2145. }; }),
  2146. $globals.IRReturnInliner);
  2147. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  2148. //>>excludeStart("ide", pragmas.excludeIdeData);
  2149. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  2150. //>>excludeEnd("ide");
  2151. $core.addMethod(
  2152. $core.method({
  2153. selector: "inliner",
  2154. protocol: "compiling",
  2155. //>>excludeStart("ide", pragmas.excludeIdeData);
  2156. args: [],
  2157. source: "inliner\x0a\x09^ IRInliner new",
  2158. referencedClasses: ["IRInliner"],
  2159. //>>excludeEnd("ide");
  2160. pragmas: [],
  2161. messageSends: ["new"]
  2162. }, function ($methodClass){ return function (){
  2163. var self=this,$self=this;
  2164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2165. return $core.withContext(function($ctx1) {
  2166. //>>excludeEnd("ctx");
  2167. return $recv($globals.IRInliner)._new();
  2168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2169. }, function($ctx1) {$ctx1.fill(self,"inliner",{})});
  2170. //>>excludeEnd("ctx");
  2171. }; }),
  2172. $globals.InliningCodeGenerator);
  2173. $core.addMethod(
  2174. $core.method({
  2175. selector: "irTranslatorClass",
  2176. protocol: "compiling",
  2177. //>>excludeStart("ide", pragmas.excludeIdeData);
  2178. args: [],
  2179. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  2180. referencedClasses: ["IRInliningJSTranslator"],
  2181. //>>excludeEnd("ide");
  2182. pragmas: [],
  2183. messageSends: []
  2184. }, function ($methodClass){ return function (){
  2185. var self=this,$self=this;
  2186. return $globals.IRInliningJSTranslator;
  2187. }; }),
  2188. $globals.InliningCodeGenerator);
  2189. $core.addMethod(
  2190. $core.method({
  2191. selector: "preInliner",
  2192. protocol: "compiling",
  2193. //>>excludeStart("ide", pragmas.excludeIdeData);
  2194. args: [],
  2195. source: "preInliner\x0a\x09^ ASTPreInliner new",
  2196. referencedClasses: ["ASTPreInliner"],
  2197. //>>excludeEnd("ide");
  2198. pragmas: [],
  2199. messageSends: ["new"]
  2200. }, function ($methodClass){ return function (){
  2201. var self=this,$self=this;
  2202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2203. return $core.withContext(function($ctx1) {
  2204. //>>excludeEnd("ctx");
  2205. return $recv($globals.ASTPreInliner)._new();
  2206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2207. }, function($ctx1) {$ctx1.fill(self,"preInliner",{})});
  2208. //>>excludeEnd("ctx");
  2209. }; }),
  2210. $globals.InliningCodeGenerator);
  2211. $core.addMethod(
  2212. $core.method({
  2213. selector: "transformersDictionary",
  2214. protocol: "compiling",
  2215. //>>excludeStart("ide", pragmas.excludeIdeData);
  2216. args: [],
  2217. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := super transformersDictionary\x0a\x09\x09at: '3000-inlinerTagging' put: self preInliner;\x0a\x09\x09at: '6000-inliner' put: self inliner;\x0a\x09\x09at: '8000-irToJs' put: self irTranslator;\x0a\x09\x09yourself ]",
  2218. referencedClasses: [],
  2219. //>>excludeEnd("ide");
  2220. pragmas: [],
  2221. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  2222. }, function ($methodClass){ return function (){
  2223. var self=this,$self=this;
  2224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2225. return $core.withContext(function($ctx1) {
  2226. //>>excludeEnd("ctx");
  2227. var $1,$2;
  2228. $1=$self.transformersDictionary;
  2229. if($1 == null || $1.a$nil){
  2230. $2=[(
  2231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2232. $ctx1.supercall = true,
  2233. //>>excludeEnd("ctx");
  2234. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.call($self))
  2235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2236. ,$ctx1.supercall = false
  2237. //>>excludeEnd("ctx");
  2238. ][0];
  2239. [$recv($2)._at_put_("3000-inlinerTagging",$self._preInliner())
  2240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2241. ,$ctx1.sendIdx["at:put:"]=1
  2242. //>>excludeEnd("ctx");
  2243. ][0];
  2244. [$recv($2)._at_put_("6000-inliner",$self._inliner())
  2245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2246. ,$ctx1.sendIdx["at:put:"]=2
  2247. //>>excludeEnd("ctx");
  2248. ][0];
  2249. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  2250. $self.transformersDictionary=$recv($2)._yourself();
  2251. return $self.transformersDictionary;
  2252. } else {
  2253. return $1;
  2254. }
  2255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2256. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{})});
  2257. //>>excludeEnd("ctx");
  2258. }; }),
  2259. $globals.InliningCodeGenerator);
  2260. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  2261. //>>excludeStart("ide", pragmas.excludeIdeData);
  2262. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  2263. //>>excludeEnd("ide");
  2264. $core.addTrait("TIRInlinedVisitor", "Compiler-Inlining");
  2265. $core.addMethod(
  2266. $core.method({
  2267. selector: "visitIRInlinedClosure:",
  2268. protocol: "visiting",
  2269. //>>excludeStart("ide", pragmas.excludeIdeData);
  2270. args: ["anIRInlinedClosure"],
  2271. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  2272. referencedClasses: [],
  2273. //>>excludeEnd("ide");
  2274. pragmas: [],
  2275. messageSends: ["visitIRClosure:"]
  2276. }, function ($methodClass){ return function (anIRInlinedClosure){
  2277. var self=this,$self=this;
  2278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2279. return $core.withContext(function($ctx1) {
  2280. //>>excludeEnd("ctx");
  2281. return $self._visitIRClosure_(anIRInlinedClosure);
  2282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2283. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure})});
  2284. //>>excludeEnd("ctx");
  2285. }; }),
  2286. $globals.TIRInlinedVisitor);
  2287. $core.addMethod(
  2288. $core.method({
  2289. selector: "visitIRInlinedSequence:",
  2290. protocol: "visiting",
  2291. //>>excludeStart("ide", pragmas.excludeIdeData);
  2292. args: ["anIRInlinedSequence"],
  2293. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  2294. referencedClasses: [],
  2295. //>>excludeEnd("ide");
  2296. pragmas: [],
  2297. messageSends: ["visitIRSequence:"]
  2298. }, function ($methodClass){ return function (anIRInlinedSequence){
  2299. var self=this,$self=this;
  2300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2301. return $core.withContext(function($ctx1) {
  2302. //>>excludeEnd("ctx");
  2303. return $self._visitIRSequence_(anIRInlinedSequence);
  2304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2305. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence})});
  2306. //>>excludeEnd("ctx");
  2307. }; }),
  2308. $globals.TIRInlinedVisitor);
  2309. $core.setTraitComposition([{trait: $globals.TIRInlinedVisitor}], $globals.IRInliner);
  2310. $core.setTraitComposition([{trait: $globals.TIRInlinedVisitor}], $globals.IRInliningJSTranslator);
  2311. $core.addMethod(
  2312. $core.method({
  2313. selector: "asInlinedBlockResult",
  2314. protocol: "*Compiler-Inlining",
  2315. //>>excludeStart("ide", pragmas.excludeIdeData);
  2316. args: [],
  2317. source: "asInlinedBlockResult\x0a\x09^ self expression",
  2318. referencedClasses: [],
  2319. //>>excludeEnd("ide");
  2320. pragmas: [],
  2321. messageSends: ["expression"]
  2322. }, function ($methodClass){ return function (){
  2323. var self=this,$self=this;
  2324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2325. return $core.withContext(function($ctx1) {
  2326. //>>excludeEnd("ctx");
  2327. return $self._expression();
  2328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2329. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{})});
  2330. //>>excludeEnd("ctx");
  2331. }; }),
  2332. $globals.IRBlockReturn);
  2333. $core.addMethod(
  2334. $core.method({
  2335. selector: "asInlinedBlockResult",
  2336. protocol: "*Compiler-Inlining",
  2337. //>>excludeStart("ide", pragmas.excludeIdeData);
  2338. args: [],
  2339. source: "asInlinedBlockResult\x0a\x09^ self",
  2340. referencedClasses: [],
  2341. //>>excludeEnd("ide");
  2342. pragmas: [],
  2343. messageSends: []
  2344. }, function ($methodClass){ return function (){
  2345. var self=this,$self=this;
  2346. return self;
  2347. }; }),
  2348. $globals.IRInstruction);
  2349. });