Compiler-Inlining.js 90 KB

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