Skip to content

Commit b3498c0

Browse files
aardvark179gbrail
authored andcommitted
Enable the V8 regexp benchmark.
1 parent f93786d commit b3498c0

2 files changed

Lines changed: 21 additions & 20 deletions

File tree

benchmarks/src/jmh/java/org/mozilla/javascript/benchmarks/V8Benchmark.java

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -178,31 +178,32 @@ public Object rayTrace(RayTraceState state) {
178178
return state.rt.call(state.cx, state.scope, state.scope, emptyArgs);
179179
}
180180

181-
/* TODO not working right now
182181
@State(Scope.Thread)
183182
public static class RegExpState extends AbstractState {
184-
Callable re;
185-
186-
@Setup(Level.Trial)
187-
public void setUp() {
188-
initialize();
189-
evaluateSource(cx, scope, "testsrc/benchmarks/v8-benchmarks-v6/regexp.js");
190-
runSetup();
191-
re = getRunFunc("RegExp");
192-
}
193-
194-
@TearDown(Level.Trial)
195-
public void tearDown() {
196-
runCleanup();
197-
cleanup();
198-
}
183+
Callable re;
184+
185+
@Param({"false", "true"})
186+
public boolean interpreted;
187+
188+
@Setup(Level.Trial)
189+
public void setUp() {
190+
initialize(interpreted);
191+
evaluateSource(cx, scope, "testsrc/benchmarks/v8-benchmarks-v6/regexp.js");
192+
runSetup();
193+
re = getRunFunc("RegExpBench");
194+
}
195+
196+
@TearDown(Level.Trial)
197+
public void tearDown() {
198+
runCleanup();
199+
cleanup();
200+
}
199201
}
200202

201203
@Benchmark
202204
public Object regExp(RegExpState state) {
203-
return state.re.call(state.cx, state.scope, state.scope, emptyArgs);
205+
return state.re.call(state.cx, state.scope, state.scope, emptyArgs);
204206
}
205-
*/
206207

207208
@State(Scope.Thread)
208209
public static class RichardsState extends AbstractState {

benchmarks/testsrc/benchmarks/v8-benchmarks-v6/regexp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
// scrambled to exercise the regexp engine on different input strings.
3838

3939

40-
var RegExp = new BenchmarkSuite('RegExp', 910985, [
41-
new Benchmark("RegExp", RegExpRun, RegExpSetup, RegExpTearDown)
40+
var RegExpBench = new BenchmarkSuite('RegExpBench', 910985, [
41+
new Benchmark("RegExpBench", RegExpRun, RegExpSetup, RegExpTearDown)
4242
]);
4343

4444
var regExpBenchmark = null;

0 commit comments

Comments
 (0)