1
0

Compiler-Inlining.deploy.js 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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. }),
  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(anIRInlinedClosure)._instructions())._do_((function(each){
  399. return smalltalk.withContext(function($ctx2) { return _st(self)._visit_(each);
  400. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  401. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure}, smalltalk.IRInliningJSTranslator)})}
  402. }),
  403. smalltalk.IRInliningJSTranslator);
  404. smalltalk.addMethod(
  405. "_visitIRInlinedIfFalse_",
  406. smalltalk.method({
  407. selector: "visitIRInlinedIfFalse:",
  408. fn: function (anIRInlinedIfFalse){
  409. var self=this;
  410. return smalltalk.withContext(function($ctx1) { _st(_st(self)._stream())._nextPutIf_with_((function(){
  411. return smalltalk.withContext(function($ctx2) { _st(_st(self)._stream())._nextPutAll_("! smalltalk.assert(");
  412. _st(self)._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._first());
  413. return _st(_st(self)._stream())._nextPutAll_(")");
  414. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  415. return smalltalk.withContext(function($ctx2) { return _st(self)._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
  416. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  417. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse}, smalltalk.IRInliningJSTranslator)})}
  418. }),
  419. smalltalk.IRInliningJSTranslator);
  420. smalltalk.addMethod(
  421. "_visitIRInlinedIfNil_",
  422. smalltalk.method({
  423. selector: "visitIRInlinedIfNil:",
  424. fn: function (anIRInlinedIfNil){
  425. var self=this;
  426. return smalltalk.withContext(function($ctx1) { _st(_st(self)._stream())._nextPutIf_with_((function(){
  427. return smalltalk.withContext(function($ctx2) { _st(_st(self)._stream())._nextPutAll_("($receiver = ");
  428. _st(self)._visit_(_st(_st(anIRInlinedIfNil)._instructions())._first());
  429. return _st(_st(self)._stream())._nextPutAll_(") == nil || $receiver == undefined");
  430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  431. return smalltalk.withContext(function($ctx2) { return _st(self)._visit_(_st(_st(anIRInlinedIfNil)._instructions())._last());
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  433. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNil:",{anIRInlinedIfNil:anIRInlinedIfNil}, smalltalk.IRInliningJSTranslator)})}
  434. }),
  435. smalltalk.IRInliningJSTranslator);
  436. smalltalk.addMethod(
  437. "_visitIRInlinedIfNilIfNotNil_",
  438. smalltalk.method({
  439. selector: "visitIRInlinedIfNilIfNotNil:",
  440. fn: function (anIRInlinedIfNilIfNotNil){
  441. var self=this;
  442. return smalltalk.withContext(function($ctx1) { _st(_st(self)._stream())._nextPutIfElse_with_with_((function(){
  443. return smalltalk.withContext(function($ctx2) { _st(_st(self)._stream())._nextPutAll_("($receiver = ");
  444. _st(self)._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._first());
  445. return _st(_st(self)._stream())._nextPutAll_(") == nil || $receiver == undefined");
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  447. return smalltalk.withContext(function($ctx2) { return _st(self)._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._second());
  448. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  449. return smalltalk.withContext(function($ctx2) { return _st(self)._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third());
  450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  451. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil}, smalltalk.IRInliningJSTranslator)})}
  452. }),
  453. smalltalk.IRInliningJSTranslator);
  454. smalltalk.addMethod(
  455. "_visitIRInlinedIfTrue_",
  456. smalltalk.method({
  457. selector: "visitIRInlinedIfTrue:",
  458. fn: function (anIRInlinedIfTrue){
  459. var self=this;
  460. return smalltalk.withContext(function($ctx1) { _st(_st(self)._stream())._nextPutIf_with_((function(){
  461. return smalltalk.withContext(function($ctx2) { _st(_st(self)._stream())._nextPutAll_("smalltalk.assert(");
  462. _st(self)._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._first());
  463. return _st(_st(self)._stream())._nextPutAll_(")");
  464. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  465. return smalltalk.withContext(function($ctx2) { return _st(self)._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
  466. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  467. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue}, smalltalk.IRInliningJSTranslator)})}
  468. }),
  469. smalltalk.IRInliningJSTranslator);
  470. smalltalk.addMethod(
  471. "_visitIRInlinedIfTrueIfFalse_",
  472. smalltalk.method({
  473. selector: "visitIRInlinedIfTrueIfFalse:",
  474. fn: function (anIRInlinedIfTrueIfFalse){
  475. var self=this;
  476. return smalltalk.withContext(function($ctx1) { _st(_st(self)._stream())._nextPutIfElse_with_with_((function(){
  477. return smalltalk.withContext(function($ctx2) { _st(_st(self)._stream())._nextPutAll_("smalltalk.assert(");
  478. _st(self)._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._first());
  479. return _st(_st(self)._stream())._nextPutAll_(")");
  480. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  481. return smalltalk.withContext(function($ctx2) { return _st(self)._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._second());
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),(function(){
  483. return smalltalk.withContext(function($ctx2) { return _st(self)._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third());
  484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  485. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse}, smalltalk.IRInliningJSTranslator)})}
  486. }),
  487. smalltalk.IRInliningJSTranslator);
  488. smalltalk.addMethod(
  489. "_visitIRInlinedNonLocalReturn_",
  490. smalltalk.method({
  491. selector: "visitIRInlinedNonLocalReturn:",
  492. fn: function (anIRInlinedReturn){
  493. var self=this;
  494. return smalltalk.withContext(function($ctx1) { _st(_st(self)._stream())._nextPutStatementWith_((function(){
  495. return smalltalk.withContext(function($ctx2) { return _st(self)._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  496. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  497. _st(_st(self)._stream())._nextPutNonLocalReturnWith_((function(){
  498. return smalltalk.withContext(function($ctx2) { }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  499. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn}, smalltalk.IRInliningJSTranslator)})}
  500. }),
  501. smalltalk.IRInliningJSTranslator);
  502. smalltalk.addMethod(
  503. "_visitIRInlinedReturn_",
  504. smalltalk.method({
  505. selector: "visitIRInlinedReturn:",
  506. fn: function (anIRInlinedReturn){
  507. var self=this;
  508. return smalltalk.withContext(function($ctx1) { _st(self)._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
  509. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn}, smalltalk.IRInliningJSTranslator)})}
  510. }),
  511. smalltalk.IRInliningJSTranslator);
  512. smalltalk.addMethod(
  513. "_visitIRInlinedSequence_",
  514. smalltalk.method({
  515. selector: "visitIRInlinedSequence:",
  516. fn: function (anIRInlinedSequence){
  517. var self=this;
  518. return smalltalk.withContext(function($ctx1) { _st(_st(anIRInlinedSequence)._instructions())._do_((function(each){
  519. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._stream())._nextPutStatementWith_((function(){
  520. return smalltalk.withContext(function($ctx3) { return _st(self)._visit_(each);
  521. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  523. return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence}, smalltalk.IRInliningJSTranslator)})}
  524. }),
  525. smalltalk.IRInliningJSTranslator);
  526. smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
  527. smalltalk.addMethod(
  528. "_ifFalse_",
  529. smalltalk.method({
  530. selector: "ifFalse:",
  531. fn: function (anIRInstruction){
  532. var self=this;
  533. return smalltalk.withContext(function($ctx1) { var $1;
  534. $1=_st(self)._inlinedSend_with_(_st((smalltalk.IRInlinedIfFalse || IRInlinedIfFalse))._new(),anIRInstruction);
  535. return $1;
  536. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction}, smalltalk.IRSendInliner)})}
  537. }),
  538. smalltalk.IRSendInliner);
  539. smalltalk.addMethod(
  540. "_ifFalse_ifTrue_",
  541. smalltalk.method({
  542. selector: "ifFalse:ifTrue:",
  543. fn: function (anIRInstruction,anotherIRInstruction){
  544. var self=this;
  545. return smalltalk.withContext(function($ctx1) { var $1;
  546. $1=_st(self)._perform_withArguments_(smalltalk.symbolFor("ifTrue:ifFalse:"),[anotherIRInstruction,anIRInstruction]);
  547. return $1;
  548. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction}, smalltalk.IRSendInliner)})}
  549. }),
  550. smalltalk.IRSendInliner);
  551. smalltalk.addMethod(
  552. "_ifNil_",
  553. smalltalk.method({
  554. selector: "ifNil:",
  555. fn: function (anIRInstruction){
  556. var self=this;
  557. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$5,$1;
  558. $2=_st((smalltalk.IRClosure || IRClosure))._new();
  559. _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  560. $3=_st((smalltalk.IRBlockSequence || IRBlockSequence))._new();
  561. _st($3)._add_(_st(_st(_st(self)._send())._instructions())._first());
  562. $4=_st($3)._yourself();
  563. _st($2)._add_($4);
  564. $5=_st($2)._yourself();
  565. $1=_st(self)._inlinedSend_with_with_(_st((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil))._new(),anIRInstruction,$5);
  566. return $1;
  567. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction}, smalltalk.IRSendInliner)})}
  568. }),
  569. smalltalk.IRSendInliner);
  570. smalltalk.addMethod(
  571. "_ifNil_ifNotNil_",
  572. smalltalk.method({
  573. selector: "ifNil:ifNotNil:",
  574. fn: function (anIRInstruction,anotherIRInstruction){
  575. var self=this;
  576. return smalltalk.withContext(function($ctx1) { var $1;
  577. $1=_st(self)._inlinedSend_with_with_(_st((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil))._new(),anIRInstruction,anotherIRInstruction);
  578. return $1;
  579. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction}, smalltalk.IRSendInliner)})}
  580. }),
  581. smalltalk.IRSendInliner);
  582. smalltalk.addMethod(
  583. "_ifNotNil_",
  584. smalltalk.method({
  585. selector: "ifNotNil:",
  586. fn: function (anIRInstruction){
  587. var self=this;
  588. return smalltalk.withContext(function($ctx1) { var $2,$3,$4,$5,$1;
  589. $2=_st((smalltalk.IRClosure || IRClosure))._new();
  590. _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy());
  591. $3=_st((smalltalk.IRBlockSequence || IRBlockSequence))._new();
  592. _st($3)._add_(_st(_st(_st(self)._send())._instructions())._first());
  593. $4=_st($3)._yourself();
  594. _st($2)._add_($4);
  595. $5=_st($2)._yourself();
  596. $1=_st(self)._inlinedSend_with_with_(_st((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil))._new(),$5,anIRInstruction);
  597. return $1;
  598. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction}, smalltalk.IRSendInliner)})}
  599. }),
  600. smalltalk.IRSendInliner);
  601. smalltalk.addMethod(
  602. "_ifNotNil_ifNil_",
  603. smalltalk.method({
  604. selector: "ifNotNil:ifNil:",
  605. fn: function (anIRInstruction,anotherIRInstruction){
  606. var self=this;
  607. return smalltalk.withContext(function($ctx1) { var $1;
  608. $1=_st(self)._inlinedSend_with_with_(_st((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil))._new(),anotherIRInstruction,anIRInstruction);
  609. return $1;
  610. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction}, smalltalk.IRSendInliner)})}
  611. }),
  612. smalltalk.IRSendInliner);
  613. smalltalk.addMethod(
  614. "_ifTrue_",
  615. smalltalk.method({
  616. selector: "ifTrue:",
  617. fn: function (anIRInstruction){
  618. var self=this;
  619. return smalltalk.withContext(function($ctx1) { var $1;
  620. $1=_st(self)._inlinedSend_with_(_st((smalltalk.IRInlinedIfTrue || IRInlinedIfTrue))._new(),anIRInstruction);
  621. return $1;
  622. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction}, smalltalk.IRSendInliner)})}
  623. }),
  624. smalltalk.IRSendInliner);
  625. smalltalk.addMethod(
  626. "_ifTrue_ifFalse_",
  627. smalltalk.method({
  628. selector: "ifTrue:ifFalse:",
  629. fn: function (anIRInstruction,anotherIRInstruction){
  630. var self=this;
  631. return smalltalk.withContext(function($ctx1) { var $1;
  632. $1=_st(self)._inlinedSend_with_with_(_st((smalltalk.IRInlinedIfTrueIfFalse || IRInlinedIfTrueIfFalse))._new(),anIRInstruction,anotherIRInstruction);
  633. return $1;
  634. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction}, smalltalk.IRSendInliner)})}
  635. }),
  636. smalltalk.IRSendInliner);
  637. smalltalk.addMethod(
  638. "_inlineClosure_",
  639. smalltalk.method({
  640. selector: "inlineClosure:",
  641. fn: function (anIRClosure){
  642. var self=this;
  643. var inlinedClosure,sequence,statements;
  644. return smalltalk.withContext(function($ctx1) { var $1,$3,$2,$4,$6,$5,$7;
  645. inlinedClosure=_st(self)._inlinedClosure();
  646. _st(inlinedClosure)._scope_(_st(anIRClosure)._scope());
  647. $1=_st(anIRClosure)._instructions();
  648. $2=(function(each){
  649. return smalltalk.withContext(function($ctx2) { $3=_st(each)._isSequence();
  650. if(! smalltalk.assert($3)){
  651. return _st(inlinedClosure)._add_(each);
  652. };
  653. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  654. _st($1)._do_($2);
  655. sequence=_st(self)._inlinedSequence();
  656. _st(inlinedClosure)._add_(sequence);
  657. statements=_st(_st(_st(anIRClosure)._instructions())._last())._instructions();
  658. $4=statements;
  659. $5=(function(){
  660. return smalltalk.withContext(function($ctx2) { _st(_st(statements)._allButLast())._do_((function(each){
  661. return smalltalk.withContext(function($ctx3) { return _st(sequence)._add_(each);
  662. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}));
  663. $6=_st(_st(_st(statements)._last())._isReturn())._and_((function(){
  664. return smalltalk.withContext(function($ctx3) { return _st(_st(statements)._last())._isBlockReturn();
  665. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  666. if(smalltalk.assert($6)){
  667. return _st(sequence)._add_(_st(_st(_st(statements)._last())._instructions())._first());
  668. } else {
  669. return _st(sequence)._add_(_st(statements)._last());
  670. };
  671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  672. _st($4)._ifNotEmpty_($5);
  673. $7=inlinedClosure;
  674. return $7;
  675. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements}, smalltalk.IRSendInliner)})}
  676. }),
  677. smalltalk.IRSendInliner);
  678. smalltalk.addMethod(
  679. "_inlineSend_",
  680. smalltalk.method({
  681. selector: "inlineSend:",
  682. fn: function (anIRSend){
  683. var self=this;
  684. return smalltalk.withContext(function($ctx1) { var $1;
  685. _st(self)._send_(anIRSend);
  686. $1=_st(self)._perform_withArguments_(_st(_st(self)._send())._selector(),_st(_st(_st(self)._send())._instructions())._allButFirst());
  687. return $1;
  688. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend}, smalltalk.IRSendInliner)})}
  689. }),
  690. smalltalk.IRSendInliner);
  691. smalltalk.addMethod(
  692. "_inlinedClosure",
  693. smalltalk.method({
  694. selector: "inlinedClosure",
  695. fn: function (){
  696. var self=this;
  697. return smalltalk.withContext(function($ctx1) { var $1;
  698. $1=_st((smalltalk.IRInlinedClosure || IRInlinedClosure))._new();
  699. return $1;
  700. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{}, smalltalk.IRSendInliner)})}
  701. }),
  702. smalltalk.IRSendInliner);
  703. smalltalk.addMethod(
  704. "_inlinedSend_with_",
  705. smalltalk.method({
  706. selector: "inlinedSend:with:",
  707. fn: function (inlinedSend,anIRInstruction){
  708. var self=this;
  709. var inlinedClosure;
  710. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5;
  711. $1=_st(anIRInstruction)._isClosure();
  712. if(! smalltalk.assert($1)){
  713. _st(self)._inliningError_("Message argument should be a block");
  714. };
  715. $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
  716. if(! smalltalk.assert($2)){
  717. _st(self)._inliningError_("Inlined block should have zero argument");
  718. };
  719. inlinedClosure=_st(_st(self)._translator())._visit_(_st(self)._inlineClosure_(anIRInstruction));
  720. $3=inlinedSend;
  721. _st($3)._add_(_st(_st(_st(self)._send())._instructions())._first());
  722. $4=_st($3)._add_(inlinedClosure);
  723. _st(_st(self)._send())._replaceWith_(inlinedSend);
  724. $5=inlinedSend;
  725. return $5;
  726. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure}, smalltalk.IRSendInliner)})}
  727. }),
  728. smalltalk.IRSendInliner);
  729. smalltalk.addMethod(
  730. "_inlinedSend_with_with_",
  731. smalltalk.method({
  732. selector: "inlinedSend:with:with:",
  733. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  734. var self=this;
  735. var inlinedClosure1,inlinedClosure2;
  736. return smalltalk.withContext(function($ctx1) { var $1,$2,$3,$4,$5,$6,$7;
  737. $1=_st(anIRInstruction)._isClosure();
  738. if(! smalltalk.assert($1)){
  739. _st(self)._inliningError_("Message argument should be a block");
  740. };
  741. $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0));
  742. if(! smalltalk.assert($2)){
  743. _st(self)._inliningError_("Inlined block should have zero argument");
  744. };
  745. $3=_st(anotherIRInstruction)._isClosure();
  746. if(! smalltalk.assert($3)){
  747. _st(self)._inliningError_("Message argument should be a block");
  748. };
  749. $4=_st(_st(_st(anotherIRInstruction)._arguments())._size()).__eq((0));
  750. if(! smalltalk.assert($4)){
  751. _st(self)._inliningError_("Inlined block should have zero argument");
  752. };
  753. inlinedClosure1=_st(_st(self)._translator())._visit_(_st(self)._inlineClosure_(anIRInstruction));
  754. inlinedClosure2=_st(_st(self)._translator())._visit_(_st(self)._inlineClosure_(anotherIRInstruction));
  755. $5=inlinedSend;
  756. _st($5)._add_(_st(_st(_st(self)._send())._instructions())._first());
  757. _st($5)._add_(inlinedClosure1);
  758. $6=_st($5)._add_(inlinedClosure2);
  759. _st(_st(self)._send())._replaceWith_(inlinedSend);
  760. $7=inlinedSend;
  761. return $7;
  762. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2}, smalltalk.IRSendInliner)})}
  763. }),
  764. smalltalk.IRSendInliner);
  765. smalltalk.addMethod(
  766. "_inlinedSequence",
  767. smalltalk.method({
  768. selector: "inlinedSequence",
  769. fn: function (){
  770. var self=this;
  771. return smalltalk.withContext(function($ctx1) { var $1;
  772. $1=_st((smalltalk.IRInlinedSequence || IRInlinedSequence))._new();
  773. return $1;
  774. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{}, smalltalk.IRSendInliner)})}
  775. }),
  776. smalltalk.IRSendInliner);
  777. smalltalk.addMethod(
  778. "_inliningError_",
  779. smalltalk.method({
  780. selector: "inliningError:",
  781. fn: function (aString){
  782. var self=this;
  783. return smalltalk.withContext(function($ctx1) { _st((smalltalk.InliningError || InliningError))._signal_(aString);
  784. return self}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString}, smalltalk.IRSendInliner)})}
  785. }),
  786. smalltalk.IRSendInliner);
  787. smalltalk.addMethod(
  788. "_send",
  789. smalltalk.method({
  790. selector: "send",
  791. fn: function (){
  792. var self=this;
  793. return smalltalk.withContext(function($ctx1) { var $1;
  794. $1=self["@send"];
  795. return $1;
  796. }, function($ctx1) {$ctx1.fill(self,"send",{}, smalltalk.IRSendInliner)})}
  797. }),
  798. smalltalk.IRSendInliner);
  799. smalltalk.addMethod(
  800. "_send_",
  801. smalltalk.method({
  802. selector: "send:",
  803. fn: function (anIRSend){
  804. var self=this;
  805. return smalltalk.withContext(function($ctx1) { self["@send"]=anIRSend;
  806. return self}, function($ctx1) {$ctx1.fill(self,"send:",{anIRSend:anIRSend}, smalltalk.IRSendInliner)})}
  807. }),
  808. smalltalk.IRSendInliner);
  809. smalltalk.addMethod(
  810. "_translator",
  811. smalltalk.method({
  812. selector: "translator",
  813. fn: function (){
  814. var self=this;
  815. return smalltalk.withContext(function($ctx1) { var $1;
  816. $1=self["@translator"];
  817. return $1;
  818. }, function($ctx1) {$ctx1.fill(self,"translator",{}, smalltalk.IRSendInliner)})}
  819. }),
  820. smalltalk.IRSendInliner);
  821. smalltalk.addMethod(
  822. "_translator_",
  823. smalltalk.method({
  824. selector: "translator:",
  825. fn: function (anASTTranslator){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) { self["@translator"]=anASTTranslator;
  828. return self}, function($ctx1) {$ctx1.fill(self,"translator:",{anASTTranslator:anASTTranslator}, smalltalk.IRSendInliner)})}
  829. }),
  830. smalltalk.IRSendInliner);
  831. smalltalk.addMethod(
  832. "_inlinedSelectors",
  833. smalltalk.method({
  834. selector: "inlinedSelectors",
  835. fn: function (){
  836. var self=this;
  837. return smalltalk.withContext(function($ctx1) { return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil"];
  838. }, function($ctx1) {$ctx1.fill(self,"inlinedSelectors",{}, smalltalk.IRSendInliner.klass)})}
  839. }),
  840. smalltalk.IRSendInliner.klass);
  841. smalltalk.addMethod(
  842. "_shouldInline_",
  843. smalltalk.method({
  844. selector: "shouldInline:",
  845. fn: function (anIRInstruction){
  846. var self=this;
  847. return smalltalk.withContext(function($ctx1) { var $1,$2,$4,$3;
  848. var $early={};
  849. try {
  850. $1=_st(_st(self)._inlinedSelectors())._includes_(_st(anIRInstruction)._selector());
  851. if(! smalltalk.assert($1)){
  852. return false;
  853. };
  854. $2=_st(_st(anIRInstruction)._instructions())._allButFirst();
  855. $3=(function(each){
  856. return smalltalk.withContext(function($ctx2) { $4=_st(each)._isClosure();
  857. if(! smalltalk.assert($4)){
  858. throw $early=[false];
  859. };
  860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})});
  861. _st($2)._do_($3);
  862. return true;
  863. }
  864. catch(e) {if(e===$early)return e[0]; throw e}
  865. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction}, smalltalk.IRSendInliner.klass)})}
  866. }),
  867. smalltalk.IRSendInliner.klass);
  868. smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
  869. smalltalk.addMethod(
  870. "_assignment",
  871. smalltalk.method({
  872. selector: "assignment",
  873. fn: function (){
  874. var self=this;
  875. return smalltalk.withContext(function($ctx1) { var $1;
  876. $1=self["@assignment"];
  877. return $1;
  878. }, function($ctx1) {$ctx1.fill(self,"assignment",{}, smalltalk.IRAssignmentInliner)})}
  879. }),
  880. smalltalk.IRAssignmentInliner);
  881. smalltalk.addMethod(
  882. "_assignment_",
  883. smalltalk.method({
  884. selector: "assignment:",
  885. fn: function (aNode){
  886. var self=this;
  887. return smalltalk.withContext(function($ctx1) { self["@assignment"]=aNode;
  888. return self}, function($ctx1) {$ctx1.fill(self,"assignment:",{aNode:aNode}, smalltalk.IRAssignmentInliner)})}
  889. }),
  890. smalltalk.IRAssignmentInliner);
  891. smalltalk.addMethod(
  892. "_inlineAssignment_",
  893. smalltalk.method({
  894. selector: "inlineAssignment:",
  895. fn: function (anIRAssignment){
  896. var self=this;
  897. var inlinedAssignment;
  898. return smalltalk.withContext(function($ctx1) { var $1;
  899. _st(self)._assignment_(anIRAssignment);
  900. inlinedAssignment=_st((smalltalk.IRInlinedAssignment || IRInlinedAssignment))._new();
  901. _st(_st(anIRAssignment)._instructions())._do_((function(each){
  902. return smalltalk.withContext(function($ctx2) { return _st(inlinedAssignment)._add_(each);
  903. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  904. _st(anIRAssignment)._replaceWith_(inlinedAssignment);
  905. _st(self)._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last());
  906. $1=inlinedAssignment;
  907. return $1;
  908. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment}, smalltalk.IRAssignmentInliner)})}
  909. }),
  910. smalltalk.IRAssignmentInliner);
  911. smalltalk.addMethod(
  912. "_inlineClosure_",
  913. smalltalk.method({
  914. selector: "inlineClosure:",
  915. fn: function (anIRClosure){
  916. var self=this;
  917. var inlinedClosure,statements;
  918. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$2,$6;
  919. inlinedClosure=smalltalk.IRSendInliner.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  920. statements=_st(_st(_st(inlinedClosure)._instructions())._last())._instructions();
  921. $1=statements;
  922. $2=(function(){
  923. return smalltalk.withContext(function($ctx2) { $3=_st(_st(statements)._last())._canBeAssigned();
  924. if(smalltalk.assert($3)){
  925. $4=_st((smalltalk.IRAssignment || IRAssignment))._new();
  926. _st($4)._add_(_st(_st(_st(self)._assignment())._instructions())._first());
  927. _st($4)._add_(_st(_st(statements)._last())._copy());
  928. $5=_st($4)._yourself();
  929. return _st(_st(statements)._last())._replaceWith_($5);
  930. };
  931. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  932. _st($1)._ifNotEmpty_($2);
  933. $6=inlinedClosure;
  934. return $6;
  935. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements}, smalltalk.IRAssignmentInliner)})}
  936. }),
  937. smalltalk.IRAssignmentInliner);
  938. smalltalk.addClass('IRNonLocalReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  939. smalltalk.addMethod(
  940. "_inlineClosure_",
  941. smalltalk.method({
  942. selector: "inlineClosure:",
  943. fn: function (anIRClosure){
  944. var self=this;
  945. return smalltalk.withContext(function($ctx1) { var $1;
  946. $1=smalltalk.IRSendInliner.fn.prototype._inlineCLosure_.apply(_st(self), [anIRClosure]);
  947. return $1;
  948. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure}, smalltalk.IRNonLocalReturnInliner)})}
  949. }),
  950. smalltalk.IRNonLocalReturnInliner);
  951. smalltalk.addMethod(
  952. "_inlinedReturn",
  953. smalltalk.method({
  954. selector: "inlinedReturn",
  955. fn: function (){
  956. var self=this;
  957. return smalltalk.withContext(function($ctx1) { var $1;
  958. $1=_st((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn))._new();
  959. return $1;
  960. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{}, smalltalk.IRNonLocalReturnInliner)})}
  961. }),
  962. smalltalk.IRNonLocalReturnInliner);
  963. smalltalk.addClass('IRReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
  964. smalltalk.addMethod(
  965. "_inlineClosure_",
  966. smalltalk.method({
  967. selector: "inlineClosure:",
  968. fn: function (anIRClosure){
  969. var self=this;
  970. var closure,statements;
  971. return smalltalk.withContext(function($ctx1) { var $1,$3,$4,$5,$2,$6;
  972. closure=smalltalk.IRSendInliner.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]);
  973. statements=_st(_st(_st(closure)._instructions())._last())._instructions();
  974. $1=statements;
  975. $2=(function(){
  976. return smalltalk.withContext(function($ctx2) { $3=_st(_st(statements)._last())._isReturn();
  977. if(! smalltalk.assert($3)){
  978. $4=_st((smalltalk.IRReturn || IRReturn))._new();
  979. _st($4)._add_(_st(_st(statements)._last())._copy());
  980. $5=_st($4)._yourself();
  981. return _st(_st(statements)._last())._replaceWith_($5);
  982. };
  983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  984. _st($1)._ifNotEmpty_($2);
  985. $6=closure;
  986. return $6;
  987. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements}, smalltalk.IRReturnInliner)})}
  988. }),
  989. smalltalk.IRReturnInliner);
  990. smalltalk.addMethod(
  991. "_inlineReturn_",
  992. smalltalk.method({
  993. selector: "inlineReturn:",
  994. fn: function (anIRReturn){
  995. var self=this;
  996. var return_;
  997. return smalltalk.withContext(function($ctx1) { var $1;
  998. return_=_st(self)._inlinedReturn();
  999. _st(_st(anIRReturn)._instructions())._do_((function(each){
  1000. return smalltalk.withContext(function($ctx2) { return _st(return_)._add_(each);
  1001. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1002. _st(anIRReturn)._replaceWith_(return_);
  1003. _st(self)._inlineSend_(_st(_st(return_)._instructions())._last());
  1004. $1=return_;
  1005. return $1;
  1006. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_}, smalltalk.IRReturnInliner)})}
  1007. }),
  1008. smalltalk.IRReturnInliner);
  1009. smalltalk.addMethod(
  1010. "_inlinedReturn",
  1011. smalltalk.method({
  1012. selector: "inlinedReturn",
  1013. fn: function (){
  1014. var self=this;
  1015. return smalltalk.withContext(function($ctx1) { var $1;
  1016. $1=_st((smalltalk.IRInlinedReturn || IRInlinedReturn))._new();
  1017. return $1;
  1018. }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{}, smalltalk.IRReturnInliner)})}
  1019. }),
  1020. smalltalk.IRReturnInliner);
  1021. smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
  1022. smalltalk.addMethod(
  1023. "_compileNode_",
  1024. smalltalk.method({
  1025. selector: "compileNode:",
  1026. fn: function (aNode){
  1027. var self=this;
  1028. var ir,stream;
  1029. return smalltalk.withContext(function($ctx1) { var $2,$3,$1;
  1030. _st(_st(self)._semanticAnalyzer())._visit_(aNode);
  1031. ir=_st(_st(self)._translator())._visit_(aNode);
  1032. _st(_st(self)._inliner())._visit_(ir);
  1033. $2=_st(self)._irTranslator();
  1034. _st($2)._visit_(ir);
  1035. $3=_st($2)._contents();
  1036. $1=$3;
  1037. return $1;
  1038. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream}, smalltalk.InliningCodeGenerator)})}
  1039. }),
  1040. smalltalk.InliningCodeGenerator);
  1041. smalltalk.addMethod(
  1042. "_inliner",
  1043. smalltalk.method({
  1044. selector: "inliner",
  1045. fn: function (){
  1046. var self=this;
  1047. return smalltalk.withContext(function($ctx1) { var $1;
  1048. $1=_st((smalltalk.IRInliner || IRInliner))._new();
  1049. return $1;
  1050. }, function($ctx1) {$ctx1.fill(self,"inliner",{}, smalltalk.InliningCodeGenerator)})}
  1051. }),
  1052. smalltalk.InliningCodeGenerator);
  1053. smalltalk.addMethod(
  1054. "_irTranslator",
  1055. smalltalk.method({
  1056. selector: "irTranslator",
  1057. fn: function (){
  1058. var self=this;
  1059. return smalltalk.withContext(function($ctx1) { var $1;
  1060. $1=_st((smalltalk.IRInliningJSTranslator || IRInliningJSTranslator))._new();
  1061. return $1;
  1062. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{}, smalltalk.InliningCodeGenerator)})}
  1063. }),
  1064. smalltalk.InliningCodeGenerator);