resin 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. data/amber/css/amber-normalize.css +73 -73
  2. data/amber/css/amber-normalize.less +1 -1
  3. data/amber/css/amber.css +106 -106
  4. data/amber/css/helios.css +242 -0
  5. data/amber/images/hsplitter.png +0 -0
  6. data/amber/images/vsplitter.png +0 -0
  7. data/amber/js/Benchfib.deploy.js +116 -38
  8. data/amber/js/Benchfib.js +120 -42
  9. data/amber/js/Canvas.deploy.js +674 -403
  10. data/amber/js/Canvas.js +682 -411
  11. data/amber/js/Compiler-AST.deploy.js +1150 -0
  12. data/amber/js/Compiler-AST.js +1591 -0
  13. data/amber/js/Compiler-Core.deploy.js +1562 -0
  14. data/amber/js/Compiler-Core.js +1972 -0
  15. data/amber/js/Compiler-Exceptions.deploy.js +114 -0
  16. data/amber/js/Compiler-Exceptions.js +161 -0
  17. data/amber/js/Compiler-IR.deploy.js +2326 -0
  18. data/amber/js/Compiler-IR.js +3146 -0
  19. data/amber/js/Compiler-Inlining.deploy.js +1147 -0
  20. data/amber/js/Compiler-Inlining.js +1514 -0
  21. data/amber/js/Compiler-Semantic.deploy.js +1207 -0
  22. data/amber/js/Compiler-Semantic.js +1628 -0
  23. data/amber/js/Compiler-Tests.deploy.js +646 -60
  24. data/amber/js/Compiler-Tests.js +843 -82
  25. data/amber/js/Compiler.deploy.js +1097 -159
  26. data/amber/js/Compiler.js +1414 -161
  27. data/amber/js/Examples.deploy.js +31 -15
  28. data/amber/js/Examples.js +33 -17
  29. data/amber/js/Helios-Announcements.deploy.js +127 -0
  30. data/amber/js/Helios-Announcements.js +157 -0
  31. data/amber/js/Helios-Browser.deploy.js +1473 -0
  32. data/amber/js/Helios-Browser.js +1953 -0
  33. data/amber/js/Helios-Commands.deploy.js +403 -0
  34. data/amber/js/Helios-Commands.js +563 -0
  35. data/amber/js/Helios-Core.deploy.js +1070 -0
  36. data/amber/js/Helios-Core.js +1445 -0
  37. data/amber/js/Helios-Environments.deploy.js +132 -0
  38. data/amber/js/Helios-Environments.js +179 -0
  39. data/amber/js/Helios-Inspector.deploy.js +855 -0
  40. data/amber/js/Helios-Inspector.js +1155 -0
  41. data/amber/js/Helios-KeyBindings.deploy.js +753 -0
  42. data/amber/js/Helios-KeyBindings.js +1023 -0
  43. data/amber/js/Helios-Layout.deploy.js +383 -0
  44. data/amber/js/Helios-Layout.js +523 -0
  45. data/amber/js/Helios-Workspace.deploy.js +799 -0
  46. data/amber/js/Helios-Workspace.js +1074 -0
  47. data/amber/js/IDE.deploy.js +2541 -1490
  48. data/amber/js/IDE.js +2721 -1660
  49. data/amber/js/Importer-Exporter.deploy.js +671 -0
  50. data/amber/js/Importer-Exporter.js +816 -0
  51. data/amber/js/Kernel-Announcements.deploy.js +137 -20
  52. data/amber/js/Kernel-Announcements.js +176 -22
  53. data/amber/js/Kernel-Classes.deploy.js +555 -168
  54. data/amber/js/Kernel-Classes.js +662 -205
  55. data/amber/js/Kernel-Collections.deploy.js +1403 -618
  56. data/amber/js/Kernel-Collections.js +1545 -690
  57. data/amber/js/Kernel-Exceptions.deploy.js +109 -45
  58. data/amber/js/Kernel-Exceptions.js +123 -49
  59. data/amber/js/Kernel-Methods.deploy.js +196 -81
  60. data/amber/js/Kernel-Methods.js +214 -89
  61. data/amber/js/Kernel-Objects.deploy.js +1542 -1117
  62. data/amber/js/Kernel-Objects.js +1593 -1148
  63. data/amber/js/Kernel-Tests.deploy.js +1725 -772
  64. data/amber/js/Kernel-Tests.js +2301 -1123
  65. data/amber/js/Kernel-Transcript.deploy.js +23 -25
  66. data/amber/js/Kernel-Transcript.js +24 -26
  67. data/amber/js/SUnit.deploy.js +204 -131
  68. data/amber/js/SUnit.js +222 -139
  69. data/amber/js/Spaces.deploy.js +240 -0
  70. data/amber/js/Spaces.js +326 -0
  71. data/amber/js/amber.js +26 -7
  72. data/amber/js/boot.js +65 -47
  73. data/amber/js/init.js +1 -1
  74. data/amber/js/lib/CodeMirror/amber.css +21 -21
  75. data/amber/js/lib/CodeMirror/codemirror.css +119 -13
  76. data/amber/js/lib/CodeMirror/codemirror.js +2219 -1220
  77. data/amber/js/lib/CodeMirror/smalltalk.js +134 -129
  78. data/amber/js/lib/bootstrap/css/bootstrap.css +5837 -0
  79. data/amber/js/lib/bootstrap/css/bootstrap.min.css +841 -0
  80. data/amber/js/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
  81. data/amber/js/lib/bootstrap/img/glyphicons-halflings.png +0 -0
  82. data/amber/js/lib/bootstrap/js/bootstrap.js +2038 -0
  83. data/amber/js/lib/bootstrap/js/bootstrap.min.js +7 -0
  84. data/amber/js/lib/jQuery/jquery-1.8.2.min.js +2 -0
  85. data/amber/js/lib/jQuery/jquery-ui-1.8.24.custom.min.js +125 -0
  86. data/amber/st/Compiler-AST.st +505 -0
  87. data/amber/st/Compiler-Core.st +835 -0
  88. data/amber/st/Compiler-Exceptions.st +87 -0
  89. data/amber/st/Compiler-IR.st +1097 -0
  90. data/amber/st/Compiler-Inlining.st +650 -0
  91. data/amber/st/Compiler-Semantic.st +558 -0
  92. data/amber/st/Compiler-Tests.st +285 -381
  93. data/amber/st/Compiler.st +725 -2
  94. data/amber/st/Helios-Announcements.st +104 -0
  95. data/amber/st/Helios-Browser.st +708 -0
  96. data/amber/st/Helios-Commands.st +223 -0
  97. data/amber/st/Helios-Core.st +532 -0
  98. data/amber/st/Helios-Environments.st +98 -0
  99. data/amber/st/Helios-Inspector.st +367 -0
  100. data/amber/st/Helios-KeyBindings.st +337 -0
  101. data/amber/st/Helios-Layout.st +199 -0
  102. data/amber/st/Helios-Workspace.st +367 -0
  103. data/amber/st/IDE.st +75 -53
  104. data/amber/st/Importer-Exporter.st +386 -0
  105. data/amber/st/Kernel-Announcements.st +92 -0
  106. data/amber/st/Kernel-Classes.st +137 -15
  107. data/amber/st/Kernel-Collections.st +137 -47
  108. data/amber/st/Kernel-Exceptions.st +14 -0
  109. data/amber/st/Kernel-Methods.st +9 -1
  110. data/amber/st/Kernel-Objects.st +29 -5
  111. data/amber/st/Kernel-Tests.st +545 -199
  112. data/amber/st/SUnit.st +10 -0
  113. data/amber/st/Spaces.st +142 -0
  114. data/lib/resin/app.rb +1 -1
  115. metadata +86 -31
  116. data/amber/js/lib/jQuery/jquery-1.4.4.min.js +0 -167
  117. data/amber/js/lib/jQuery/jquery-1.6.4.min.js +0 -4
@@ -0,0 +1,1514 @@
1
+ smalltalk.addPackage('Compiler-Inlining', {});
2
+ smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining');
3
+ smalltalk.IRInlinedAssignment.comment="I represent an inlined assignment instruction."
4
+ smalltalk.addMethod(
5
+ "_accept_",
6
+ smalltalk.method({
7
+ selector: "accept:",
8
+ category: 'visiting',
9
+ fn: function (aVisitor){
10
+ var self=this;
11
+ var $1;
12
+ $1=smalltalk.send(aVisitor,"_visitIRInlinedAssignment_",[self]);
13
+ return $1;
14
+ },
15
+ args: ["aVisitor"],
16
+ source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
17
+ messageSends: ["visitIRInlinedAssignment:"],
18
+ referencedClasses: []
19
+ }),
20
+ smalltalk.IRInlinedAssignment);
21
+
22
+ smalltalk.addMethod(
23
+ "_isInlined",
24
+ smalltalk.method({
25
+ selector: "isInlined",
26
+ category: 'testing',
27
+ fn: function (){
28
+ var self=this;
29
+ return true;
30
+ },
31
+ args: [],
32
+ source: "isInlined\x0a\x09^ true",
33
+ messageSends: [],
34
+ referencedClasses: []
35
+ }),
36
+ smalltalk.IRInlinedAssignment);
37
+
38
+
39
+
40
+ smalltalk.addClass('IRInlinedClosure', smalltalk.IRClosure, [], 'Compiler-Inlining');
41
+ smalltalk.IRInlinedClosure.comment="I represent an inlined closure instruction."
42
+ smalltalk.addMethod(
43
+ "_accept_",
44
+ smalltalk.method({
45
+ selector: "accept:",
46
+ category: 'visiting',
47
+ fn: function (aVisitor){
48
+ var self=this;
49
+ smalltalk.send(aVisitor,"_visitIRInlinedClosure_",[self]);
50
+ return self},
51
+ args: ["aVisitor"],
52
+ source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
53
+ messageSends: ["visitIRInlinedClosure:"],
54
+ referencedClasses: []
55
+ }),
56
+ smalltalk.IRInlinedClosure);
57
+
58
+ smalltalk.addMethod(
59
+ "_isInlined",
60
+ smalltalk.method({
61
+ selector: "isInlined",
62
+ category: 'testing',
63
+ fn: function (){
64
+ var self=this;
65
+ return true;
66
+ },
67
+ args: [],
68
+ source: "isInlined\x0a\x09^ true",
69
+ messageSends: [],
70
+ referencedClasses: []
71
+ }),
72
+ smalltalk.IRInlinedClosure);
73
+
74
+
75
+
76
+ smalltalk.addClass('IRInlinedReturn', smalltalk.IRReturn, [], 'Compiler-Inlining');
77
+ smalltalk.IRInlinedReturn.comment="I represent an inlined local return instruction."
78
+ smalltalk.addMethod(
79
+ "_accept_",
80
+ smalltalk.method({
81
+ selector: "accept:",
82
+ category: 'visiting',
83
+ fn: function (aVisitor){
84
+ var self=this;
85
+ var $1;
86
+ $1=smalltalk.send(aVisitor,"_visitIRInlinedReturn_",[self]);
87
+ return $1;
88
+ },
89
+ args: ["aVisitor"],
90
+ source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
91
+ messageSends: ["visitIRInlinedReturn:"],
92
+ referencedClasses: []
93
+ }),
94
+ smalltalk.IRInlinedReturn);
95
+
96
+ smalltalk.addMethod(
97
+ "_isInlined",
98
+ smalltalk.method({
99
+ selector: "isInlined",
100
+ category: 'testing',
101
+ fn: function (){
102
+ var self=this;
103
+ return true;
104
+ },
105
+ args: [],
106
+ source: "isInlined\x0a\x09^ true",
107
+ messageSends: [],
108
+ referencedClasses: []
109
+ }),
110
+ smalltalk.IRInlinedReturn);
111
+
112
+
113
+
114
+ smalltalk.addClass('IRInlinedNonLocalReturn', smalltalk.IRInlinedReturn, [], 'Compiler-Inlining');
115
+ smalltalk.IRInlinedNonLocalReturn.comment="I represent an inlined non local return instruction."
116
+ smalltalk.addMethod(
117
+ "_accept_",
118
+ smalltalk.method({
119
+ selector: "accept:",
120
+ category: 'visiting',
121
+ fn: function (aVisitor){
122
+ var self=this;
123
+ var $1;
124
+ $1=smalltalk.send(aVisitor,"_visitIRInlinedNonLocalReturn_",[self]);
125
+ return $1;
126
+ },
127
+ args: ["aVisitor"],
128
+ source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedNonLocalReturn: self",
129
+ messageSends: ["visitIRInlinedNonLocalReturn:"],
130
+ referencedClasses: []
131
+ }),
132
+ smalltalk.IRInlinedNonLocalReturn);
133
+
134
+ smalltalk.addMethod(
135
+ "_isInlined",
136
+ smalltalk.method({
137
+ selector: "isInlined",
138
+ category: 'testing',
139
+ fn: function (){
140
+ var self=this;
141
+ return true;
142
+ },
143
+ args: [],
144
+ source: "isInlined\x0a\x09^ true",
145
+ messageSends: [],
146
+ referencedClasses: []
147
+ }),
148
+ smalltalk.IRInlinedNonLocalReturn);
149
+
150
+
151
+
152
+ smalltalk.addClass('IRInlinedSend', smalltalk.IRSend, [], 'Compiler-Inlining');
153
+ smalltalk.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions."
154
+ smalltalk.addMethod(
155
+ "_accept_",
156
+ smalltalk.method({
157
+ selector: "accept:",
158
+ category: 'visiting',
159
+ fn: function (aVisitor){
160
+ var self=this;
161
+ smalltalk.send(aVisitor,"_visitInlinedSend_",[self]);
162
+ return self},
163
+ args: ["aVisitor"],
164
+ source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
165
+ messageSends: ["visitInlinedSend:"],
166
+ referencedClasses: []
167
+ }),
168
+ smalltalk.IRInlinedSend);
169
+
170
+ smalltalk.addMethod(
171
+ "_isInlined",
172
+ smalltalk.method({
173
+ selector: "isInlined",
174
+ category: 'testing',
175
+ fn: function (){
176
+ var self=this;
177
+ return true;
178
+ },
179
+ args: [],
180
+ source: "isInlined\x0a\x09^ true",
181
+ messageSends: [],
182
+ referencedClasses: []
183
+ }),
184
+ smalltalk.IRInlinedSend);
185
+
186
+
187
+
188
+ smalltalk.addClass('IRInlinedIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
189
+ smalltalk.addMethod(
190
+ "_accept_",
191
+ smalltalk.method({
192
+ selector: "accept:",
193
+ category: 'visiting',
194
+ fn: function (aVisitor){
195
+ var self=this;
196
+ smalltalk.send(aVisitor,"_visitIRInlinedIfFalse_",[self]);
197
+ return self},
198
+ args: ["aVisitor"],
199
+ source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
200
+ messageSends: ["visitIRInlinedIfFalse:"],
201
+ referencedClasses: []
202
+ }),
203
+ smalltalk.IRInlinedIfFalse);
204
+
205
+
206
+
207
+ smalltalk.addClass('IRInlinedIfNilIfNotNil', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
208
+ smalltalk.addMethod(
209
+ "_accept_",
210
+ smalltalk.method({
211
+ selector: "accept:",
212
+ category: 'visiting',
213
+ fn: function (aVisitor){
214
+ var self=this;
215
+ smalltalk.send(aVisitor,"_visitIRInlinedIfNilIfNotNil_",[self]);
216
+ return self},
217
+ args: ["aVisitor"],
218
+ source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
219
+ messageSends: ["visitIRInlinedIfNilIfNotNil:"],
220
+ referencedClasses: []
221
+ }),
222
+ smalltalk.IRInlinedIfNilIfNotNil);
223
+
224
+
225
+
226
+ smalltalk.addClass('IRInlinedIfTrue', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
227
+ smalltalk.addMethod(
228
+ "_accept_",
229
+ smalltalk.method({
230
+ selector: "accept:",
231
+ category: 'visiting',
232
+ fn: function (aVisitor){
233
+ var self=this;
234
+ smalltalk.send(aVisitor,"_visitIRInlinedIfTrue_",[self]);
235
+ return self},
236
+ args: ["aVisitor"],
237
+ source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
238
+ messageSends: ["visitIRInlinedIfTrue:"],
239
+ referencedClasses: []
240
+ }),
241
+ smalltalk.IRInlinedIfTrue);
242
+
243
+
244
+
245
+ smalltalk.addClass('IRInlinedIfTrueIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining');
246
+ smalltalk.addMethod(
247
+ "_accept_",
248
+ smalltalk.method({
249
+ selector: "accept:",
250
+ category: 'visiting',
251
+ fn: function (aVisitor){
252
+ var self=this;
253
+ smalltalk.send(aVisitor,"_visitIRInlinedIfTrueIfFalse_",[self]);
254
+ return self},
255
+ args: ["aVisitor"],
256
+ source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
257
+ messageSends: ["visitIRInlinedIfTrueIfFalse:"],
258
+ referencedClasses: []
259
+ }),
260
+ smalltalk.IRInlinedIfTrueIfFalse);
261
+
262
+
263
+
264
+ smalltalk.addClass('IRInlinedSequence', smalltalk.IRBlockSequence, [], 'Compiler-Inlining');
265
+ smalltalk.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`)."
266
+ smalltalk.addMethod(
267
+ "_accept_",
268
+ smalltalk.method({
269
+ selector: "accept:",
270
+ category: 'visiting',
271
+ fn: function (aVisitor){
272
+ var self=this;
273
+ smalltalk.send(aVisitor,"_visitIRInlinedSequence_",[self]);
274
+ return self},
275
+ args: ["aVisitor"],
276
+ source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
277
+ messageSends: ["visitIRInlinedSequence:"],
278
+ referencedClasses: []
279
+ }),
280
+ smalltalk.IRInlinedSequence);
281
+
282
+ smalltalk.addMethod(
283
+ "_isInlined",
284
+ smalltalk.method({
285
+ selector: "isInlined",
286
+ category: 'testing',
287
+ fn: function (){
288
+ var self=this;
289
+ return true;
290
+ },
291
+ args: [],
292
+ source: "isInlined\x0a\x09^ true",
293
+ messageSends: [],
294
+ referencedClasses: []
295
+ }),
296
+ smalltalk.IRInlinedSequence);
297
+
298
+
299
+
300
+ smalltalk.addClass('IRInliner', smalltalk.IRVisitor, [], 'Compiler-Inlining');
301
+ smalltalk.IRInliner.comment="I visit an IR tree, inlining message sends and block closures.\x0a\x0aMessage selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`"
302
+ smalltalk.addMethod(
303
+ "_assignmentInliner",
304
+ smalltalk.method({
305
+ selector: "assignmentInliner",
306
+ category: 'factory',
307
+ fn: function (){
308
+ var self=this;
309
+ var $2,$3,$1;
310
+ $2=smalltalk.send((smalltalk.IRAssignmentInliner || IRAssignmentInliner),"_new",[]);
311
+ smalltalk.send($2,"_translator_",[self]);
312
+ $3=smalltalk.send($2,"_yourself",[]);
313
+ $1=$3;
314
+ return $1;
315
+ },
316
+ args: [],
317
+ source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
318
+ messageSends: ["translator:", "new", "yourself"],
319
+ referencedClasses: ["IRAssignmentInliner"]
320
+ }),
321
+ smalltalk.IRInliner);
322
+
323
+ smalltalk.addMethod(
324
+ "_nonLocalReturnInliner",
325
+ smalltalk.method({
326
+ selector: "nonLocalReturnInliner",
327
+ category: 'factory',
328
+ fn: function (){
329
+ var self=this;
330
+ var $2,$3,$1;
331
+ $2=smalltalk.send((smalltalk.IRNonLocalReturnInliner || IRNonLocalReturnInliner),"_new",[]);
332
+ smalltalk.send($2,"_translator_",[self]);
333
+ $3=smalltalk.send($2,"_yourself",[]);
334
+ $1=$3;
335
+ return $1;
336
+ },
337
+ args: [],
338
+ source: "nonLocalReturnInliner\x0a\x09^ IRNonLocalReturnInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
339
+ messageSends: ["translator:", "new", "yourself"],
340
+ referencedClasses: ["IRNonLocalReturnInliner"]
341
+ }),
342
+ smalltalk.IRInliner);
343
+
344
+ smalltalk.addMethod(
345
+ "_returnInliner",
346
+ smalltalk.method({
347
+ selector: "returnInliner",
348
+ category: 'factory',
349
+ fn: function (){
350
+ var self=this;
351
+ var $2,$3,$1;
352
+ $2=smalltalk.send((smalltalk.IRReturnInliner || IRReturnInliner),"_new",[]);
353
+ smalltalk.send($2,"_translator_",[self]);
354
+ $3=smalltalk.send($2,"_yourself",[]);
355
+ $1=$3;
356
+ return $1;
357
+ },
358
+ args: [],
359
+ source: "returnInliner\x0a\x09^ IRReturnInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
360
+ messageSends: ["translator:", "new", "yourself"],
361
+ referencedClasses: ["IRReturnInliner"]
362
+ }),
363
+ smalltalk.IRInliner);
364
+
365
+ smalltalk.addMethod(
366
+ "_sendInliner",
367
+ smalltalk.method({
368
+ selector: "sendInliner",
369
+ category: 'factory',
370
+ fn: function (){
371
+ var self=this;
372
+ var $2,$3,$1;
373
+ $2=smalltalk.send((smalltalk.IRSendInliner || IRSendInliner),"_new",[]);
374
+ smalltalk.send($2,"_translator_",[self]);
375
+ $3=smalltalk.send($2,"_yourself",[]);
376
+ $1=$3;
377
+ return $1;
378
+ },
379
+ args: [],
380
+ source: "sendInliner\x0a\x09^ IRSendInliner new \x0a\x09\x09translator: self;\x0a\x09\x09yourself",
381
+ messageSends: ["translator:", "new", "yourself"],
382
+ referencedClasses: ["IRSendInliner"]
383
+ }),
384
+ smalltalk.IRInliner);
385
+
386
+ smalltalk.addMethod(
387
+ "_shouldInlineAssignment_",
388
+ smalltalk.method({
389
+ selector: "shouldInlineAssignment:",
390
+ category: 'testing',
391
+ fn: function (anIRAssignment){
392
+ var self=this;
393
+ var $1;
394
+ $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment,"_isInlined",[]),"_not",[]),"_and_",[(function(){
395
+ return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[]),"_isSend",[]),"_and_",[(function(){
396
+ return smalltalk.send(self,"_shouldInlineSend_",[smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_last",[])]);
397
+ })]);
398
+ })]);
399
+ return $1;
400
+ },
401
+ args: ["anIRAssignment"],
402
+ source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [ \x0a\x09\x09anIRAssignment instructions last isSend and: [\x09\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
403
+ messageSends: ["and:", "shouldInlineSend:", "last", "instructions", "isSend", "not", "isInlined"],
404
+ referencedClasses: []
405
+ }),
406
+ smalltalk.IRInliner);
407
+
408
+ smalltalk.addMethod(
409
+ "_shouldInlineReturn_",
410
+ smalltalk.method({
411
+ selector: "shouldInlineReturn:",
412
+ category: 'testing',
413
+ fn: function (anIRReturn){
414
+ var self=this;
415
+ var $1;
416
+ $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRReturn,"_isInlined",[]),"_not",[]),"_and_",[(function(){
417
+ return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_first",[]),"_isSend",[]),"_and_",[(function(){
418
+ return smalltalk.send(self,"_shouldInlineSend_",[smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_first",[])]);
419
+ })]);
420
+ })]);
421
+ return $1;
422
+ },
423
+ args: ["anIRReturn"],
424
+ source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [ \x0a\x09\x09anIRReturn instructions first isSend and: [\x09\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
425
+ messageSends: ["and:", "shouldInlineSend:", "first", "instructions", "isSend", "not", "isInlined"],
426
+ referencedClasses: []
427
+ }),
428
+ smalltalk.IRInliner);
429
+
430
+ smalltalk.addMethod(
431
+ "_shouldInlineSend_",
432
+ smalltalk.method({
433
+ selector: "shouldInlineSend:",
434
+ category: 'testing',
435
+ fn: function (anIRSend){
436
+ var self=this;
437
+ var $1;
438
+ $1=smalltalk.send(smalltalk.send(smalltalk.send(anIRSend,"_isInlined",[]),"_not",[]),"_and_",[(function(){
439
+ return smalltalk.send((smalltalk.IRSendInliner || IRSendInliner),"_shouldInline_",[anIRSend]);
440
+ })]);
441
+ return $1;
442
+ },
443
+ args: ["anIRSend"],
444
+ source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
445
+ messageSends: ["and:", "shouldInline:", "not", "isInlined"],
446
+ referencedClasses: ["IRSendInliner"]
447
+ }),
448
+ smalltalk.IRInliner);
449
+
450
+ smalltalk.addMethod(
451
+ "_transformNonLocalReturn_",
452
+ smalltalk.method({
453
+ selector: "transformNonLocalReturn:",
454
+ category: 'visiting',
455
+ fn: function (anIRNonLocalReturn){
456
+ var self=this;
457
+ var $1,$2,$3,$4;
458
+ var localReturn;
459
+ $1=smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_scope",[]),"_canInlineNonLocalReturns",[]);
460
+ if(smalltalk.assert($1)){
461
+ smalltalk.send(smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_scope",[]),"_methodScope",[]),"_removeNonLocalReturn_",[smalltalk.send(anIRNonLocalReturn,"_scope",[])]);
462
+ $2=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
463
+ smalltalk.send($2,"_scope_",[smalltalk.send(anIRNonLocalReturn,"_scope",[])]);
464
+ $3=smalltalk.send($2,"_yourself",[]);
465
+ localReturn=$3;
466
+ localReturn;
467
+ smalltalk.send(smalltalk.send(anIRNonLocalReturn,"_instructions",[]),"_do_",[(function(each){
468
+ return smalltalk.send(localReturn,"_add_",[each]);
469
+ })]);
470
+ smalltalk.send(anIRNonLocalReturn,"_replaceWith_",[localReturn]);
471
+ return localReturn;
472
+ };
473
+ $4=smalltalk.send(self,"_visitIRNonLocalReturn_",[anIRNonLocalReturn],smalltalk.IRVisitor);
474
+ return $4;
475
+ },
476
+ args: ["anIRNonLocalReturn"],
477
+ source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
478
+ messageSends: ["ifTrue:", "removeNonLocalReturn:", "scope", "methodScope", "scope:", "new", "yourself", "do:", "add:", "instructions", "replaceWith:", "canInlineNonLocalReturns", "visitIRNonLocalReturn:"],
479
+ referencedClasses: ["IRReturn"]
480
+ }),
481
+ smalltalk.IRInliner);
482
+
483
+ smalltalk.addMethod(
484
+ "_visitIRAssignment_",
485
+ smalltalk.method({
486
+ selector: "visitIRAssignment:",
487
+ category: 'visiting',
488
+ fn: function (anIRAssignment){
489
+ var self=this;
490
+ var $2,$1;
491
+ $2=smalltalk.send(self,"_shouldInlineAssignment_",[anIRAssignment]);
492
+ if(smalltalk.assert($2)){
493
+ $1=smalltalk.send(smalltalk.send(self,"_assignmentInliner",[]),"_inlineAssignment_",[anIRAssignment]);
494
+ } else {
495
+ $1=smalltalk.send(self,"_visitIRAssignment_",[anIRAssignment],smalltalk.IRVisitor);
496
+ };
497
+ return $1;
498
+ },
499
+ args: ["anIRAssignment"],
500
+ source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment) \x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
501
+ messageSends: ["ifTrue:ifFalse:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:", "shouldInlineAssignment:"],
502
+ referencedClasses: []
503
+ }),
504
+ smalltalk.IRInliner);
505
+
506
+ smalltalk.addMethod(
507
+ "_visitIRNonLocalReturn_",
508
+ smalltalk.method({
509
+ selector: "visitIRNonLocalReturn:",
510
+ category: 'visiting',
511
+ fn: function (anIRNonLocalReturn){
512
+ var self=this;
513
+ var $2,$1;
514
+ $2=smalltalk.send(self,"_shouldInlineReturn_",[anIRNonLocalReturn]);
515
+ if(smalltalk.assert($2)){
516
+ $1=smalltalk.send(smalltalk.send(self,"_nonLocalReturnInliner",[]),"_inlineReturn_",[anIRNonLocalReturn]);
517
+ } else {
518
+ $1=smalltalk.send(self,"_transformNonLocalReturn_",[anIRNonLocalReturn]);
519
+ };
520
+ return $1;
521
+ },
522
+ args: ["anIRNonLocalReturn"],
523
+ source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ (self shouldInlineReturn: anIRNonLocalReturn) \x0a\x09\x09ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]\x0a\x09\x09ifFalse: [ self transformNonLocalReturn: anIRNonLocalReturn ]",
524
+ messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "nonLocalReturnInliner", "transformNonLocalReturn:", "shouldInlineReturn:"],
525
+ referencedClasses: []
526
+ }),
527
+ smalltalk.IRInliner);
528
+
529
+ smalltalk.addMethod(
530
+ "_visitIRReturn_",
531
+ smalltalk.method({
532
+ selector: "visitIRReturn:",
533
+ category: 'visiting',
534
+ fn: function (anIRReturn){
535
+ var self=this;
536
+ var $2,$1;
537
+ $2=smalltalk.send(self,"_shouldInlineReturn_",[anIRReturn]);
538
+ if(smalltalk.assert($2)){
539
+ $1=smalltalk.send(smalltalk.send(self,"_returnInliner",[]),"_inlineReturn_",[anIRReturn]);
540
+ } else {
541
+ $1=smalltalk.send(self,"_visitIRReturn_",[anIRReturn],smalltalk.IRVisitor);
542
+ };
543
+ return $1;
544
+ },
545
+ args: ["anIRReturn"],
546
+ source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn) \x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
547
+ messageSends: ["ifTrue:ifFalse:", "inlineReturn:", "returnInliner", "visitIRReturn:", "shouldInlineReturn:"],
548
+ referencedClasses: []
549
+ }),
550
+ smalltalk.IRInliner);
551
+
552
+ smalltalk.addMethod(
553
+ "_visitIRSend_",
554
+ smalltalk.method({
555
+ selector: "visitIRSend:",
556
+ category: 'visiting',
557
+ fn: function (anIRSend){
558
+ var self=this;
559
+ var $2,$1;
560
+ $2=smalltalk.send(self,"_shouldInlineSend_",[anIRSend]);
561
+ if(smalltalk.assert($2)){
562
+ $1=smalltalk.send(smalltalk.send(self,"_sendInliner",[]),"_inlineSend_",[anIRSend]);
563
+ } else {
564
+ $1=smalltalk.send(self,"_visitIRSend_",[anIRSend],smalltalk.IRVisitor);
565
+ };
566
+ return $1;
567
+ },
568
+ args: ["anIRSend"],
569
+ source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
570
+ messageSends: ["ifTrue:ifFalse:", "inlineSend:", "sendInliner", "visitIRSend:", "shouldInlineSend:"],
571
+ referencedClasses: []
572
+ }),
573
+ smalltalk.IRInliner);
574
+
575
+
576
+
577
+ smalltalk.addClass('IRInliningJSTranslator', smalltalk.IRJSTranslator, [], 'Compiler-Inlining');
578
+ smalltalk.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance)."
579
+ smalltalk.addMethod(
580
+ "_visitIRInlinedAssignment_",
581
+ smalltalk.method({
582
+ selector: "visitIRInlinedAssignment:",
583
+ category: 'visiting',
584
+ fn: function (anIRInlinedAssignment){
585
+ var self=this;
586
+ smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedAssignment,"_instructions",[]),"_last",[])]);
587
+ return self},
588
+ args: ["anIRInlinedAssignment"],
589
+ source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
590
+ messageSends: ["visit:", "last", "instructions"],
591
+ referencedClasses: []
592
+ }),
593
+ smalltalk.IRInliningJSTranslator);
594
+
595
+ smalltalk.addMethod(
596
+ "_visitIRInlinedClosure_",
597
+ smalltalk.method({
598
+ selector: "visitIRInlinedClosure:",
599
+ category: 'visiting',
600
+ fn: function (anIRInlinedClosure){
601
+ var self=this;
602
+ smalltalk.send(smalltalk.send(anIRInlinedClosure,"_instructions",[]),"_do_",[(function(each){
603
+ return smalltalk.send(self,"_visit_",[each]);
604
+ })]);
605
+ return self},
606
+ args: ["anIRInlinedClosure"],
607
+ source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
608
+ messageSends: ["do:", "visit:", "instructions"],
609
+ referencedClasses: []
610
+ }),
611
+ smalltalk.IRInliningJSTranslator);
612
+
613
+ smalltalk.addMethod(
614
+ "_visitIRInlinedIfFalse_",
615
+ smalltalk.method({
616
+ selector: "visitIRInlinedIfFalse:",
617
+ category: 'visiting',
618
+ fn: function (anIRInlinedIfFalse){
619
+ var self=this;
620
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
621
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["! smalltalk.assert("]);
622
+ smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfFalse,"_instructions",[]),"_first",[])]);
623
+ return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
624
+ }),(function(){
625
+ return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfFalse,"_instructions",[]),"_last",[])]);
626
+ })]);
627
+ return self},
628
+ args: ["anIRInlinedIfFalse"],
629
+ source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [ \x0a\x09\x09self stream nextPutAll: '! smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
630
+ messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
631
+ referencedClasses: []
632
+ }),
633
+ smalltalk.IRInliningJSTranslator);
634
+
635
+ smalltalk.addMethod(
636
+ "_visitIRInlinedIfNil_",
637
+ smalltalk.method({
638
+ selector: "visitIRInlinedIfNil:",
639
+ category: 'visiting',
640
+ fn: function (anIRInlinedIfNil){
641
+ var self=this;
642
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
643
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["($receiver = "]);
644
+ smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNil,"_instructions",[]),"_first",[])]);
645
+ return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[") == nil || $receiver == undefined"]);
646
+ }),(function(){
647
+ return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNil,"_instructions",[]),"_last",[])]);
648
+ })]);
649
+ return self},
650
+ args: ["anIRInlinedIfNil"],
651
+ source: "visitIRInlinedIfNil: anIRInlinedIfNil\x0a\x09self stream nextPutIf: [ \x0a\x09\x09self stream nextPutAll: '($receiver = '. \x0a\x09\x09self visit: anIRInlinedIfNil instructions first.\x0a\x09\x09self stream nextPutAll: ') == nil || $receiver == undefined' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNil instructions last ]",
652
+ messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
653
+ referencedClasses: []
654
+ }),
655
+ smalltalk.IRInliningJSTranslator);
656
+
657
+ smalltalk.addMethod(
658
+ "_visitIRInlinedIfNilIfNotNil_",
659
+ smalltalk.method({
660
+ selector: "visitIRInlinedIfNilIfNotNil:",
661
+ category: 'visiting',
662
+ fn: function (anIRInlinedIfNilIfNotNil){
663
+ var self=this;
664
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIfElse_with_with_",[(function(){
665
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["($receiver = "]);
666
+ smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNilIfNotNil,"_instructions",[]),"_first",[])]);
667
+ return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[") == nil || $receiver == undefined"]);
668
+ }),(function(){
669
+ return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNilIfNotNil,"_instructions",[]),"_second",[])]);
670
+ }),(function(){
671
+ return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfNilIfNotNil,"_instructions",[]),"_third",[])]);
672
+ })]);
673
+ return self},
674
+ args: ["anIRInlinedIfNilIfNotNil"],
675
+ source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream \x0a\x09\x09nextPutIfElse: [ \x0a\x09\x09\x09self stream nextPutAll: '($receiver = '. \x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == nil || $receiver == undefined' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
676
+ messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"],
677
+ referencedClasses: []
678
+ }),
679
+ smalltalk.IRInliningJSTranslator);
680
+
681
+ smalltalk.addMethod(
682
+ "_visitIRInlinedIfTrue_",
683
+ smalltalk.method({
684
+ selector: "visitIRInlinedIfTrue:",
685
+ category: 'visiting',
686
+ fn: function (anIRInlinedIfTrue){
687
+ var self=this;
688
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIf_with_",[(function(){
689
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.assert("]);
690
+ smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrue,"_instructions",[]),"_first",[])]);
691
+ return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
692
+ }),(function(){
693
+ return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrue,"_instructions",[]),"_last",[])]);
694
+ })]);
695
+ return self},
696
+ args: ["anIRInlinedIfTrue"],
697
+ source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [ \x0a\x09\x09self stream nextPutAll: 'smalltalk.assert('. \x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
698
+ messageSends: ["nextPutIf:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "last"],
699
+ referencedClasses: []
700
+ }),
701
+ smalltalk.IRInliningJSTranslator);
702
+
703
+ smalltalk.addMethod(
704
+ "_visitIRInlinedIfTrueIfFalse_",
705
+ smalltalk.method({
706
+ selector: "visitIRInlinedIfTrueIfFalse:",
707
+ category: 'visiting',
708
+ fn: function (anIRInlinedIfTrueIfFalse){
709
+ var self=this;
710
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutIfElse_with_with_",[(function(){
711
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",["smalltalk.assert("]);
712
+ smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrueIfFalse,"_instructions",[]),"_first",[])]);
713
+ return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutAll_",[")"]);
714
+ }),(function(){
715
+ return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrueIfFalse,"_instructions",[]),"_second",[])]);
716
+ }),(function(){
717
+ return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedIfTrueIfFalse,"_instructions",[]),"_third",[])]);
718
+ })]);
719
+ return self},
720
+ args: ["anIRInlinedIfTrueIfFalse"],
721
+ source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream \x0a\x09\x09nextPutIfElse: [ \x0a\x09\x09\x09self stream nextPutAll: 'smalltalk.assert('. \x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
722
+ messageSends: ["nextPutIfElse:with:with:", "nextPutAll:", "stream", "visit:", "first", "instructions", "second", "third"],
723
+ referencedClasses: []
724
+ }),
725
+ smalltalk.IRInliningJSTranslator);
726
+
727
+ smalltalk.addMethod(
728
+ "_visitIRInlinedNonLocalReturn_",
729
+ smalltalk.method({
730
+ selector: "visitIRInlinedNonLocalReturn:",
731
+ category: 'visiting',
732
+ fn: function (anIRInlinedReturn){
733
+ var self=this;
734
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
735
+ return smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedReturn,"_instructions",[]),"_last",[])]);
736
+ })]);
737
+ smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutNonLocalReturnWith_",[(function(){
738
+ })]);
739
+ return self},
740
+ args: ["anIRInlinedReturn"],
741
+ source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
742
+ messageSends: ["nextPutStatementWith:", "visit:", "last", "instructions", "stream", "nextPutNonLocalReturnWith:"],
743
+ referencedClasses: []
744
+ }),
745
+ smalltalk.IRInliningJSTranslator);
746
+
747
+ smalltalk.addMethod(
748
+ "_visitIRInlinedReturn_",
749
+ smalltalk.method({
750
+ selector: "visitIRInlinedReturn:",
751
+ category: 'visiting',
752
+ fn: function (anIRInlinedReturn){
753
+ var self=this;
754
+ smalltalk.send(self,"_visit_",[smalltalk.send(smalltalk.send(anIRInlinedReturn,"_instructions",[]),"_last",[])]);
755
+ return self},
756
+ args: ["anIRInlinedReturn"],
757
+ source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
758
+ messageSends: ["visit:", "last", "instructions"],
759
+ referencedClasses: []
760
+ }),
761
+ smalltalk.IRInliningJSTranslator);
762
+
763
+ smalltalk.addMethod(
764
+ "_visitIRInlinedSequence_",
765
+ smalltalk.method({
766
+ selector: "visitIRInlinedSequence:",
767
+ category: 'visiting',
768
+ fn: function (anIRInlinedSequence){
769
+ var self=this;
770
+ smalltalk.send(smalltalk.send(anIRInlinedSequence,"_instructions",[]),"_do_",[(function(each){
771
+ return smalltalk.send(smalltalk.send(self,"_stream",[]),"_nextPutStatementWith_",[(function(){
772
+ return smalltalk.send(self,"_visit_",[each]);
773
+ })]);
774
+ })]);
775
+ return self},
776
+ args: ["anIRInlinedSequence"],
777
+ source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each | \x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
778
+ messageSends: ["do:", "nextPutStatementWith:", "visit:", "stream", "instructions"],
779
+ referencedClasses: []
780
+ }),
781
+ smalltalk.IRInliningJSTranslator);
782
+
783
+
784
+
785
+ smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining');
786
+ smalltalk.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods."
787
+ smalltalk.addMethod(
788
+ "_ifFalse_",
789
+ smalltalk.method({
790
+ selector: "ifFalse:",
791
+ category: 'inlining',
792
+ fn: function (anIRInstruction){
793
+ var self=this;
794
+ var $1;
795
+ $1=smalltalk.send(self,"_inlinedSend_with_",[smalltalk.send((smalltalk.IRInlinedIfFalse || IRInlinedIfFalse),"_new",[]),anIRInstruction]);
796
+ return $1;
797
+ },
798
+ args: ["anIRInstruction"],
799
+ source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
800
+ messageSends: ["inlinedSend:with:", "new"],
801
+ referencedClasses: ["IRInlinedIfFalse"]
802
+ }),
803
+ smalltalk.IRSendInliner);
804
+
805
+ smalltalk.addMethod(
806
+ "_ifFalse_ifTrue_",
807
+ smalltalk.method({
808
+ selector: "ifFalse:ifTrue:",
809
+ category: 'inlining',
810
+ fn: function (anIRInstruction,anotherIRInstruction){
811
+ var self=this;
812
+ var $1;
813
+ $1=smalltalk.send(self,"_perform_withArguments_",[smalltalk.symbolFor("ifTrue:ifFalse:"),[anotherIRInstruction,anIRInstruction]]);
814
+ return $1;
815
+ },
816
+ args: ["anIRInstruction", "anotherIRInstruction"],
817
+ source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
818
+ messageSends: ["perform:withArguments:"],
819
+ referencedClasses: []
820
+ }),
821
+ smalltalk.IRSendInliner);
822
+
823
+ smalltalk.addMethod(
824
+ "_ifNil_",
825
+ smalltalk.method({
826
+ selector: "ifNil:",
827
+ category: 'inlining',
828
+ fn: function (anIRInstruction){
829
+ var self=this;
830
+ var $2,$3,$4,$5,$1;
831
+ $2=smalltalk.send((smalltalk.IRClosure || IRClosure),"_new",[]);
832
+ smalltalk.send($2,"_scope_",[smalltalk.send(smalltalk.send(anIRInstruction,"_scope",[]),"_copy",[])]);
833
+ $3=smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence),"_new",[]);
834
+ smalltalk.send($3,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
835
+ $4=smalltalk.send($3,"_yourself",[]);
836
+ smalltalk.send($2,"_add_",[$4]);
837
+ $5=smalltalk.send($2,"_yourself",[]);
838
+ $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),anIRInstruction,$5]);
839
+ return $1;
840
+ },
841
+ args: ["anIRInstruction"],
842
+ source: "ifNil: anIRInstruction\x0a\x09^ self \x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new \x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
843
+ messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
844
+ referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
845
+ }),
846
+ smalltalk.IRSendInliner);
847
+
848
+ smalltalk.addMethod(
849
+ "_ifNil_ifNotNil_",
850
+ smalltalk.method({
851
+ selector: "ifNil:ifNotNil:",
852
+ category: 'inlining',
853
+ fn: function (anIRInstruction,anotherIRInstruction){
854
+ var self=this;
855
+ var $1;
856
+ $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),anIRInstruction,anotherIRInstruction]);
857
+ return $1;
858
+ },
859
+ args: ["anIRInstruction", "anotherIRInstruction"],
860
+ source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
861
+ messageSends: ["inlinedSend:with:with:", "new"],
862
+ referencedClasses: ["IRInlinedIfNilIfNotNil"]
863
+ }),
864
+ smalltalk.IRSendInliner);
865
+
866
+ smalltalk.addMethod(
867
+ "_ifNotNil_",
868
+ smalltalk.method({
869
+ selector: "ifNotNil:",
870
+ category: 'inlining',
871
+ fn: function (anIRInstruction){
872
+ var self=this;
873
+ var $2,$3,$4,$5,$1;
874
+ $2=smalltalk.send((smalltalk.IRClosure || IRClosure),"_new",[]);
875
+ smalltalk.send($2,"_scope_",[smalltalk.send(smalltalk.send(anIRInstruction,"_scope",[]),"_copy",[])]);
876
+ $3=smalltalk.send((smalltalk.IRBlockSequence || IRBlockSequence),"_new",[]);
877
+ smalltalk.send($3,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
878
+ $4=smalltalk.send($3,"_yourself",[]);
879
+ smalltalk.send($2,"_add_",[$4]);
880
+ $5=smalltalk.send($2,"_yourself",[]);
881
+ $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),$5,anIRInstruction]);
882
+ return $1;
883
+ },
884
+ args: ["anIRInstruction"],
885
+ source: "ifNotNil: anIRInstruction\x0a\x09^ self \x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09with: anIRInstruction",
886
+ messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
887
+ referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
888
+ }),
889
+ smalltalk.IRSendInliner);
890
+
891
+ smalltalk.addMethod(
892
+ "_ifNotNil_ifNil_",
893
+ smalltalk.method({
894
+ selector: "ifNotNil:ifNil:",
895
+ category: 'inlining',
896
+ fn: function (anIRInstruction,anotherIRInstruction){
897
+ var self=this;
898
+ var $1;
899
+ $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil),"_new",[]),anotherIRInstruction,anIRInstruction]);
900
+ return $1;
901
+ },
902
+ args: ["anIRInstruction", "anotherIRInstruction"],
903
+ source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
904
+ messageSends: ["inlinedSend:with:with:", "new"],
905
+ referencedClasses: ["IRInlinedIfNilIfNotNil"]
906
+ }),
907
+ smalltalk.IRSendInliner);
908
+
909
+ smalltalk.addMethod(
910
+ "_ifTrue_",
911
+ smalltalk.method({
912
+ selector: "ifTrue:",
913
+ category: 'inlining',
914
+ fn: function (anIRInstruction){
915
+ var self=this;
916
+ var $1;
917
+ $1=smalltalk.send(self,"_inlinedSend_with_",[smalltalk.send((smalltalk.IRInlinedIfTrue || IRInlinedIfTrue),"_new",[]),anIRInstruction]);
918
+ return $1;
919
+ },
920
+ args: ["anIRInstruction"],
921
+ source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
922
+ messageSends: ["inlinedSend:with:", "new"],
923
+ referencedClasses: ["IRInlinedIfTrue"]
924
+ }),
925
+ smalltalk.IRSendInliner);
926
+
927
+ smalltalk.addMethod(
928
+ "_ifTrue_ifFalse_",
929
+ smalltalk.method({
930
+ selector: "ifTrue:ifFalse:",
931
+ category: 'inlining',
932
+ fn: function (anIRInstruction,anotherIRInstruction){
933
+ var self=this;
934
+ var $1;
935
+ $1=smalltalk.send(self,"_inlinedSend_with_with_",[smalltalk.send((smalltalk.IRInlinedIfTrueIfFalse || IRInlinedIfTrueIfFalse),"_new",[]),anIRInstruction,anotherIRInstruction]);
936
+ return $1;
937
+ },
938
+ args: ["anIRInstruction", "anotherIRInstruction"],
939
+ source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
940
+ messageSends: ["inlinedSend:with:with:", "new"],
941
+ referencedClasses: ["IRInlinedIfTrueIfFalse"]
942
+ }),
943
+ smalltalk.IRSendInliner);
944
+
945
+ smalltalk.addMethod(
946
+ "_inlineClosure_",
947
+ smalltalk.method({
948
+ selector: "inlineClosure:",
949
+ category: 'inlining',
950
+ fn: function (anIRClosure){
951
+ var self=this;
952
+ var $1,$2;
953
+ var inlinedClosure;
954
+ var sequence;
955
+ var statements;
956
+ inlinedClosure=smalltalk.send(self,"_inlinedClosure",[]);
957
+ smalltalk.send(inlinedClosure,"_scope_",[smalltalk.send(anIRClosure,"_scope",[])]);
958
+ smalltalk.send(smalltalk.send(anIRClosure,"_instructions",[]),"_do_",[(function(each){
959
+ $1=smalltalk.send(each,"_isSequence",[]);
960
+ if(! smalltalk.assert($1)){
961
+ return smalltalk.send(inlinedClosure,"_add_",[each]);
962
+ };
963
+ })]);
964
+ sequence=smalltalk.send(self,"_inlinedSequence",[]);
965
+ smalltalk.send(inlinedClosure,"_add_",[sequence]);
966
+ statements=smalltalk.send(smalltalk.send(smalltalk.send(anIRClosure,"_instructions",[]),"_last",[]),"_instructions",[]);
967
+ smalltalk.send(statements,"_ifNotEmpty_",[(function(){
968
+ smalltalk.send(smalltalk.send(statements,"_allButLast",[]),"_do_",[(function(each){
969
+ return smalltalk.send(sequence,"_add_",[each]);
970
+ })]);
971
+ $2=smalltalk.send(smalltalk.send(smalltalk.send(statements,"_last",[]),"_isReturn",[]),"_and_",[(function(){
972
+ return smalltalk.send(smalltalk.send(statements,"_last",[]),"_isBlockReturn",[]);
973
+ })]);
974
+ if(smalltalk.assert($2)){
975
+ return smalltalk.send(sequence,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(statements,"_last",[]),"_instructions",[]),"_first",[])]);
976
+ } else {
977
+ return smalltalk.send(sequence,"_add_",[smalltalk.send(statements,"_last",[])]);
978
+ };
979
+ })]);
980
+ return inlinedClosure;
981
+ },
982
+ args: ["anIRClosure"],
983
+ source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure scope: anIRClosure scope.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure instructions do: [ :each | \x0a\x09\x09each isSequence ifFalse: [\x0a\x09\x09\x09inlinedClosure add: each ]].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
984
+ messageSends: ["inlinedClosure", "scope:", "scope", "do:", "ifFalse:", "add:", "isSequence", "instructions", "inlinedSequence", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "first", "and:", "isBlockReturn", "isReturn"],
985
+ referencedClasses: []
986
+ }),
987
+ smalltalk.IRSendInliner);
988
+
989
+ smalltalk.addMethod(
990
+ "_inlineSend_",
991
+ smalltalk.method({
992
+ selector: "inlineSend:",
993
+ category: 'inlining',
994
+ fn: function (anIRSend){
995
+ var self=this;
996
+ var $1;
997
+ smalltalk.send(self,"_send_",[anIRSend]);
998
+ $1=smalltalk.send(self,"_perform_withArguments_",[smalltalk.send(smalltalk.send(self,"_send",[]),"_selector",[]),smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_allButFirst",[])]);
999
+ return $1;
1000
+ },
1001
+ args: ["anIRSend"],
1002
+ source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self \x0a\x09\x09perform: self send selector \x0a\x09\x09withArguments: self send instructions allButFirst",
1003
+ messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
1004
+ referencedClasses: []
1005
+ }),
1006
+ smalltalk.IRSendInliner);
1007
+
1008
+ smalltalk.addMethod(
1009
+ "_inlinedClosure",
1010
+ smalltalk.method({
1011
+ selector: "inlinedClosure",
1012
+ category: 'factory',
1013
+ fn: function (){
1014
+ var self=this;
1015
+ var $1;
1016
+ $1=smalltalk.send((smalltalk.IRInlinedClosure || IRInlinedClosure),"_new",[]);
1017
+ return $1;
1018
+ },
1019
+ args: [],
1020
+ source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
1021
+ messageSends: ["new"],
1022
+ referencedClasses: ["IRInlinedClosure"]
1023
+ }),
1024
+ smalltalk.IRSendInliner);
1025
+
1026
+ smalltalk.addMethod(
1027
+ "_inlinedSend_with_",
1028
+ smalltalk.method({
1029
+ selector: "inlinedSend:with:",
1030
+ category: 'inlining',
1031
+ fn: function (inlinedSend,anIRInstruction){
1032
+ var self=this;
1033
+ var $1,$2,$3;
1034
+ var inlinedClosure;
1035
+ $1=smalltalk.send(anIRInstruction,"_isClosure",[]);
1036
+ if(! smalltalk.assert($1)){
1037
+ smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
1038
+ };
1039
+ $2=smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]);
1040
+ if(! smalltalk.assert($2)){
1041
+ smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
1042
+ };
1043
+ inlinedClosure=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(self,"_inlineClosure_",[anIRInstruction])]);
1044
+ smalltalk.send(inlinedSend,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
1045
+ $3=smalltalk.send(inlinedSend,"_add_",[inlinedClosure]);
1046
+ smalltalk.send(smalltalk.send(self,"_send",[]),"_replaceWith_",[inlinedSend]);
1047
+ return inlinedSend;
1048
+ },
1049
+ args: ["inlinedSend", "anIRInstruction"],
1050
+ source: "inlinedSend: inlinedSend with: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x0a\x09^ inlinedSend",
1051
+ messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"],
1052
+ referencedClasses: []
1053
+ }),
1054
+ smalltalk.IRSendInliner);
1055
+
1056
+ smalltalk.addMethod(
1057
+ "_inlinedSend_with_with_",
1058
+ smalltalk.method({
1059
+ selector: "inlinedSend:with:with:",
1060
+ category: 'inlining',
1061
+ fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
1062
+ var self=this;
1063
+ var $1,$2,$3,$4,$5;
1064
+ var inlinedClosure1;
1065
+ var inlinedClosure2;
1066
+ $1=smalltalk.send(anIRInstruction,"_isClosure",[]);
1067
+ if(! smalltalk.assert($1)){
1068
+ smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
1069
+ };
1070
+ $2=smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]);
1071
+ if(! smalltalk.assert($2)){
1072
+ smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
1073
+ };
1074
+ $3=smalltalk.send(anotherIRInstruction,"_isClosure",[]);
1075
+ if(! smalltalk.assert($3)){
1076
+ smalltalk.send(self,"_inliningError_",["Message argument should be a block"]);
1077
+ };
1078
+ $4=smalltalk.send(smalltalk.send(smalltalk.send(anotherIRInstruction,"_arguments",[]),"_size",[]),"__eq",[(0)]);
1079
+ if(! smalltalk.assert($4)){
1080
+ smalltalk.send(self,"_inliningError_",["Inlined block should have zero argument"]);
1081
+ };
1082
+ inlinedClosure1=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(self,"_inlineClosure_",[anIRInstruction])]);
1083
+ inlinedClosure2=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[smalltalk.send(self,"_inlineClosure_",[anotherIRInstruction])]);
1084
+ smalltalk.send(inlinedSend,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_send",[]),"_instructions",[]),"_first",[])]);
1085
+ smalltalk.send(inlinedSend,"_add_",[inlinedClosure1]);
1086
+ $5=smalltalk.send(inlinedSend,"_add_",[inlinedClosure2]);
1087
+ smalltalk.send(smalltalk.send(self,"_send",[]),"_replaceWith_",[inlinedSend]);
1088
+ return inlinedSend;
1089
+ },
1090
+ args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
1091
+ source: "inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09^ inlinedSend",
1092
+ messageSends: ["ifFalse:", "inliningError:", "isClosure", "=", "size", "arguments", "visit:", "inlineClosure:", "translator", "add:", "first", "instructions", "send", "replaceWith:"],
1093
+ referencedClasses: []
1094
+ }),
1095
+ smalltalk.IRSendInliner);
1096
+
1097
+ smalltalk.addMethod(
1098
+ "_inlinedSequence",
1099
+ smalltalk.method({
1100
+ selector: "inlinedSequence",
1101
+ category: 'factory',
1102
+ fn: function (){
1103
+ var self=this;
1104
+ var $1;
1105
+ $1=smalltalk.send((smalltalk.IRInlinedSequence || IRInlinedSequence),"_new",[]);
1106
+ return $1;
1107
+ },
1108
+ args: [],
1109
+ source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
1110
+ messageSends: ["new"],
1111
+ referencedClasses: ["IRInlinedSequence"]
1112
+ }),
1113
+ smalltalk.IRSendInliner);
1114
+
1115
+ smalltalk.addMethod(
1116
+ "_inliningError_",
1117
+ smalltalk.method({
1118
+ selector: "inliningError:",
1119
+ category: 'error handling',
1120
+ fn: function (aString){
1121
+ var self=this;
1122
+ smalltalk.send((smalltalk.InliningError || InliningError),"_signal_",[aString]);
1123
+ return self},
1124
+ args: ["aString"],
1125
+ source: "inliningError: aString\x0a\x09InliningError signal: aString",
1126
+ messageSends: ["signal:"],
1127
+ referencedClasses: ["InliningError"]
1128
+ }),
1129
+ smalltalk.IRSendInliner);
1130
+
1131
+ smalltalk.addMethod(
1132
+ "_send",
1133
+ smalltalk.method({
1134
+ selector: "send",
1135
+ category: 'accessing',
1136
+ fn: function (){
1137
+ var self=this;
1138
+ return self["@send"];
1139
+ },
1140
+ args: [],
1141
+ source: "send\x0a\x09^ send",
1142
+ messageSends: [],
1143
+ referencedClasses: []
1144
+ }),
1145
+ smalltalk.IRSendInliner);
1146
+
1147
+ smalltalk.addMethod(
1148
+ "_send_",
1149
+ smalltalk.method({
1150
+ selector: "send:",
1151
+ category: 'accessing',
1152
+ fn: function (anIRSend){
1153
+ var self=this;
1154
+ self["@send"]=anIRSend;
1155
+ return self},
1156
+ args: ["anIRSend"],
1157
+ source: "send: anIRSend\x0a\x09send := anIRSend",
1158
+ messageSends: [],
1159
+ referencedClasses: []
1160
+ }),
1161
+ smalltalk.IRSendInliner);
1162
+
1163
+ smalltalk.addMethod(
1164
+ "_translator",
1165
+ smalltalk.method({
1166
+ selector: "translator",
1167
+ category: 'accessing',
1168
+ fn: function (){
1169
+ var self=this;
1170
+ return self["@translator"];
1171
+ },
1172
+ args: [],
1173
+ source: "translator\x0a\x09^ translator",
1174
+ messageSends: [],
1175
+ referencedClasses: []
1176
+ }),
1177
+ smalltalk.IRSendInliner);
1178
+
1179
+ smalltalk.addMethod(
1180
+ "_translator_",
1181
+ smalltalk.method({
1182
+ selector: "translator:",
1183
+ category: 'accessing',
1184
+ fn: function (anASTTranslator){
1185
+ var self=this;
1186
+ self["@translator"]=anASTTranslator;
1187
+ return self},
1188
+ args: ["anASTTranslator"],
1189
+ source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
1190
+ messageSends: [],
1191
+ referencedClasses: []
1192
+ }),
1193
+ smalltalk.IRSendInliner);
1194
+
1195
+
1196
+ smalltalk.addMethod(
1197
+ "_inlinedSelectors",
1198
+ smalltalk.method({
1199
+ selector: "inlinedSelectors",
1200
+ category: 'accessing',
1201
+ fn: function (){
1202
+ var self=this;
1203
+ return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil"];
1204
+ },
1205
+ args: [],
1206
+ source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil')",
1207
+ messageSends: [],
1208
+ referencedClasses: []
1209
+ }),
1210
+ smalltalk.IRSendInliner.klass);
1211
+
1212
+ smalltalk.addMethod(
1213
+ "_shouldInline_",
1214
+ smalltalk.method({
1215
+ selector: "shouldInline:",
1216
+ category: 'accessing',
1217
+ fn: function (anIRInstruction){
1218
+ var self=this;
1219
+ var $1,$2;
1220
+ var $early={};
1221
+ try {
1222
+ $1=smalltalk.send(smalltalk.send(self,"_inlinedSelectors",[]),"_includes_",[smalltalk.send(anIRInstruction,"_selector",[])]);
1223
+ if(! smalltalk.assert($1)){
1224
+ return false;
1225
+ };
1226
+ smalltalk.send(smalltalk.send(smalltalk.send(anIRInstruction,"_instructions",[]),"_allButFirst",[]),"_do_",[(function(each){
1227
+ $2=smalltalk.send(each,"_isClosure",[]);
1228
+ if(! smalltalk.assert($2)){
1229
+ throw $early=[false];
1230
+ };
1231
+ })]);
1232
+ return true;
1233
+ }
1234
+ catch(e) {if(e===$early)return e[0]; throw e}
1235
+ },
1236
+ args: ["anIRInstruction"],
1237
+ source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09anIRInstruction instructions allButFirst do: [ :each |\x0a\x09\x09each isClosure ifFalse: [ ^ false ]].\x0a\x09^ true",
1238
+ messageSends: ["ifFalse:", "includes:", "selector", "inlinedSelectors", "do:", "isClosure", "allButFirst", "instructions"],
1239
+ referencedClasses: []
1240
+ }),
1241
+ smalltalk.IRSendInliner.klass);
1242
+
1243
+
1244
+ smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining');
1245
+ smalltalk.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions. \x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if(smalltalk.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};"
1246
+ smalltalk.addMethod(
1247
+ "_assignment",
1248
+ smalltalk.method({
1249
+ selector: "assignment",
1250
+ category: 'accessing',
1251
+ fn: function (){
1252
+ var self=this;
1253
+ return self["@assignment"];
1254
+ },
1255
+ args: [],
1256
+ source: "assignment\x0a\x09^ assignment",
1257
+ messageSends: [],
1258
+ referencedClasses: []
1259
+ }),
1260
+ smalltalk.IRAssignmentInliner);
1261
+
1262
+ smalltalk.addMethod(
1263
+ "_assignment_",
1264
+ smalltalk.method({
1265
+ selector: "assignment:",
1266
+ category: 'accessing',
1267
+ fn: function (aNode){
1268
+ var self=this;
1269
+ self["@assignment"]=aNode;
1270
+ return self},
1271
+ args: ["aNode"],
1272
+ source: "assignment: aNode\x0a\x09assignment := aNode",
1273
+ messageSends: [],
1274
+ referencedClasses: []
1275
+ }),
1276
+ smalltalk.IRAssignmentInliner);
1277
+
1278
+ smalltalk.addMethod(
1279
+ "_inlineAssignment_",
1280
+ smalltalk.method({
1281
+ selector: "inlineAssignment:",
1282
+ category: 'inlining',
1283
+ fn: function (anIRAssignment){
1284
+ var self=this;
1285
+ var inlinedAssignment;
1286
+ smalltalk.send(self,"_assignment_",[anIRAssignment]);
1287
+ inlinedAssignment=smalltalk.send((smalltalk.IRInlinedAssignment || IRInlinedAssignment),"_new",[]);
1288
+ smalltalk.send(smalltalk.send(anIRAssignment,"_instructions",[]),"_do_",[(function(each){
1289
+ return smalltalk.send(inlinedAssignment,"_add_",[each]);
1290
+ })]);
1291
+ smalltalk.send(anIRAssignment,"_replaceWith_",[inlinedAssignment]);
1292
+ smalltalk.send(self,"_inlineSend_",[smalltalk.send(smalltalk.send(inlinedAssignment,"_instructions",[]),"_last",[])]);
1293
+ return inlinedAssignment;
1294
+ },
1295
+ args: ["anIRAssignment"],
1296
+ source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment",
1297
+ messageSends: ["assignment:", "new", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
1298
+ referencedClasses: ["IRInlinedAssignment"]
1299
+ }),
1300
+ smalltalk.IRAssignmentInliner);
1301
+
1302
+ smalltalk.addMethod(
1303
+ "_inlineClosure_",
1304
+ smalltalk.method({
1305
+ selector: "inlineClosure:",
1306
+ category: 'inlining',
1307
+ fn: function (anIRClosure){
1308
+ var self=this;
1309
+ var $1,$2,$3;
1310
+ var inlinedClosure;
1311
+ var statements;
1312
+ inlinedClosure=smalltalk.send(self,"_inlineClosure_",[anIRClosure],smalltalk.IRSendInliner);
1313
+ statements=smalltalk.send(smalltalk.send(smalltalk.send(inlinedClosure,"_instructions",[]),"_last",[]),"_instructions",[]);
1314
+ smalltalk.send(statements,"_ifNotEmpty_",[(function(){
1315
+ $1=smalltalk.send(smalltalk.send(statements,"_last",[]),"_canBeAssigned",[]);
1316
+ if(smalltalk.assert($1)){
1317
+ $2=smalltalk.send((smalltalk.IRAssignment || IRAssignment),"_new",[]);
1318
+ smalltalk.send($2,"_add_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_assignment",[]),"_instructions",[]),"_first",[])]);
1319
+ smalltalk.send($2,"_add_",[smalltalk.send(smalltalk.send(statements,"_last",[]),"_copy",[])]);
1320
+ $3=smalltalk.send($2,"_yourself",[]);
1321
+ return smalltalk.send(smalltalk.send(statements,"_last",[]),"_replaceWith_",[$3]);
1322
+ };
1323
+ })]);
1324
+ return inlinedClosure;
1325
+ },
1326
+ args: ["anIRClosure"],
1327
+ source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
1328
+ messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "replaceWith:", "add:", "first", "assignment", "new", "copy", "yourself", "canBeAssigned"],
1329
+ referencedClasses: ["IRAssignment"]
1330
+ }),
1331
+ smalltalk.IRAssignmentInliner);
1332
+
1333
+
1334
+
1335
+ smalltalk.addClass('IRNonLocalReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
1336
+ smalltalk.addMethod(
1337
+ "_inlineClosure_",
1338
+ smalltalk.method({
1339
+ selector: "inlineClosure:",
1340
+ category: 'inlining',
1341
+ fn: function (anIRClosure){
1342
+ var self=this;
1343
+ var $1;
1344
+ $1=smalltalk.send(self,"_inlineCLosure_",[anIRClosure],smalltalk.IRSendInliner);
1345
+ return $1;
1346
+ },
1347
+ args: ["anIRClosure"],
1348
+ source: "inlineClosure: anIRClosure\x0a\x09\x22| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last replaceWith: (IRNonLocalReturn new\x0a\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09yourself) ].\x0a\x0a\x09^ inlinedClosure\x22\x0a\x0a\x09^ super inlineCLosure: anIRClosure",
1349
+ messageSends: ["inlineCLosure:"],
1350
+ referencedClasses: []
1351
+ }),
1352
+ smalltalk.IRNonLocalReturnInliner);
1353
+
1354
+ smalltalk.addMethod(
1355
+ "_inlinedReturn",
1356
+ smalltalk.method({
1357
+ selector: "inlinedReturn",
1358
+ category: 'factory',
1359
+ fn: function (){
1360
+ var self=this;
1361
+ var $1;
1362
+ $1=smalltalk.send((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn),"_new",[]);
1363
+ return $1;
1364
+ },
1365
+ args: [],
1366
+ source: "inlinedReturn\x0a\x09^ IRInlinedNonLocalReturn new",
1367
+ messageSends: ["new"],
1368
+ referencedClasses: ["IRInlinedNonLocalReturn"]
1369
+ }),
1370
+ smalltalk.IRNonLocalReturnInliner);
1371
+
1372
+
1373
+
1374
+ smalltalk.addClass('IRReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining');
1375
+ smalltalk.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction."
1376
+ smalltalk.addMethod(
1377
+ "_inlineClosure_",
1378
+ smalltalk.method({
1379
+ selector: "inlineClosure:",
1380
+ category: 'inlining',
1381
+ fn: function (anIRClosure){
1382
+ var self=this;
1383
+ var $1,$2,$3;
1384
+ var closure;
1385
+ var statements;
1386
+ closure=smalltalk.send(self,"_inlineClosure_",[anIRClosure],smalltalk.IRSendInliner);
1387
+ statements=smalltalk.send(smalltalk.send(smalltalk.send(closure,"_instructions",[]),"_last",[]),"_instructions",[]);
1388
+ smalltalk.send(statements,"_ifNotEmpty_",[(function(){
1389
+ $1=smalltalk.send(smalltalk.send(statements,"_last",[]),"_isReturn",[]);
1390
+ if(! smalltalk.assert($1)){
1391
+ $2=smalltalk.send((smalltalk.IRReturn || IRReturn),"_new",[]);
1392
+ smalltalk.send($2,"_add_",[smalltalk.send(smalltalk.send(statements,"_last",[]),"_copy",[])]);
1393
+ $3=smalltalk.send($2,"_yourself",[]);
1394
+ return smalltalk.send(smalltalk.send(statements,"_last",[]),"_replaceWith_",[$3]);
1395
+ };
1396
+ })]);
1397
+ return closure;
1398
+ },
1399
+ args: ["anIRClosure"],
1400
+ source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure",
1401
+ messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "replaceWith:", "add:", "copy", "new", "yourself", "isReturn"],
1402
+ referencedClasses: ["IRReturn"]
1403
+ }),
1404
+ smalltalk.IRReturnInliner);
1405
+
1406
+ smalltalk.addMethod(
1407
+ "_inlineReturn_",
1408
+ smalltalk.method({
1409
+ selector: "inlineReturn:",
1410
+ category: 'inlining',
1411
+ fn: function (anIRReturn){
1412
+ var self=this;
1413
+ var return_;
1414
+ return_=smalltalk.send(self,"_inlinedReturn",[]);
1415
+ smalltalk.send(smalltalk.send(anIRReturn,"_instructions",[]),"_do_",[(function(each){
1416
+ return smalltalk.send(return_,"_add_",[each]);
1417
+ })]);
1418
+ smalltalk.send(anIRReturn,"_replaceWith_",[return_]);
1419
+ smalltalk.send(self,"_inlineSend_",[smalltalk.send(smalltalk.send(return_,"_instructions",[]),"_last",[])]);
1420
+ return return_;
1421
+ },
1422
+ args: ["anIRReturn"],
1423
+ source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return",
1424
+ messageSends: ["inlinedReturn", "do:", "add:", "instructions", "replaceWith:", "inlineSend:", "last"],
1425
+ referencedClasses: []
1426
+ }),
1427
+ smalltalk.IRReturnInliner);
1428
+
1429
+ smalltalk.addMethod(
1430
+ "_inlinedReturn",
1431
+ smalltalk.method({
1432
+ selector: "inlinedReturn",
1433
+ category: 'factory',
1434
+ fn: function (){
1435
+ var self=this;
1436
+ var $1;
1437
+ $1=smalltalk.send((smalltalk.IRInlinedReturn || IRInlinedReturn),"_new",[]);
1438
+ return $1;
1439
+ },
1440
+ args: [],
1441
+ source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
1442
+ messageSends: ["new"],
1443
+ referencedClasses: ["IRInlinedReturn"]
1444
+ }),
1445
+ smalltalk.IRReturnInliner);
1446
+
1447
+
1448
+
1449
+ smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining');
1450
+ smalltalk.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output"
1451
+ smalltalk.addMethod(
1452
+ "_compileNode_",
1453
+ smalltalk.method({
1454
+ selector: "compileNode:",
1455
+ category: 'compiling',
1456
+ fn: function (aNode){
1457
+ var self=this;
1458
+ var $2,$3,$1;
1459
+ var ir;
1460
+ var stream;
1461
+ smalltalk.send(smalltalk.send(self,"_semanticAnalyzer",[]),"_visit_",[aNode]);
1462
+ ir=smalltalk.send(smalltalk.send(self,"_translator",[]),"_visit_",[aNode]);
1463
+ smalltalk.send(smalltalk.send(self,"_inliner",[]),"_visit_",[ir]);
1464
+ $2=smalltalk.send(self,"_irTranslator",[]);
1465
+ smalltalk.send($2,"_visit_",[ir]);
1466
+ $3=smalltalk.send($2,"_contents",[]);
1467
+ $1=$3;
1468
+ return $1;
1469
+ },
1470
+ args: ["aNode"],
1471
+ source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
1472
+ messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "irTranslator", "contents"],
1473
+ referencedClasses: []
1474
+ }),
1475
+ smalltalk.InliningCodeGenerator);
1476
+
1477
+ smalltalk.addMethod(
1478
+ "_inliner",
1479
+ smalltalk.method({
1480
+ selector: "inliner",
1481
+ category: 'compiling',
1482
+ fn: function (){
1483
+ var self=this;
1484
+ var $1;
1485
+ $1=smalltalk.send((smalltalk.IRInliner || IRInliner),"_new",[]);
1486
+ return $1;
1487
+ },
1488
+ args: [],
1489
+ source: "inliner\x0a\x09^ IRInliner new",
1490
+ messageSends: ["new"],
1491
+ referencedClasses: ["IRInliner"]
1492
+ }),
1493
+ smalltalk.InliningCodeGenerator);
1494
+
1495
+ smalltalk.addMethod(
1496
+ "_irTranslator",
1497
+ smalltalk.method({
1498
+ selector: "irTranslator",
1499
+ category: 'compiling',
1500
+ fn: function (){
1501
+ var self=this;
1502
+ var $1;
1503
+ $1=smalltalk.send((smalltalk.IRInliningJSTranslator || IRInliningJSTranslator),"_new",[]);
1504
+ return $1;
1505
+ },
1506
+ args: [],
1507
+ source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
1508
+ messageSends: ["new"],
1509
+ referencedClasses: ["IRInliningJSTranslator"]
1510
+ }),
1511
+ smalltalk.InliningCodeGenerator);
1512
+
1513
+
1514
+