1
0

Compiler-Inlining.deploy.js 46 KB

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