1
0

Compiler-Inlining.deploy.js 47 KB

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