resin 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/amber/bin/amberc +10 -350
- data/amber/js/Benchfib.deploy.js +80 -89
- data/amber/js/Benchfib.js +80 -89
- data/amber/js/Canvas.deploy.js +558 -545
- data/amber/js/Canvas.js +563 -545
- data/amber/js/Compiler-AST.deploy.js +431 -243
- data/amber/js/Compiler-AST.js +487 -244
- data/amber/js/Compiler-Core.deploy.js +201 -1045
- data/amber/js/Compiler-Core.js +208 -1207
- data/amber/js/Compiler-Exceptions.deploy.js +37 -18
- data/amber/js/Compiler-Exceptions.js +42 -18
- data/amber/js/Compiler-IR.deploy.js +1071 -774
- data/amber/js/Compiler-IR.js +1194 -848
- data/amber/js/Compiler-Inlining.deploy.js +395 -373
- data/amber/js/Compiler-Inlining.js +395 -373
- data/amber/js/Compiler-Interpreter.deploy.js +1202 -0
- data/amber/js/Compiler-Interpreter.js +1631 -0
- data/amber/js/Compiler-Semantic.deploy.js +695 -600
- data/amber/js/Compiler-Semantic.js +721 -611
- data/amber/js/Compiler-Tests.deploy.js +699 -376
- data/amber/js/Compiler-Tests.js +834 -381
- data/amber/js/Compiler.deploy.js +8563 -1805
- data/amber/js/Compiler.js +11476 -2633
- data/amber/js/Examples.deploy.js +29 -29
- data/amber/js/Examples.js +29 -29
- data/amber/js/IDE.deploy.js +3292 -2649
- data/amber/js/IDE.js +3318 -2710
- data/amber/js/Importer-Exporter.deploy.js +393 -349
- data/amber/js/Importer-Exporter.js +398 -354
- data/amber/js/Kernel-Announcements.deploy.js +53 -44
- data/amber/js/Kernel-Announcements.js +55 -44
- data/amber/js/Kernel-Classes.deploy.js +566 -368
- data/amber/js/Kernel-Classes.js +660 -402
- data/amber/js/Kernel-Collections.deploy.js +1149 -1098
- data/amber/js/Kernel-Collections.js +1183 -1116
- data/amber/js/Kernel-Exceptions.deploy.js +173 -75
- data/amber/js/Kernel-Exceptions.js +215 -77
- data/amber/js/Kernel-Methods.deploy.js +530 -313
- data/amber/js/Kernel-Methods.js +632 -338
- data/amber/js/Kernel-Objects.deploy.js +1734 -1577
- data/amber/js/Kernel-Objects.js +1867 -1654
- data/amber/js/Kernel-Tests.deploy.js +1416 -973
- data/amber/js/Kernel-Tests.js +1495 -981
- data/amber/js/Kernel-Transcript.deploy.js +23 -24
- data/amber/js/Kernel-Transcript.js +25 -26
- data/amber/js/SUnit-Tests.deploy.js +402 -0
- data/amber/js/SUnit-Tests.js +518 -0
- data/amber/js/SUnit.deploy.js +535 -237
- data/amber/js/SUnit.js +634 -246
- data/amber/js/amber.js +90 -53
- data/amber/js/boot.js +441 -255
- data/amber/js/init.js +1 -3
- data/amber/js/lib/CodeMirror/codemirror.css +3 -0
- data/amber/js/lib/CodeMirror/codemirror.js +104 -55
- data/amber/js/lib/peg-0.7.0.min.js +9 -0
- data/amber/js/parser.js +1504 -802
- data/amber/js/parser.pegjs +170 -165
- data/amber/st/Canvas.st +6 -0
- data/amber/st/Compiler-AST.st +54 -3
- data/amber/st/Compiler-Core.st +6 -551
- data/amber/st/Compiler-Exceptions.st +4 -0
- data/amber/st/Compiler-IR.st +205 -87
- data/amber/st/Compiler-Interpreter.st +597 -0
- data/amber/st/Compiler-Semantic.st +46 -21
- data/amber/st/Compiler-Tests.st +254 -7
- data/amber/st/Compiler.st +3172 -1541
- data/amber/st/IDE.st +57 -93
- data/amber/st/Importer-Exporter.st +4 -7
- data/amber/st/Kernel-Announcements.st +8 -0
- data/amber/st/Kernel-Classes.st +149 -40
- data/amber/st/Kernel-Collections.st +43 -32
- data/amber/st/Kernel-Exceptions.st +70 -1
- data/amber/st/Kernel-Methods.st +165 -27
- data/amber/st/Kernel-Objects.st +215 -140
- data/amber/st/Kernel-Tests.st +195 -10
- data/amber/st/Kernel-Transcript.st +1 -3
- data/amber/st/SUnit-Tests.st +186 -0
- data/amber/st/SUnit.st +186 -14
- data/bin/resin +6 -0
- data/lib/resin/cli.rb +19 -0
- metadata +41 -25
- data/amber/js/lib/peg-0.6.2.min.js +0 -2
- data/bin/resin-compile +0 -6
- data/bin/runresin +0 -12
data/amber/bin/amberc
CHANGED
@@ -1,353 +1,13 @@
|
|
1
|
-
#!/bin/
|
2
|
-
#
|
3
|
-
# This is a "compiler" for Amber code. Run without arguments for help.
|
4
|
-
#
|
5
|
-
# Get Amber root directory from the location of this script so that
|
6
|
-
# we can find the st and js directories etc.
|
1
|
+
#!/usr/bin/env node
|
7
2
|
|
8
|
-
|
9
|
-
|
10
|
-
TARGET=`dirname ${0}`/..
|
11
|
-
pushd . >/dev/null
|
12
|
-
cd $TARGET
|
13
|
-
AMBER="`\pwd -P`"
|
14
|
-
popd >/dev/null
|
3
|
+
var path = require('path');
|
4
|
+
var amberc = require('./amberc.js');
|
15
5
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
Will compile Amber files - either separately or into a runnable complete
|
22
|
-
program. If no .st files are listed only a linking stage is performed.
|
23
|
-
Files listed will be handled using these rules:
|
24
|
-
|
25
|
-
*.js
|
26
|
-
Files are linked (concatenated) in listed order.
|
27
|
-
If not found we look in $AMBER/js
|
28
|
-
|
29
|
-
*.st
|
30
|
-
Files are compiled into .js files before concatenated.
|
31
|
-
If not found we look in $AMBER/st.
|
32
|
-
|
33
|
-
NOTE: Each file is currently considered to be a fileout of a single class
|
34
|
-
category of the same name as the file!
|
35
|
-
|
36
|
-
If no Program is specified each given .st file will be compiled into
|
37
|
-
a .js file. Otherwise a <Program>.js file is linked together based on
|
38
|
-
the options:
|
39
|
-
|
40
|
-
-l library1,library2
|
41
|
-
Additionally add listed libraries (no spaces or .js) in listed order.
|
42
|
-
|
43
|
-
-i file
|
44
|
-
Add library initializer <file> instead of default $AMBER/js/init.js
|
45
|
-
|
46
|
-
-m class
|
47
|
-
Add at end a call to #main in class <class>.
|
48
|
-
|
49
|
-
-M file
|
50
|
-
Add at end javascript file <file> acting as main.
|
51
|
-
|
52
|
-
-o
|
53
|
-
Optimize each js file using the Google closure compiler.
|
54
|
-
Using Closure compiler found at ~/compiler.jar
|
55
|
-
|
56
|
-
-O
|
57
|
-
Optimize final <Program>.js using the Google closure compiler.
|
58
|
-
Using Closure compiler found at ~/compiler.jar
|
59
|
-
|
60
|
-
-A Same as -O but use --compilation_level ADVANCED_OPTIMIZATIONS
|
61
|
-
|
62
|
-
-d
|
63
|
-
Additionally export code for deploy - stripped from source etc.
|
64
|
-
Uses suffix ".deploy.js" in addition to any explicit given suffic using -s.
|
65
|
-
|
66
|
-
-s suffix
|
67
|
-
Add <suffix> to compiled js files so that File.st is compiled into
|
68
|
-
File.<suffix>.js.
|
69
|
-
|
70
|
-
-S suffix
|
71
|
-
Use <suffix> for all libraries accessed using -L or -l. This makes it possible
|
72
|
-
to have multiple flavors of Amber and libraries in the same place.
|
73
|
-
|
74
|
-
|
75
|
-
Example invocations:
|
76
|
-
|
77
|
-
Just compile Kernel-Objects.st to Kernel-Objects.js:
|
78
|
-
|
79
|
-
amberc Kernel-Objects.st
|
80
|
-
|
81
|
-
Compile Hello.st to Hello.js and create complete program called
|
82
|
-
Program.js and adding a call to class method #main in class Hello:
|
83
|
-
|
84
|
-
amberc -m Hello Hello.st Program
|
85
|
-
|
86
|
-
Compile two .st files into corresponding .js files,
|
87
|
-
and link with specific myboot.js, myKernel.js, myinit.js
|
88
|
-
and main.js and create complete program called Program.js:
|
89
|
-
|
90
|
-
amberc -M main.js myinit.js myboot.js myKernel.js Cat1.st Cat2.st Program
|
91
|
-
|
92
|
-
ENDOFHELP
|
93
|
-
exit 1;
|
94
|
-
}
|
95
|
-
|
96
|
-
# Check we at least got one argument
|
97
|
-
if [ -z $1 ] ; then
|
98
|
-
usage
|
99
|
-
fi
|
100
|
-
|
101
|
-
# Define our predefined library combinations
|
102
|
-
KERNEL="boot Kernel-Objects Kernel-Classes Kernel-Methods Kernel-Collections Kernel-Exceptions Kernel-Transcript Kernel-Announcements"
|
103
|
-
COMPILER="$KERNEL parser Compiler Compiler-Exceptions"
|
104
|
-
|
105
|
-
# Predefined initializer
|
106
|
-
INITIALIZER="$AMBER/js/init.js"
|
107
|
-
|
108
|
-
# Default values
|
109
|
-
ENV=
|
110
|
-
INIT=$INITIALIZER
|
111
|
-
MAIN=
|
112
|
-
MAINFILE=
|
113
|
-
BASE=$KERNEL
|
114
|
-
LOAD=
|
115
|
-
CLOSUREOPTS=
|
116
|
-
# Ok, bad coding practice but hey, who would use such a suffix?
|
117
|
-
SUFFIX=no-silly-suffix
|
118
|
-
SUFFIXUSED=
|
119
|
-
DEPLOY=false
|
120
|
-
NODECOMPILE=nodecompile
|
121
|
-
|
122
|
-
# Read options and shift them away
|
123
|
-
while getopts "l:i:m:M:oOAds:S:h?" o; do
|
124
|
-
case "$o" in
|
125
|
-
l) LOAD=$OPTARG;;
|
126
|
-
i) INIT=$OPTARG;;
|
127
|
-
m) MAIN=$OPTARG;;
|
128
|
-
M) MAINFILE=$OPTARG;;
|
129
|
-
o) CLOSURE=true
|
130
|
-
CLOSUREPARTS=true;;
|
131
|
-
O) CLOSURE=true
|
132
|
-
CLOSUREFULL=true;;
|
133
|
-
A) CLOSURE=true
|
134
|
-
CLOSUREOPTS="$CLOSUREOPTS --compilation_level ADVANCED_OPTIMIZATIONS"
|
135
|
-
CLOSUREFULL=true;;
|
136
|
-
d) DEPLOY=true;;
|
137
|
-
s) SUFFIX=$OPTARG
|
138
|
-
SUFFIXUSED=$SUFFIX;;
|
139
|
-
S) LOADSUFFIX=$OPTARG
|
140
|
-
SUFFIXUSED=$SUFFIX;;
|
141
|
-
h) usage;;
|
142
|
-
[?]) usage;;
|
143
|
-
esac
|
144
|
-
done
|
145
|
-
shift $(($OPTIND - 1))
|
146
|
-
|
147
|
-
# Check for Closure compiler and Java
|
148
|
-
if [ ! -z $CLOSURE ]; then
|
149
|
-
java > /dev/null
|
150
|
-
if [ $? -eq 0 ]; then
|
151
|
-
if [ ! -f ~/compiler.jar ]; then
|
152
|
-
echo "Can not find Closure compiler at ~/compiler.jar"
|
153
|
-
exit 1
|
154
|
-
fi
|
155
|
-
else
|
156
|
-
echo "java is not installed and is needed for -O, -A or -o (Closure compiler)."
|
157
|
-
exit 1
|
158
|
-
fi
|
159
|
-
fi
|
160
|
-
|
161
|
-
# Function for looking up listed js files
|
162
|
-
function resolvejs {
|
163
|
-
FNAME="$1$LOADSUFFIX.js"
|
164
|
-
if [ -f $FNAME ]; then
|
165
|
-
RESOLVED="$FNAME"
|
166
|
-
else
|
167
|
-
if [ -f $AMBER/js/$FNAME ]; then
|
168
|
-
RESOLVED="$AMBER/js/$FNAME"
|
169
|
-
else
|
170
|
-
echo "Javascript file not found: $FNAME"
|
171
|
-
exit 1
|
172
|
-
fi
|
173
|
-
fi
|
174
|
-
}
|
175
|
-
|
176
|
-
# Resolve listed libraries in $BASE deparated by spaces
|
177
|
-
for FILE in $BASE
|
178
|
-
do
|
179
|
-
resolvejs $FILE
|
180
|
-
TOBASE="$TOBASE $RESOLVED"
|
181
|
-
done
|
182
|
-
|
183
|
-
# Resolve listed libraries in $LOAD separated by ,
|
184
|
-
LOAD=${LOAD//,/\ }
|
185
|
-
for FILE in $LOAD
|
186
|
-
do
|
187
|
-
resolvejs $FILE
|
188
|
-
TOLOAD="$TOLOAD $RESOLVED"
|
189
|
-
done
|
190
|
-
|
191
|
-
# Resolve COMPILER
|
192
|
-
for FILE in $COMPILER
|
193
|
-
do
|
194
|
-
resolvejs $FILE
|
195
|
-
TOCOMPILER="$TOCOMPILER $RESOLVED"
|
196
|
-
done
|
197
|
-
|
198
|
-
# Add supplied libraries we have not already loaded (they are already resolved)
|
199
|
-
#for FILE in $EXTRA
|
200
|
-
#do
|
201
|
-
# resolvejs $FILE
|
202
|
-
# TOEXTRA="$TOEXTRA $RESOLVED"
|
203
|
-
#done
|
204
|
-
|
205
|
-
TOCOMPILER="$TOCOMPILER$TOLOAD"
|
206
|
-
|
207
|
-
# Resolve init and nodecompile
|
208
|
-
THEREST="init $AMBER/bin/$NODECOMPILE"
|
209
|
-
for FILE in $THEREST
|
210
|
-
do
|
211
|
-
resolvejs $FILE
|
212
|
-
TOCOMPILER="$TOCOMPILER $RESOLVED"
|
213
|
-
done
|
214
|
-
|
215
|
-
# Add supplied libraries
|
216
|
-
LIBS="$TOBASE $TOLOAD"
|
217
|
-
|
218
|
-
# Get a unique tempdir and make it get auto removed on exit
|
219
|
-
TMPDIR=`mktemp -d amberc.XXXXXX 2>>/dev/null` ||\
|
220
|
-
TMPDIR=/tmp/amberc.$$.`date +%s` && mkdir -p $TMPDIR
|
221
|
-
trap "rm -rf $TMPDIR" EXIT
|
222
|
-
|
223
|
-
|
224
|
-
# --------------------------------------------------
|
225
|
-
# Collect libraries and Smalltalk files looking
|
226
|
-
# both locally and in $AMBER/js and $AMBER/st
|
227
|
-
# --------------------------------------------------
|
228
|
-
PROGRAM=
|
229
|
-
until [ "$*" = "" ]
|
230
|
-
do
|
231
|
-
case $1 in
|
232
|
-
*.st)
|
233
|
-
CATEGORY=`basename $1 .st`
|
234
|
-
if [ -f "$1" ]; then
|
235
|
-
COMPILE="$COMPILE $1 $CATEGORY"
|
236
|
-
COMPILED="$COMPILED $CATEGORY$SUFFIXUSED.js"
|
237
|
-
else
|
238
|
-
if [ -f $AMBER/st/$1 ]; then
|
239
|
-
COMPILE="$COMPILE $AMBER/st/$1 $CATEGORY"
|
240
|
-
COMPILED="$COMPILED $CATEGORY$SUFFIXUSED.js"
|
241
|
-
else
|
242
|
-
echo "Amber file not found: $1"
|
243
|
-
exit 1
|
244
|
-
fi
|
245
|
-
fi
|
246
|
-
;;
|
247
|
-
|
248
|
-
*.js)
|
249
|
-
resolvejs $1
|
250
|
-
LIBS="$LIBS $RESOLVED"
|
251
|
-
;;
|
252
|
-
*)
|
253
|
-
# Will end up being the last non js/st argument
|
254
|
-
PROGRAM=$1
|
255
|
-
;;
|
256
|
-
esac
|
257
|
-
shift
|
258
|
-
done
|
259
|
-
|
260
|
-
# --------------------------------------------------
|
261
|
-
# Actual compilation phase of collected .st files
|
262
|
-
# --------------------------------------------------
|
263
|
-
|
264
|
-
# Create compiler dynamically
|
265
|
-
cat $TOCOMPILER > $TMPDIR/compiler.js
|
266
|
-
|
267
|
-
# Compile all collected .st files to .js
|
268
|
-
echo "Loading libraries$TOCOMPILER and compiling ..."
|
269
|
-
node $TMPDIR/compiler.js $DEPLOY $SUFFIX $COMPILE
|
270
|
-
|
271
|
-
# Verify all .js files corresponding to .st files were created, otherwise exit
|
272
|
-
IFS=" "
|
273
|
-
for FILE in $COMPILED
|
274
|
-
do
|
275
|
-
if [ ! -f "$FILE" ]; then
|
276
|
-
echo "Failed compilation of $FILE, exiting."
|
277
|
-
exit 1
|
278
|
-
fi
|
279
|
-
done
|
280
|
-
|
281
|
-
if [ ! -z $CLOSUREPARTS ]; then
|
282
|
-
echo "Compiling all js files using Google closure compiler."
|
283
|
-
|
284
|
-
ALLJSFILES="$COMPILED $LIBS"
|
285
|
-
for FILE in $ALLJSFILES
|
286
|
-
do
|
287
|
-
mv $FILE $FILE.original
|
288
|
-
java -jar ~/compiler.jar $CLOSUREOPTS --js $FILE.original --js_output_file $FILE
|
289
|
-
rm $FILE.original
|
290
|
-
done
|
291
|
-
fi
|
292
|
-
|
293
|
-
|
294
|
-
if [ -z $PROGRAM ]; then
|
295
|
-
echo "Done."
|
296
|
-
exit 0
|
297
|
-
fi
|
298
|
-
|
299
|
-
# --------------------------------------------------
|
300
|
-
# Now we start composing resulting javascript file.
|
301
|
-
# --------------------------------------------------
|
302
|
-
|
303
|
-
# Add collected libraries to libs.js file.
|
304
|
-
if [ ! -z "$LIBS" ]; then
|
305
|
-
echo "Adding libraries $LIBS ..."
|
306
|
-
cat $LIBS > $TMPDIR/libs.js
|
307
|
-
LIBS=$TMPDIR/libs.js
|
308
|
-
fi
|
309
|
-
|
310
|
-
echo "Adding Amber code$COMPILED ..."
|
311
|
-
|
312
|
-
# Check for init file
|
313
|
-
if [ ! -z "$INIT" ]; then
|
314
|
-
if [ -f "$INIT" ]; then
|
315
|
-
echo "Adding initializer $INIT ..."
|
316
|
-
else
|
317
|
-
echo "Can not find init file $INIT, exiting."
|
318
|
-
exit 1
|
319
|
-
fi
|
320
|
-
fi
|
321
|
-
|
322
|
-
# Check for adding main
|
323
|
-
if [ ! -z "$MAIN" ]; then
|
324
|
-
echo "Adding call to $MAIN class >> main ..."
|
325
|
-
echo "smalltalk.$MAIN._main()" > $TMPDIR/main.js
|
326
|
-
MAIN=$TMPDIR/main.js
|
327
|
-
fi
|
328
|
-
|
329
|
-
# Check for adding main file
|
330
|
-
if [ ! -z "$MAINFILE" ]; then
|
331
|
-
if [ -f "$MAINFILE" ]; then
|
332
|
-
echo "Adding main as $MAINFILE ..."
|
333
|
-
else
|
334
|
-
echo "Can not find main file $MAINFILE, exiting."
|
335
|
-
exit 1
|
336
|
-
fi
|
337
|
-
MAIN=$MAINFILE
|
338
|
-
fi
|
339
|
-
|
340
|
-
# And finally concatenate Program.js
|
341
|
-
echo "Writing $PROGRAM.js ..."
|
342
|
-
cat $LIBS $COMPILED $INIT $MAIN > $PROGRAM.js
|
343
|
-
echo "Done."
|
344
|
-
|
345
|
-
|
346
|
-
if [ ! -z $CLOSUREFULL ]; then
|
347
|
-
echo "Compiling $PROGRAM.js file using Google closure compiler."
|
348
|
-
mv $PROGRAM.js $PROGRAM.js.original
|
349
|
-
java -jar ~/compiler.jar $CLOSUREOPTS --js $PROGRAM.js.original --js_output_file $PROGRAM.js
|
350
|
-
rm $PROGRAM.js.original
|
351
|
-
echo "Done."
|
352
|
-
fi
|
6
|
+
// Get Amber root directory from the location of this script so that
|
7
|
+
// we can find the st and js directories etc.
|
8
|
+
var amber_dir = path.normalize(path.join(path.dirname(process.argv[1]), '..'));
|
9
|
+
// Get default location of compiler.jar
|
10
|
+
var closure_jar = path.resolve(path.join(process.env['HOME'], 'compiler.jar'));
|
353
11
|
|
12
|
+
var compiler = new amberc.Compiler(amber_dir, closure_jar);
|
13
|
+
compiler.main();
|
data/amber/js/Benchfib.deploy.js
CHANGED
@@ -8,9 +8,9 @@ selector: "main",
|
|
8
8
|
fn: function (){
|
9
9
|
var self=this;
|
10
10
|
var result;
|
11
|
-
|
12
|
-
|
13
|
-
return self}
|
11
|
+
return smalltalk.withContext(function($ctx1) {
|
12
|
+
_st(console)._log_(_st("0 tinyBenchmarks => ").__comma(result));
|
13
|
+
return self}, function($ctx1) {$ctx1.fill(self,"main",{result:result}, smalltalk.Benchfib.klass)})}
|
14
14
|
}),
|
15
15
|
smalltalk.Benchfib.klass);
|
16
16
|
|
@@ -21,15 +21,15 @@ smalltalk.method({
|
|
21
21
|
selector: "benchFib",
|
22
22
|
fn: function (){
|
23
23
|
var self=this;
|
24
|
-
|
25
|
-
$2=
|
24
|
+
return smalltalk.withContext(function($ctx1) {
|
25
|
+
$2=_st(self).__lt((2));
|
26
26
|
if(smalltalk.assert($2)){
|
27
27
|
$1=(1);
|
28
28
|
} else {
|
29
|
-
$1=
|
29
|
+
$1=_st(_st(_st(_st(self).__minus((1)))._benchFib()).__plus(_st(_st(self).__minus((2)))._benchFib())).__plus((1));
|
30
30
|
};
|
31
31
|
return $1;
|
32
|
-
}
|
32
|
+
}, function($ctx1) {$ctx1.fill(self,"benchFib",{}, smalltalk.Number)})}
|
33
33
|
}),
|
34
34
|
smalltalk.Number);
|
35
35
|
|
@@ -39,42 +39,43 @@ smalltalk.method({
|
|
39
39
|
selector: "benchmark",
|
40
40
|
fn: function (){
|
41
41
|
var self=this;
|
42
|
-
var
|
43
|
-
|
44
|
-
var flags;
|
45
|
-
var prime;
|
46
|
-
var k;
|
47
|
-
var count;
|
42
|
+
var size,flags,prime,k,count;
|
43
|
+
return smalltalk.withContext(function($ctx1) {
|
48
44
|
size=(8190);
|
49
|
-
|
50
|
-
|
45
|
+
$1=self;
|
46
|
+
$2=(function(iter){
|
47
|
+
return smalltalk.withContext(function($ctx2) {
|
51
48
|
count;
|
52
|
-
flags=
|
49
|
+
flags=_st((smalltalk.Array || Array))._new();
|
53
50
|
flags;
|
54
|
-
|
55
|
-
return smalltalk.
|
56
|
-
})
|
57
|
-
|
58
|
-
$
|
59
|
-
|
60
|
-
|
51
|
+
_st(size)._timesRepeat_((function(){
|
52
|
+
return smalltalk.withContext(function($ctx3) {
|
53
|
+
}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
|
54
|
+
$3=size;
|
55
|
+
$4=(function(i){
|
56
|
+
return smalltalk.withContext(function($ctx3) {
|
57
|
+
if(smalltalk.assert($5)){
|
58
|
+
prime=_st(i).__plus((1));
|
61
59
|
prime;
|
62
|
-
k=
|
60
|
+
k=_st(i).__plus(prime);
|
63
61
|
k;
|
64
|
-
|
65
|
-
return smalltalk.
|
66
|
-
})
|
67
|
-
smalltalk.
|
68
|
-
k=
|
62
|
+
_st((function(){
|
63
|
+
return smalltalk.withContext(function($ctx4) {
|
64
|
+
}, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}))._whileTrue_((function(){
|
65
|
+
return smalltalk.withContext(function($ctx4) {
|
66
|
+
k=_st(k).__plus(prime);
|
69
67
|
return k;
|
70
|
-
})
|
71
|
-
count=
|
68
|
+
}, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
|
69
|
+
count=_st(count).__plus((1));
|
72
70
|
return count;
|
73
71
|
};
|
74
|
-
})
|
75
|
-
|
76
|
-
|
77
|
-
|
72
|
+
}, function($ctx3) {$ctx3.fillBlock({i:i},$ctx1)})});
|
73
|
+
return _st((1))._to_do_($3,$4);
|
74
|
+
}, function($ctx2) {$ctx2.fillBlock({iter:iter},$ctx1)})});
|
75
|
+
_st((1))._to_do_($1,$2);
|
76
|
+
$6=count;
|
77
|
+
return $6;
|
78
|
+
}, function($ctx1) {$ctx1.fill(self,"benchmark",{size:size,flags:flags,prime:prime,k:k,count:count}, smalltalk.Number)})}
|
78
79
|
}),
|
79
80
|
smalltalk.Number);
|
80
81
|
|
@@ -84,12 +85,11 @@ smalltalk.method({
|
|
84
85
|
selector: "jsbenchFib",
|
85
86
|
fn: function (){
|
86
87
|
var self=this;
|
87
|
-
|
88
|
+
return smalltalk.withContext(function($ctx1) {
|
88
89
|
return 1;
|
89
90
|
} else {
|
90
91
|
return (this-1)._jsbenchFib() + (this-2)._jsbenchFib() + 1;};
|
91
|
-
|
92
|
-
return self}
|
92
|
+
return self}, function($ctx1) {$ctx1.fill(self,"jsbenchFib",{}, smalltalk.Number)})}
|
93
93
|
}),
|
94
94
|
smalltalk.Number);
|
95
95
|
|
@@ -99,7 +99,7 @@ smalltalk.method({
|
|
99
99
|
selector: "jsbenchmark",
|
100
100
|
fn: function (){
|
101
101
|
var self=this;
|
102
|
-
|
102
|
+
return smalltalk.withContext(function($ctx1) {
|
103
103
|
var size = 8190;
|
104
104
|
var count;
|
105
105
|
for (var z=0;z<this;z++) {
|
@@ -121,8 +121,7 @@ for (var z=0;z<this;z++) {
|
|
121
121
|
}
|
122
122
|
}
|
123
123
|
return count;
|
124
|
-
|
125
|
-
return self}
|
124
|
+
return self}, function($ctx1) {$ctx1.fill(self,"jsbenchmark",{}, smalltalk.Number)})}
|
126
125
|
}),
|
127
126
|
smalltalk.Number);
|
128
127
|
|
@@ -132,38 +131,34 @@ smalltalk.method({
|
|
132
131
|
selector: "jstinyBenchmarks",
|
133
132
|
fn: function (){
|
134
133
|
var self=this;
|
135
|
-
var
|
136
|
-
|
137
|
-
var t2;
|
138
|
-
var r;
|
139
|
-
var n1;
|
140
|
-
var n2;
|
134
|
+
var t1,t2,r,n1,n2;
|
135
|
+
return smalltalk.withContext(function($ctx1) {
|
141
136
|
n1=(1);
|
142
|
-
|
143
|
-
|
144
|
-
return smalltalk.
|
145
|
-
})
|
137
|
+
_st((function(){
|
138
|
+
return smalltalk.withContext(function($ctx2) {
|
139
|
+
return smalltalk.withContext(function($ctx3) {
|
140
|
+
}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
|
146
141
|
t1;
|
147
|
-
return
|
148
|
-
})
|
149
|
-
|
142
|
+
return _st(t1).__lt((1000));
|
143
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
|
144
|
+
return smalltalk.withContext(function($ctx2) {
|
150
145
|
return n1;
|
151
|
-
})
|
146
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
152
147
|
n2=(28);
|
153
|
-
|
154
|
-
|
155
|
-
|
148
|
+
_st((function(){
|
149
|
+
return smalltalk.withContext(function($ctx2) {
|
150
|
+
return smalltalk.withContext(function($ctx3) {
|
156
151
|
return r;
|
157
|
-
})
|
152
|
+
}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
|
158
153
|
t2;
|
159
|
-
return
|
160
|
-
})
|
161
|
-
|
154
|
+
return _st(t2).__lt((1000));
|
155
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
|
156
|
+
return smalltalk.withContext(function($ctx2) {
|
162
157
|
return n2;
|
163
|
-
})
|
164
|
-
$1=
|
158
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
159
|
+
$1=_st(_st(_st(_st(_st(_st(_st(n1).__star((500000))).__star((1000))).__slash(t1))._printString()).__comma(" bytecodes/sec; ")).__comma(_st(_st(_st(r).__star((1000))).__slash(t2))._printString())).__comma(" sends/sec");
|
165
160
|
return $1;
|
166
|
-
}
|
161
|
+
}, function($ctx1) {$ctx1.fill(self,"jstinyBenchmarks",{t1:t1,t2:t2,r:r,n1:n1,n2:n2}, smalltalk.Number)})}
|
167
162
|
}),
|
168
163
|
smalltalk.Number);
|
169
164
|
|
@@ -173,38 +168,34 @@ smalltalk.method({
|
|
173
168
|
selector: "tinyBenchmarks",
|
174
169
|
fn: function (){
|
175
170
|
var self=this;
|
176
|
-
var
|
177
|
-
|
178
|
-
var t2;
|
179
|
-
var r;
|
180
|
-
var n1;
|
181
|
-
var n2;
|
171
|
+
var t1,t2,r,n1,n2;
|
172
|
+
return smalltalk.withContext(function($ctx1) {
|
182
173
|
n1=(1);
|
183
|
-
|
184
|
-
|
185
|
-
return smalltalk.
|
186
|
-
})
|
174
|
+
_st((function(){
|
175
|
+
return smalltalk.withContext(function($ctx2) {
|
176
|
+
return smalltalk.withContext(function($ctx3) {
|
177
|
+
}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
|
187
178
|
t1;
|
188
|
-
return
|
189
|
-
})
|
190
|
-
|
179
|
+
return _st(t1).__lt((1000));
|
180
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
|
181
|
+
return smalltalk.withContext(function($ctx2) {
|
191
182
|
return n1;
|
192
|
-
})
|
183
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
193
184
|
n2=(16);
|
194
|
-
|
195
|
-
|
196
|
-
|
185
|
+
_st((function(){
|
186
|
+
return smalltalk.withContext(function($ctx2) {
|
187
|
+
return smalltalk.withContext(function($ctx3) {
|
197
188
|
return r;
|
198
|
-
})
|
189
|
+
}, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
|
199
190
|
t2;
|
200
|
-
return
|
201
|
-
})
|
202
|
-
|
191
|
+
return _st(t2).__lt((1000));
|
192
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
|
193
|
+
return smalltalk.withContext(function($ctx2) {
|
203
194
|
return n2;
|
204
|
-
})
|
205
|
-
$1=
|
195
|
+
}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
|
196
|
+
$1=_st(_st(_st(_st(_st(_st(_st(n1).__star((500000))).__star((1000))).__slash(t1))._printString()).__comma(" bytecodes/sec; ")).__comma(_st(_st(_st(r).__star((1000))).__slash(t2))._printString())).__comma(" sends/sec");
|
206
197
|
return $1;
|
207
|
-
}
|
198
|
+
}, function($ctx1) {$ctx1.fill(self,"tinyBenchmarks",{t1:t1,t2:t2,r:r,n1:n1,n2:n2}, smalltalk.Number)})}
|
208
199
|
}),
|
209
200
|
smalltalk.Number);
|
210
201
|
|