Compiler-Inlining.deploy.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
  219. ((($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", []);})]));
  220. smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", [])]);
  221. return self;}
  222. }),
  223. smalltalk.IRInliningJSTranslator);
  224. smalltalk.addMethod(
  225. "_visitIRInlinedIfFalse_",
  226. smalltalk.method({
  227. selector: "visitIRInlinedIfFalse:",
  228. fn: function (anIRInlinedIfFalse){
  229. var self=this;
  230. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["!"]);return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_first", [])]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_last", [])]);})]);
  231. return self;}
  232. }),
  233. smalltalk.IRInliningJSTranslator);
  234. smalltalk.addMethod(
  235. "_visitIRInlinedIfTrue_",
  236. smalltalk.method({
  237. selector: "visitIRInlinedIfTrue:",
  238. fn: function (anIRInlinedIfTrue){
  239. var self=this;
  240. smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_first", [])]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_last", [])]);})]);
  241. return self;}
  242. }),
  243. smalltalk.IRInliningJSTranslator);
  244. smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
  245. smalltalk.addMethod(
  246. "_ifFalse_",
  247. smalltalk.method({
  248. selector: "ifFalse:",
  249. fn: function (anIRInstruction){
  250. var self=this;
  251. var inlinedSend=nil;
  252. var inlinedClosure=nil;
  253. ((($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"]);})]));
  254. ((($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"]);})]));
  255. (inlinedClosure=smalltalk.send(self, "_inlineClosure_", [anIRInstruction]));
  256. (inlinedSend=smalltalk.send((smalltalk.IRInlinedIfFalse || IRInlinedIfFalse), "_new", []));
  257. (function($rec){smalltalk.send($rec, "_add_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_send", []), "_instructions", []), "_first", [])]);return smalltalk.send($rec, "_add_", [inlinedClosure]);})(inlinedSend);
  258. smalltalk.send(smalltalk.send(self, "_send", []), "_replaceWith_", [inlinedSend]);
  259. return inlinedSend;
  260. return self;}
  261. }),
  262. smalltalk.IRSendInliner);
  263. smalltalk.addMethod(
  264. "_ifTrue_",
  265. smalltalk.method({
  266. selector: "ifTrue:",
  267. fn: function (anIRInstruction){
  268. var self=this;
  269. var inlinedSend=nil;
  270. var inlinedClosure=nil;
  271. ((($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"]);})]));
  272. ((($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"]);})]));
  273. (inlinedClosure=smalltalk.send(self, "_inlineClosure_", [anIRInstruction]));
  274. (inlinedSend=smalltalk.send((smalltalk.IRInlinedIfTrue || IRInlinedIfTrue), "_new", []));
  275. (function($rec){smalltalk.send($rec, "_add_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_send", []), "_instructions", []), "_first", [])]);return smalltalk.send($rec, "_add_", [inlinedClosure]);})(inlinedSend);
  276. smalltalk.send(smalltalk.send(self, "_send", []), "_replaceWith_", [inlinedSend]);
  277. return inlinedSend;
  278. return self;}
  279. }),
  280. smalltalk.IRSendInliner);
  281. smalltalk.addMethod(
  282. "_inlineClosure_",
  283. smalltalk.method({
  284. selector: "inlineClosure:",
  285. fn: function (anIRClosure){
  286. var self=this;
  287. var inlinedClosure=nil;
  288. (inlinedClosure=smalltalk.send(self, "_inlinedClosure", []));
  289. smalltalk.send(inlinedClosure, "_scope_", [smalltalk.send(anIRClosure, "_scope", [])]);
  290. 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])]);})]);
  291. return inlinedClosure;
  292. return self;}
  293. }),
  294. smalltalk.IRSendInliner);
  295. smalltalk.addMethod(
  296. "_inlineSend_",
  297. smalltalk.method({
  298. selector: "inlineSend:",
  299. fn: function (anIRSend){
  300. var self=this;
  301. smalltalk.send(self, "_send_", [anIRSend]);
  302. smalltalk.send(self, "_perform_withArguments_", [smalltalk.send(smalltalk.send(self, "_send", []), "_selector", []), smalltalk.send(smalltalk.send(smalltalk.send(self, "_send", []), "_instructions", []), "_allButFirst", [])]);
  303. return self;}
  304. }),
  305. smalltalk.IRSendInliner);
  306. smalltalk.addMethod(
  307. "_inlinedClosure",
  308. smalltalk.method({
  309. selector: "inlinedClosure",
  310. fn: function (){
  311. var self=this;
  312. return smalltalk.send((smalltalk.IRInlinedClosure || IRInlinedClosure), "_new", []);
  313. return self;}
  314. }),
  315. smalltalk.IRSendInliner);
  316. smalltalk.addMethod(
  317. "_inliningError_",
  318. smalltalk.method({
  319. selector: "inliningError:",
  320. fn: function (aString) {
  321. var self=this;
  322. smalltalk.send((smalltalk.InliningError || InliningError), "_signal_", [aString]);
  323. return self;}
  324. }),
  325. smalltalk.IRSendInliner);
  326. smalltalk.addMethod(
  327. "_send",
  328. smalltalk.method({
  329. selector: "send",
  330. fn: function () {
  331. var self=this;
  332. return self['@send'];
  333. return self;}
  334. }),
  335. smalltalk.IRSendInliner);
  336. smalltalk.addMethod(
  337. "_send_",
  338. smalltalk.method({
  339. selector: "send:",
  340. fn: function (anIRSend) {
  341. var self=this;
  342. (self['@send']=anIRSend);
  343. return self;}
  344. }),
  345. smalltalk.IRSendInliner);
  346. smalltalk.addMethod(
  347. "_translator",
  348. smalltalk.method({
  349. selector: "translator",
  350. fn: function () {
  351. var self=this;
  352. return self['@translator'];
  353. return self;}
  354. }),
  355. smalltalk.IRSendInliner);
  356. smalltalk.addMethod(
  357. "_translator_",
  358. smalltalk.method({
  359. selector: "translator:",
  360. fn: function (anASTTranslator) {
  361. var self=this;
  362. (self['@translator']=anASTTranslator);
  363. return self;}
  364. }),
  365. smalltalk.IRSendInliner);
  366. smalltalk.addMethod(
  367. "_inlinedSelectors",
  368. smalltalk.method({
  369. selector: "inlinedSelectors",
  370. fn: function (){
  371. var self=this;
  372. return ["ifTrue:", "ifFalse:"];
  373. return self;}
  374. }),
  375. smalltalk.IRSendInliner.klass);
  376. smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  377. smalltalk.addMethod(
  378. "_assignment",
  379. smalltalk.method({
  380. selector: "assignment",
  381. fn: function () {
  382. var self=this;
  383. return self['@assignment'];
  384. return self;}
  385. }),
  386. smalltalk.IRAssignmentInliner);
  387. smalltalk.addMethod(
  388. "_assignment_",
  389. smalltalk.method({
  390. selector: "assignment:",
  391. fn: function (aNode) {
  392. var self=this;
  393. (self['@assignment']=aNode);
  394. return self;}
  395. }),
  396. smalltalk.IRAssignmentInliner);
  397. smalltalk.addMethod(
  398. "_inlineAssignment_",
  399. smalltalk.method({
  400. selector: "inlineAssignment:",
  401. fn: function (anIRAssignment){
  402. var self=this;
  403. var inlinedAssignment=nil;
  404. smalltalk.send(self, "_assignment_", [anIRAssignment]);
  405. (inlinedAssignment=smalltalk.send((smalltalk.IRInlinedAssignment || IRInlinedAssignment), "_new", []));
  406. smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_do_", [(function(each){return smalltalk.send(inlinedAssignment, "_add_", [each]);})]);
  407. smalltalk.send(anIRAssignment, "_replaceWith_", [inlinedAssignment]);
  408. smalltalk.send(self, "_inlineSend_", [smalltalk.send(smalltalk.send(inlinedAssignment, "_instructions", []), "_last", [])]);
  409. return inlinedAssignment;
  410. return self;}
  411. }),
  412. smalltalk.IRAssignmentInliner);
  413. smalltalk.addMethod(
  414. "_inlinedClosure",
  415. smalltalk.method({
  416. selector: "inlinedClosure",
  417. fn: function (){
  418. var self=this;
  419. 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));
  420. return self;}
  421. }),
  422. smalltalk.IRAssignmentInliner);
  423. smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
  424. smalltalk.addMethod(
  425. "_compileNode_",
  426. smalltalk.method({
  427. selector: "compileNode:",
  428. fn: function (aNode){
  429. var self=this;
  430. var ir=nil;
  431. var stream=nil;
  432. smalltalk.send(smalltalk.send(self, "_semanticAnalyzer", []), "_visit_", [aNode]);
  433. (ir=smalltalk.send(smalltalk.send(self, "_translator", []), "_visit_", [aNode]));
  434. smalltalk.send(smalltalk.send(self, "_inliner", []), "_visit_", [ir]);
  435. return (function($rec){smalltalk.send($rec, "_visit_", [ir]);return smalltalk.send($rec, "_contents", []);})(smalltalk.send(self, "_irTranslator", []));
  436. return self;}
  437. }),
  438. smalltalk.InliningCodeGenerator);
  439. smalltalk.addMethod(
  440. "_inliner",
  441. smalltalk.method({
  442. selector: "inliner",
  443. fn: function (){
  444. var self=this;
  445. return smalltalk.send((smalltalk.IRInliner || IRInliner), "_new", []);
  446. return self;}
  447. }),
  448. smalltalk.InliningCodeGenerator);
  449. smalltalk.addMethod(
  450. "_irTranslator",
  451. smalltalk.method({
  452. selector: "irTranslator",
  453. fn: function () {
  454. var self=this;
  455. return smalltalk.send((smalltalk.IRInliningJSTranslator || IRInliningJSTranslator), "_new", []);
  456. return self;}
  457. }),
  458. smalltalk.InliningCodeGenerator);