mirrored from https://chromium.googlesource.com/v8/v8.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jsperf] Add benchmark for LoadConstantFromPrototype
Bug: v8:9616 Change-Id: Ieca74f8df90b342672c8904beef2c2298f0ba597 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1755991 Reviewed-by: Igor Sheludko <ishell@chromium.org> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#63221}
- Loading branch information
Showing
3 changed files
with
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2019 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
new BenchmarkSuite('LoadConstantFromPrototype', [1000], [ | ||
new Benchmark('LoadConstantFromPrototype', false, false, 0, LoadConstantFromPrototype) | ||
]); | ||
|
||
function Foo() {}; | ||
|
||
Foo.prototype.bar = {}; | ||
Foo.prototype.covfefe = function() {}; | ||
Foo.prototype.baz = 1; | ||
|
||
function LoadConstantFromPrototype() { | ||
let foo = new Foo(); | ||
|
||
for (let i = 0; i < 1000; ++i) { | ||
foo.bar; | ||
foo.covfefe; | ||
foo.baz; | ||
} | ||
} |
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,24 @@ | ||
// Copyright 2019 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
load('../base.js'); | ||
|
||
load('loadconstantfromprototype.js'); | ||
|
||
function PrintResult(name, result) { | ||
print(name + '-IC(Score): ' + result); | ||
} | ||
|
||
function PrintStep(name) {} | ||
|
||
function PrintError(name, error) { | ||
PrintResult(name, error); | ||
} | ||
|
||
BenchmarkSuite.config.doWarmup = undefined; | ||
BenchmarkSuite.config.doDeterministic = undefined; | ||
|
||
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, | ||
NotifyError: PrintError, | ||
NotifyStep: PrintStep }); |
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