Commit f6a83e36 authored by Juliana Franco's avatar Juliana Franco Committed by Commit Bot

[Test] Test case to investigate the impact of removing the weak list

of optimized JS functions.

Bug: v8:6637
Change-Id: Ice94a4a2187f98adcbf25ac1832e13d4b7529f34
Reviewed-on: https://chromium-review.googlesource.com/628198
Commit-Queue: Juliana Patricia Vicente Franco <jupvfranco@google.com>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47579}
parent 0852770d
......@@ -121,6 +121,17 @@
{"name": "Closures"}
]
},
{
"name": "ManyClosures",
"path": ["ManyClosures"],
"main": "run.js",
"resources": ["create-many-closures.js"],
"flags": [ "--allow-natives-syntax", "--expose-gc" ],
"results_regexp": "^%s\\-ManyClosures\\(Score\\): (.+)$",
"tests": [
{"name": "ManyClosures"}
]
},
{
"name": "Collections",
"path": ["Collections"],
......
// Copyright 2017 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
// Flags: --allow-natives-syntax --expose-gc
new BenchmarkSuite('ManyClosures', [1000], [
new Benchmark('CreateManyClosures', false, true, 1, CreateManyClosures,
CreateManyClosures_Setup)
]);
// ----------------------------------------------------------------------------
// This program creates many closures and then allocates many arrays in order
// to trigger garbage collection cycles. The goal of this micro-benchmark is to
// evaluate the overhead of keeping the weak-list of optimized JS functions.
//
// c.f. https://bugs.chromium.org/p/v8/issues/detail?id=6637#c5
var a = [];
%NeverOptimizeFunction(CreateManyClosures_Setup);
function CreateManyClosures_Setup() {
function g() {
return (i) => i + 1;
}
// Create a closure and optimize.
var f = g();
f(0);
f(0);
%OptimizeFunctionOnNextCall(f);
f(0);
// Create 2M closures, those will get the optimized code.
a = [];
for (var i = 0; i < 2000000; i++) {
var f = g();
f();
a.push(f);
}
}
%NeverOptimizeFunction(CreateManyClosures);
function CreateManyClosures() {
// Now cause scavenges.
for (var i = 0; i < 50; i++) {
gc(true);
}
}
// Copyright 2015 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('create-many-closures.js');
var success = true;
function PrintResult(name, result) {
print(name + '-ManyClosures(Score): ' + result);
}
function PrintError(name, error) {
PrintResult(name, error);
success = false;
}
BenchmarkSuite.config.doWarmup = undefined;
BenchmarkSuite.config.doDeterministic = undefined;
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyError: PrintError });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment