Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: test/js-perf-test/Exceptions/try-catch.js

Issue 1155493007: Micro benchmark for Try-Catch-Finally (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/js-perf-test/Exceptions/run.js ('k') | test/js-perf-test/JSTests.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 new BenchmarkSuite( 'Try-Catch', [1000], [
Michael Starzinger 2015/06/03 11:06:21 nit: Dangling white-space before string.
Michael Hablich 2015/06/03 11:16:13 Done.
6 new Benchmark('OnSuccess', false, false, 0,
7 OnSuccess, OnSuccessSetup,
8 OnSuccessTearDown),
9 new Benchmark('OnException', false, false, 0,
10 OnException, OnExceptionSetup,
11 OnExceptionTearDown),
12 new Benchmark('OnSuccessFinallyOnly', false, false, 0,
13 OnSuccessFinallyOnly, OnSuccessFinallyOnlySetup,
14 OnSuccessFinallyOnlyTearDown),
15 new Benchmark('WithFinallyOnException', false, false, 0,
16 WithFinallyOnException, WithFinallyOnExceptionSetup, WithFinally OnExceptionTearDown)
17 ]);
18
19 var a;
20 var b;
21 var c;
22
23 // ----------------------------------------------------------------------------
24
25 function OnSuccessSetup() {
26 var a = 4;
27 var b = 6;
28 var c = 0;
29 }
30
31 function OnSuccess() {
32 try {
33 c = a + b;
34 }
35 catch (e) {
36 }
37 }
38
39 function OnSuccessTearDown() {
40 return c === 10;
41 }
42
43 // ----------------------------------------------------------------------------
44
45 function OnExceptionSetup() {
46 var a = 4;
47 var b = 6;
48 var c = 0;
49 }
50
51 function OnException() {
52 try {
53 throw 'Test exception';
54 }
55 catch (e) {
56 c = a + b;
57 }
58 }
59
60 function OnExceptionTearDown() {
61 return c === 10;
62 }
63
64 // ----------------------------------------------------------------------------
65
66 function OnSuccessFinallyOnlySetup() {
67 var a = 4;
68 var b = 6;
69 var c = 0;
70 }
71
72 function OnSuccessFinallyOnly() {
73 try {
74 c = a + b;
75 }
76 finally {
77 c++;
78 }
79 }
80
81 function OnSuccessFinallyOnlyTearDown() {
82 return c === 11;
83 }
84
85 // ----------------------------------------------------------------------------
86
87 function WithFinallyOnExceptionSetup() {
88 var a = 4;
89 var b = 6;
90 var c = 0;
91 }
92
93 function WithFinallyOnException() {
94 try {
95 throw 'Test exception';
96 }
97 catch (e) {
98 c = a + b;
99 }
100 finally {
101 c++;
102 }
103 }
104
105 function WithFinallyOnExceptionTearDown() {
106 return c === 11;
107 }
108 // ----------------------------------------------------------------------------
OLDNEW
« no previous file with comments | « test/js-perf-test/Exceptions/run.js ('k') | test/js-perf-test/JSTests.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698