This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1465336 - add six-speed to jsshell-bench framework. r=ahal
- Loading branch information
Showing
56 changed files
with
878 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
|
||
function assertEqual() {} | ||
function test(fn) { | ||
var its = iterations; | ||
var start = Date.now(); | ||
for (var i = 0; i < its; i++) { | ||
fn(); | ||
} | ||
timing = Date.now() - start; | ||
} | ||
|
||
var tests = [ | ||
"template_string", | ||
"defaults", | ||
"map-set-lookup", | ||
"spread", | ||
"object-assign", | ||
"spread-literal", | ||
"map-set", | ||
"destructuring-simple", | ||
"super", | ||
"for-of-object", | ||
"rest", | ||
"regex-u", | ||
"arrow", | ||
"bindings-compound", | ||
"classes", | ||
"template_string_tag", | ||
"map-string", | ||
"arrow-declare", | ||
"spread-generator", | ||
"object-literal-ext", | ||
"generator", | ||
"arrow-args", | ||
"for-of-array", | ||
"bindings", | ||
"destructuring", | ||
"map-set-object" | ||
] | ||
var iteration_for_test = [ | ||
200000000, | ||
100000000, | ||
200000, | ||
1000000, | ||
600000, | ||
1000000, | ||
10000, | ||
20000000, | ||
3000000, | ||
1000000, | ||
500000, | ||
1000000, | ||
20000000, | ||
20000000, | ||
10000000, | ||
2000000, | ||
30000000, | ||
30000000, | ||
1000000, | ||
1000000, | ||
3000000, | ||
20000000, | ||
5000000, | ||
20000000, | ||
20000000, | ||
5000 | ||
] | ||
|
||
for (var z = 0; z < tests.length; z++) { | ||
var timing = 0; | ||
var testname = tests[z]; | ||
var iterations = iteration_for_test[z]; | ||
|
||
// ES5 | ||
var content = read("tests/"+testname+".es5") | ||
var func = new Function(content); | ||
func(); | ||
print(testname+"-es5:", timing); | ||
|
||
// ES6 | ||
var content = read("tests/"+testname+".es6") | ||
var func = new Function(content); | ||
func(); | ||
print(testname+"-es6:", timing); | ||
} |
16 changes: 16 additions & 0 deletions
16
third_party/webkit/PerformanceTests/six-speed/tests/arrow-args.es5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var obj = { | ||
value: 42, | ||
fn: function() { | ||
var args = arguments; | ||
return function() { | ||
return args[0]; | ||
}; | ||
} | ||
}; | ||
|
||
var fn = obj.fn(1); | ||
assertEqual(fn(), 1); | ||
|
||
test(function() { | ||
fn(); | ||
}); |
14 changes: 14 additions & 0 deletions
14
third_party/webkit/PerformanceTests/six-speed/tests/arrow-args.es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
var obj = { | ||
value: 42, | ||
fn: function() { | ||
return () => arguments[0]; | ||
} | ||
}; | ||
|
||
var fn = obj.fn(1); | ||
assertEqual(fn(), 1); | ||
|
||
test(function() { | ||
fn(); | ||
}); |
14 changes: 14 additions & 0 deletions
14
third_party/webkit/PerformanceTests/six-speed/tests/arrow-declare.es5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var obj = { | ||
value: 42, | ||
fn: function() { | ||
return function() { | ||
return obj.value; | ||
}; | ||
} | ||
}; | ||
|
||
assertEqual(obj.fn()(), 42); | ||
|
||
test(function() { | ||
obj.fn(); | ||
}); |
13 changes: 13 additions & 0 deletions
13
third_party/webkit/PerformanceTests/six-speed/tests/arrow-declare.es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
var obj = { | ||
value: 42, | ||
fn: function() { | ||
return () => this.value; | ||
} | ||
}; | ||
|
||
assertEqual(obj.fn()(), 42); | ||
|
||
test(function() { | ||
obj.fn(); | ||
}); |
15 changes: 15 additions & 0 deletions
15
third_party/webkit/PerformanceTests/six-speed/tests/arrow.es5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var obj = { | ||
value: 42, | ||
fn: function() { | ||
return function() { | ||
return obj.value; | ||
}; | ||
} | ||
}; | ||
|
||
var fn = obj.fn(); | ||
assertEqual(fn(), 42); | ||
|
||
test(function() { | ||
fn(); | ||
}); |
14 changes: 14 additions & 0 deletions
14
third_party/webkit/PerformanceTests/six-speed/tests/arrow.es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
var obj = { | ||
value: 42, | ||
fn: function() { | ||
return () => this.value; | ||
} | ||
}; | ||
|
||
var fn = obj.fn(); | ||
assertEqual(fn(), 42); | ||
|
||
test(function() { | ||
fn(); | ||
}); |
11 changes: 11 additions & 0 deletions
11
third_party/webkit/PerformanceTests/six-speed/tests/bindings-compound.es5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var b = 2; | ||
|
||
assertEqual(fn(), 3); | ||
|
||
function fn() { | ||
var a = 1; | ||
a += b; | ||
|
||
return a; | ||
} | ||
test(fn); |
14 changes: 14 additions & 0 deletions
14
third_party/webkit/PerformanceTests/six-speed/tests/bindings-compound.es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"use strict"; | ||
|
||
const b = 2; | ||
|
||
function fn() { | ||
|
||
let a = 1; | ||
a += b; | ||
|
||
return a; | ||
} | ||
|
||
assertEqual(fn(), 3); | ||
test(fn); |
8 changes: 8 additions & 0 deletions
8
third_party/webkit/PerformanceTests/six-speed/tests/bindings.es5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var a = 1, | ||
b = 2; | ||
|
||
assertEqual(a+b, 3); | ||
|
||
test(function() { | ||
return a + b; | ||
}); |
10 changes: 10 additions & 0 deletions
10
third_party/webkit/PerformanceTests/six-speed/tests/bindings.es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"use strict"; | ||
|
||
const a = 1; | ||
let b = 2; | ||
|
||
assertEqual(a+b, 3); | ||
|
||
test(function() { | ||
return a + b; | ||
}); |
11 changes: 11 additions & 0 deletions
11
third_party/webkit/PerformanceTests/six-speed/tests/classes.es5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function C() { | ||
this.foo = 'bar'; | ||
} | ||
C.prototype.bar = function() { | ||
}; | ||
|
||
assertEqual(new C().foo, 'bar'); | ||
|
||
test(function() { | ||
return new C(); | ||
}); |
13 changes: 13 additions & 0 deletions
13
third_party/webkit/PerformanceTests/six-speed/tests/classes.es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class C { | ||
constructor() { | ||
this.foo = 'bar'; | ||
} | ||
bar() { | ||
} | ||
} | ||
|
||
assertEqual(new C().foo, 'bar'); | ||
|
||
test(function() { | ||
return new C(); | ||
}); |
14 changes: 14 additions & 0 deletions
14
third_party/webkit/PerformanceTests/six-speed/tests/defaults.es5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
function fn(arg, other) { | ||
arg = arg === undefined ? 1 : arg; | ||
other = other === undefined ? 3 : other; | ||
return other; | ||
} | ||
|
||
assertEqual(fn(), 3); | ||
assertEqual(fn(1, 2), 2); | ||
|
||
test(function() { | ||
fn(); | ||
fn(2); | ||
fn(2, 4); | ||
}); |
13 changes: 13 additions & 0 deletions
13
third_party/webkit/PerformanceTests/six-speed/tests/defaults.es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function fn(arg = 1, other = 3) { | ||
return other; | ||
} | ||
|
||
|
||
assertEqual(fn(), 3); | ||
assertEqual(fn(1, 2), 2); | ||
|
||
test(function() { | ||
fn(); | ||
fn(2); | ||
fn(2, 4); | ||
}); |
14 changes: 14 additions & 0 deletions
14
third_party/webkit/PerformanceTests/six-speed/tests/destructuring-simple.es5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var data = { | ||
a: 'foo', | ||
b: {c: 'd'}, | ||
arr: [1, 2, 3] | ||
}; | ||
|
||
function fn() { | ||
var a = data.a, | ||
b = data.b; | ||
return a; | ||
} | ||
|
||
assertEqual(fn(), 'foo'); | ||
test(fn); |
14 changes: 14 additions & 0 deletions
14
third_party/webkit/PerformanceTests/six-speed/tests/destructuring-simple.es6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var data = { | ||
a: 'foo', | ||
b: {c: 'd'}, | ||
arr: [1, 2, 3] | ||
}; | ||
|
||
function fn() { | ||
var {a, b} = data; | ||
return a; | ||
} | ||
|
||
assertEqual(fn(), 'foo'); | ||
|
||
test(fn); |
Oops, something went wrong.