Compiler-Inlining.deploy.js 47 KB

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