1
0
Fork 0

Added baseline tests for prototype method and function call invocation

newmaster
Mike Gerwitz 2014-03-27 22:49:50 -04:00
parent a1cf650bac
commit 85cc251adf
1 changed files with 29 additions and 0 deletions

View File

@ -105,3 +105,32 @@ common.test( function()
// run the same test internally
foo.testInternal();
// allows us to compare private method invocation times with method
// invocations on a conventional prototype (the increment of `i` is to
// ensure that the function is not optimized away)
( function()
{
var p = function() {};
p.prototype.foo = function() { i++ };
var o = new p();
common.test( function()
{
var i = count;
while ( i-- ) o.foo();
}, count, '[baseline] Invoke method on prototype' );
} )();
// compare with plain old function invocation
( function()
{
var f = function() { i++ };
common.test( function()
{
var i = count;
while ( i-- ) f();
}, count, '[baseline] Invoke function' );
} )();