Compiler-Inlining.deploy.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  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.send(aVisitor, "_visitIRInlinedAssignment_", [self]);
  10. return self;}
  11. }),
  12. smalltalk.IRInlinedAssignment);
  13. smalltalk.addMethod(
  14. "_isInlined",
  15. smalltalk.method({
  16. selector: "isInlined",
  17. fn: function () {
  18. var self=this;
  19. return true;
  20. return self;}
  21. }),
  22. smalltalk.IRInlinedAssignment);
  23. smalltalk.addClass('IRInlinedClosure', smalltalk.IRClosure, ['assignTo'], 'Compiler-Inlining');
  24. smalltalk.addMethod(
  25. "_accept_",
  26. smalltalk.method({
  27. selector: "accept:",
  28. fn: function (aVisitor) {
  29. var self=this;
  30. smalltalk.send(aVisitor, "_visitIRInlinedClosure_", [self]);
  31. return self;}
  32. }),
  33. smalltalk.IRInlinedClosure);
  34. smalltalk.addMethod(
  35. "_assignTo",
  36. smalltalk.method({
  37. selector: "assignTo",
  38. fn: function () {
  39. var self=this;
  40. return self['@assignTo'];
  41. return self;}
  42. }),
  43. smalltalk.IRInlinedClosure);
  44. smalltalk.addMethod(
  45. "_assignTo_",
  46. smalltalk.method({
  47. selector: "assignTo:",
  48. fn: function (aScopeVar) {
  49. var self=this;
  50. (self['@assignTo']=aScopeVar);
  51. return self;}
  52. }),
  53. smalltalk.IRInlinedClosure);
  54. smalltalk.addMethod(
  55. "_isInlined",
  56. smalltalk.method({
  57. selector: "isInlined",
  58. fn: function () {
  59. var self=this;
  60. return true;
  61. return self;}
  62. }),
  63. smalltalk.IRInlinedClosure);
  64. smalltalk.addClass('IRInlinedNonLocalReturn', smalltalk.IRReturn, [], 'Compiler-Inlining');
  65. smalltalk.addMethod(
  66. "_accept_",
  67. smalltalk.method({
  68. selector: "accept:",
  69. fn: function (aVisitor) {
  70. var self=this;
  71. return smalltalk.send(aVisitor, "_visitIRInlinedNonLocalReturn_", [self]);
  72. return self;}
  73. }),
  74. smalltalk.IRInlinedNonLocalReturn);
  75. smalltalk.addMethod(
  76. "_isInlined",
  77. smalltalk.method({
  78. selector: "isInlined",
  79. fn: function () {
  80. var self=this;
  81. return true;
  82. return self;}
  83. }),
  84. smalltalk.IRInlinedNonLocalReturn);
  85. smalltalk.addClass('IRInlinedSend', smalltalk.IRSend, [], 'Compiler-Inlining');
  86. smalltalk.addMethod(
  87. "_accept_",
  88. smalltalk.method({
  89. selector: "accept:",
  90. fn: function (aVisitor) {
  91. var self=this;
  92. smalltalk.send(aVisitor, "_visitInlinedSend_", [self]);
  93. return self;}
  94. }),
  95. smalltalk.IRInlinedSend);
  96. smalltalk.addMethod(
  97. "_isInlined",
  98. smalltalk.method({
  99. selector: "isInlined",
  100. fn: function () {
  101. var self=this;
  102. return true;
  103. return self;}
  104. }),
  105. smalltalk.IRInlinedSend);
  106. smalltalk.addClass('IRInlinedIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  107. smalltalk.addMethod(
  108. "_accept_",
  109. smalltalk.method({
  110. selector: "accept:",
  111. fn: function (aVisitor) {
  112. var self=this;
  113. smalltalk.send(aVisitor, "_visitIRInlinedIfFalse_", [self]);
  114. return self;}
  115. }),
  116. smalltalk.IRInlinedIfFalse);
  117. smalltalk.addClass('IRInlinedIfTrue', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
  118. smalltalk.addMethod(
  119. "_accept_",
  120. smalltalk.method({
  121. selector: "accept:",
  122. fn: function (aVisitor) {
  123. var self=this;
  124. smalltalk.send(aVisitor, "_visitIRInlinedIfTrue_", [self]);
  125. return self;}
  126. }),
  127. smalltalk.IRInlinedIfTrue);
  128. smalltalk.addClass('IRInliner', smalltalk.IRVisitor, [], 'Compiler-Inlining');
  129. smalltalk.addMethod(
  130. "_assignmentInliner",
  131. smalltalk.method({
  132. selector: "assignmentInliner",
  133. fn: function () {
  134. var self=this;
  135. return (function($rec){smalltalk.send($rec, "_translator_", [self]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRAssignmentInliner || IRAssignmentInliner), "_new", []));
  136. return self;}
  137. }),
  138. smalltalk.IRInliner);
  139. smalltalk.addMethod(
  140. "_sendInliner",
  141. smalltalk.method({
  142. selector: "sendInliner",
  143. fn: function () {
  144. var self=this;
  145. return (function($rec){smalltalk.send($rec, "_translator_", [self]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRSendInliner || IRSendInliner), "_new", []));
  146. return self;}
  147. }),
  148. smalltalk.IRInliner);
  149. smalltalk.addMethod(
  150. "_shouldInlineAssignment_",
  151. smalltalk.method({
  152. selector: "shouldInlineAssignment:",
  153. fn: function (anIRAssignment) {
  154. var self=this;
  155. return smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment, "_isInlined", []), "_not", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_last", []), "_isSend", []), "_and_", [(function(){return smalltalk.send(self, "_shouldInlineSend_", [smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_last", [])]);})]);})]);
  156. return self;}
  157. }),
  158. smalltalk.IRInliner);
  159. smalltalk.addMethod(
  160. "_shouldInlineSend_",
  161. smalltalk.method({
  162. selector: "shouldInlineSend:",
  163. fn: function (anIRSend) {
  164. var self=this;
  165. return smalltalk.send(smalltalk.send(smalltalk.send(anIRSend, "_isInlined", []), "_not", []), "_and_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.IRSendInliner || IRSendInliner), "_inlinedSelectors", []), "_includes_", [smalltalk.send(anIRSend, "_selector", [])]);})]);
  166. return self;}
  167. }),
  168. smalltalk.IRInliner);
  169. smalltalk.addMethod(
  170. "_visitIRAssignment_",
  171. smalltalk.method({
  172. selector: "visitIRAssignment:",
  173. fn: function (anIRAssignment) {
  174. var self=this;
  175. ((($receiver = smalltalk.send(self, "_shouldInlineAssignment_", [anIRAssignment])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_assignmentInliner", []), "_inlineAssignment_", [anIRAssignment]);})() : (function(){return smalltalk.send(self, "_visitIRAssignment_", [anIRAssignment], smalltalk.IRInliner.superclass || nil);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_assignmentInliner", []), "_inlineAssignment_", [anIRAssignment]);}), (function(){return smalltalk.send(self, "_visitIRAssignment_", [anIRAssignment], smalltalk.IRInliner.superclass || nil);})]));
  176. return self;}
  177. }),
  178. smalltalk.IRInliner);
  179. smalltalk.addMethod(
  180. "_visitIRNonLocalReturn_",
  181. smalltalk.method({
  182. selector: "visitIRNonLocalReturn:",
  183. fn: function (anIRNonLocalReturn) {
  184. var self=this;
  185. var localReturn=nil;
  186. ((($receiver = smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_scope", []), "_canInlineNonLocalReturns", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_scope", []), "_methodScope", []), "_removeNonLocalReturn_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);(localReturn=(function($rec){smalltalk.send($rec, "_scope_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn), "_new", [])));smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_instructions", []), "_do_", [(function(each){return smalltalk.send(localReturn, "_add_", [each]);})]);return smalltalk.send(anIRNonLocalReturn, "_replaceWith_", [localReturn]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_scope", []), "_methodScope", []), "_removeNonLocalReturn_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);(localReturn=(function($rec){smalltalk.send($rec, "_scope_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn), "_new", [])));smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_instructions", []), "_do_", [(function(each){return smalltalk.send(localReturn, "_add_", [each]);})]);return smalltalk.send(anIRNonLocalReturn, "_replaceWith_", [localReturn]);})]));
  187. smalltalk.send(self, "_visitIRNonLocalReturn_", [anIRNonLocalReturn], smalltalk.IRInliner.superclass || nil);
  188. return self;}
  189. }),
  190. smalltalk.IRInliner);
  191. smalltalk.addMethod(
  192. "_visitIRSend_",
  193. smalltalk.method({
  194. selector: "visitIRSend:",
  195. fn: function (anIRSend) {
  196. var self=this;
  197. ((($receiver = smalltalk.send(self, "_shouldInlineSend_", [anIRSend])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_sendInliner", []), "_inlineSend_", [anIRSend]);})() : (function(){return smalltalk.send(self, "_visitIRSend_", [anIRSend], smalltalk.IRInliner.superclass || nil);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_sendInliner", []), "_inlineSend_", [anIRSend]);}), (function(){return smalltalk.send(self, "_visitIRSend_", [anIRSend], smalltalk.IRInliner.superclass || nil);})]));
  198. return self;}
  199. }),
  200. smalltalk.IRInliner);
  201. smalltalk.addClass('IRInliningJSTranslator', smalltalk.IRJSTranslator, [], 'Compiler-Inlining');
  202. smalltalk.addMethod(
  203. "_visitIRInlinedAssignment_",
  204. smalltalk.method({
  205. selector: "visitIRInlinedAssignment:",
  206. fn: function (anIRInlinedAssignment) {
  207. var self=this;
  208. smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedAssignment, "_instructions", []), "_last", [])]);
  209. return self;}
  210. }),
  211. smalltalk.IRInliningJSTranslator);
  212. smalltalk.addMethod(
  213. "_visitIRInlinedClosure_",
  214. smalltalk.method({
  215. selector: "visitIRInlinedClosure:",
  216. fn: function (anIRInlinedClosure) {
  217. var self=this;
  218. smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_ifNotEmpty_", [(function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_notNil", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", []), "_canBeAssigned", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_variable", []), "_alias", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_variable", []), "_alias", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);})]));return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", [])]);})]);
  219. return self;}
  220. }),
  221. smalltalk.IRInliningJSTranslator);
  222. smalltalk.addMethod(
  223. "_visitIRInlinedIfFalse_",
  224. smalltalk.method({
  225. selector: "visitIRInlinedIfFalse:",
  226. fn: function (anIRInlinedIfFalse) {
  227. var self=this;
  228. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["! smalltalk.assert("]);smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_first", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [")"]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_last", [])]);})]);
  229. return self;}
  230. }),
  231. smalltalk.IRInliningJSTranslator);
  232. smalltalk.addMethod(
  233. "_visitIRInlinedIfTrue_",
  234. smalltalk.method({
  235. selector: "visitIRInlinedIfTrue:",
  236. fn: function (anIRInlinedIfTrue) {
  237. var self=this;
  238. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["smalltalk.assert("]);smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_first", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [")"]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_last", [])]);})]);
  239. return self;}
  240. }),
  241. smalltalk.IRInliningJSTranslator);
  242. smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
  243. smalltalk.addMethod(
  244. "_ifFalse_",
  245. smalltalk.method({
  246. selector: "ifFalse:",
  247. fn: function (anIRInstruction) {
  248. var self=this;
  249. var inlinedSend=nil;
  250. var inlinedClosure=nil;
  251. ((($receiver = smalltalk.send(anIRInstruction, "_isClosure", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_inliningError_", ["Message argument should be a block"]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_inliningError_", ["Message argument should be a block"]);})]));
  252. ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction, "_arguments", []), "_size", []), "__eq", [(0)])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_inliningError_", ["Inlined block should have zero argument"]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_inliningError_", ["Inlined block should have zero argument"]);})]));
  253. (inlinedClosure=smalltalk.send(self, "_inlineClosure_", [anIRInstruction]));
  254. (inlinedSend=smalltalk.send((smalltalk.IRInlinedIfFalse || IRInlinedIfFalse), "_new", []));
  255. (function($rec){smalltalk.send($rec, "_add_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_send", []), "_instructions", []), "_first", [])]);return smalltalk.send($rec, "_add_", [inlinedClosure]);})(inlinedSend);
  256. smalltalk.send(smalltalk.send(self, "_send", []), "_replaceWith_", [inlinedSend]);
  257. return inlinedSend;
  258. return self;}
  259. }),
  260. smalltalk.IRSendInliner);
  261. smalltalk.addMethod(
  262. "_ifTrue_",
  263. smalltalk.method({
  264. selector: "ifTrue:",
  265. fn: function (anIRInstruction) {
  266. var self=this;
  267. var inlinedSend=nil;
  268. var inlinedClosure=nil;
  269. ((($receiver = smalltalk.send(anIRInstruction, "_isClosure", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_inliningError_", ["Message argument should be a block"]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_inliningError_", ["Message argument should be a block"]);})]));
  270. ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction, "_arguments", []), "_size", []), "__eq", [(0)])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(self, "_inliningError_", ["Inlined block should have zero argument"]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(self, "_inliningError_", ["Inlined block should have zero argument"]);})]));
  271. (inlinedClosure=smalltalk.send(self, "_inlineClosure_", [anIRInstruction]));
  272. (inlinedSend=smalltalk.send((smalltalk.IRInlinedIfTrue || IRInlinedIfTrue), "_new", []));
  273. (function($rec){smalltalk.send($rec, "_add_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_send", []), "_instructions", []), "_first", [])]);return smalltalk.send($rec, "_add_", [inlinedClosure]);})(inlinedSend);
  274. smalltalk.send(smalltalk.send(self, "_send", []), "_replaceWith_", [inlinedSend]);
  275. return inlinedSend;
  276. return self;}
  277. }),
  278. smalltalk.IRSendInliner);
  279. smalltalk.addMethod(
  280. "_inlineClosure_",
  281. smalltalk.method({
  282. selector: "inlineClosure:",
  283. fn: function (anIRClosure) {
  284. var self=this;
  285. var inlinedClosure=nil;
  286. (inlinedClosure=smalltalk.send(self, "_inlinedClosure", []));
  287. smalltalk.send(inlinedClosure, "_scope_", [smalltalk.send(anIRClosure, "_scope", [])]);
  288. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRClosure, "_instructions", []), "_first", []), "_instructions", []), "_do_", [(function(each){return smalltalk.send(inlinedClosure, "_add_", [smalltalk.send(smalltalk.send(self, "_translator", []), "_visit_", [each])]);})]);
  289. return inlinedClosure;
  290. return self;}
  291. }),
  292. smalltalk.IRSendInliner);
  293. smalltalk.addMethod(
  294. "_inlineSend_",
  295. smalltalk.method({
  296. selector: "inlineSend:",
  297. fn: function (anIRSend) {
  298. var self=this;
  299. smalltalk.send(self, "_send_", [anIRSend]);
  300. smalltalk.send(self, "_perform_withArguments_", [smalltalk.send(smalltalk.send(self, "_send", []), "_selector", []), smalltalk.send(smalltalk.send(smalltalk.send(self, "_send", []), "_instructions", []), "_allButFirst", [])]);
  301. return self;}
  302. }),
  303. smalltalk.IRSendInliner);
  304. smalltalk.addMethod(
  305. "_inlinedClosure",
  306. smalltalk.method({
  307. selector: "inlinedClosure",
  308. fn: function () {
  309. var self=this;
  310. return smalltalk.send((smalltalk.IRInlinedClosure || IRInlinedClosure), "_new", []);
  311. return self;}
  312. }),
  313. smalltalk.IRSendInliner);
  314. smalltalk.addMethod(
  315. "_inliningError_",
  316. smalltalk.method({
  317. selector: "inliningError:",
  318. fn: function (aString) {
  319. var self=this;
  320. smalltalk.send((smalltalk.InliningError || InliningError), "_signal_", [aString]);
  321. return self;}
  322. }),
  323. smalltalk.IRSendInliner);
  324. smalltalk.addMethod(
  325. "_send",
  326. smalltalk.method({
  327. selector: "send",
  328. fn: function () {
  329. var self=this;
  330. return self['@send'];
  331. return self;}
  332. }),
  333. smalltalk.IRSendInliner);
  334. smalltalk.addMethod(
  335. "_send_",
  336. smalltalk.method({
  337. selector: "send:",
  338. fn: function (anIRSend) {
  339. var self=this;
  340. (self['@send']=anIRSend);
  341. return self;}
  342. }),
  343. smalltalk.IRSendInliner);
  344. smalltalk.addMethod(
  345. "_translator",
  346. smalltalk.method({
  347. selector: "translator",
  348. fn: function () {
  349. var self=this;
  350. return self['@translator'];
  351. return self;}
  352. }),
  353. smalltalk.IRSendInliner);
  354. smalltalk.addMethod(
  355. "_translator_",
  356. smalltalk.method({
  357. selector: "translator:",
  358. fn: function (anASTTranslator) {
  359. var self=this;
  360. (self['@translator']=anASTTranslator);
  361. return self;}
  362. }),
  363. smalltalk.IRSendInliner);
  364. smalltalk.addMethod(
  365. "_inlinedSelectors",
  366. smalltalk.method({
  367. selector: "inlinedSelectors",
  368. fn: function () {
  369. var self=this;
  370. return ["ifTrue:", "ifFalse:"];
  371. return self;}
  372. }),
  373. smalltalk.IRSendInliner.klass);
  374. smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  375. smalltalk.addMethod(
  376. "_assignment",
  377. smalltalk.method({
  378. selector: "assignment",
  379. fn: function () {
  380. var self=this;
  381. return self['@assignment'];
  382. return self;}
  383. }),
  384. smalltalk.IRAssignmentInliner);
  385. smalltalk.addMethod(
  386. "_assignment_",
  387. smalltalk.method({
  388. selector: "assignment:",
  389. fn: function (aNode) {
  390. var self=this;
  391. (self['@assignment']=aNode);
  392. return self;}
  393. }),
  394. smalltalk.IRAssignmentInliner);
  395. smalltalk.addMethod(
  396. "_inlineAssignment_",
  397. smalltalk.method({
  398. selector: "inlineAssignment:",
  399. fn: function (anIRAssignment) {
  400. var self=this;
  401. var inlinedAssignment=nil;
  402. smalltalk.send(self, "_assignment_", [anIRAssignment]);
  403. (inlinedAssignment=smalltalk.send((smalltalk.IRInlinedAssignment || IRInlinedAssignment), "_new", []));
  404. smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_do_", [(function(each){return smalltalk.send(inlinedAssignment, "_add_", [each]);})]);
  405. smalltalk.send(anIRAssignment, "_replaceWith_", [inlinedAssignment]);
  406. smalltalk.send(self, "_inlineSend_", [smalltalk.send(smalltalk.send(inlinedAssignment, "_instructions", []), "_last", [])]);
  407. return inlinedAssignment;
  408. return self;}
  409. }),
  410. smalltalk.IRAssignmentInliner);
  411. smalltalk.addMethod(
  412. "_inlinedClosure",
  413. smalltalk.method({
  414. selector: "inlinedClosure",
  415. fn: function () {
  416. var self=this;
  417. return (function($rec){smalltalk.send($rec, "_assignTo_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_assignment", []), "_instructions", []), "_first", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_inlinedClosure", [], smalltalk.IRAssignmentInliner.superclass || nil));
  418. return self;}
  419. }),
  420. smalltalk.IRAssignmentInliner);
  421. smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
  422. smalltalk.addMethod(
  423. "_compileNode_",
  424. smalltalk.method({
  425. selector: "compileNode:",
  426. fn: function (aNode) {
  427. var self=this;
  428. var ir=nil;
  429. var stream=nil;
  430. smalltalk.send(smalltalk.send(self, "_semanticAnalyzer", []), "_visit_", [aNode]);
  431. (ir=smalltalk.send(smalltalk.send(self, "_translator", []), "_visit_", [aNode]));
  432. smalltalk.send(smalltalk.send(self, "_inliner", []), "_visit_", [ir]);
  433. return (function($rec){smalltalk.send($rec, "_visit_", [ir]);return smalltalk.send($rec, "_contents", []);})(smalltalk.send(self, "_irTranslator", []));
  434. return self;}
  435. }),
  436. smalltalk.InliningCodeGenerator);
  437. smalltalk.addMethod(
  438. "_inliner",
  439. smalltalk.method({
  440. selector: "inliner",
  441. fn: function () {
  442. var self=this;
  443. return smalltalk.send((smalltalk.IRInliner || IRInliner), "_new", []);
  444. return self;}
  445. }),
  446. smalltalk.InliningCodeGenerator);
  447. smalltalk.addMethod(
  448. "_irTranslator",
  449. smalltalk.method({
  450. selector: "irTranslator",
  451. fn: function () {
  452. var self=this;
  453. return smalltalk.send((smalltalk.IRInliningJSTranslator || IRInliningJSTranslator), "_new", []);
  454. return self;}
  455. }),
  456. smalltalk.InliningCodeGenerator);