Commit 72564ba7 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

Revert "[mjsunit][tools][d8] Full roundtrip tickprocessor test"

This reverts commit ed7e4554.

Reason for revert: new test fails on Mac: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Mac64/40407/overview

Original change's description:
> [mjsunit][tools][d8] Full roundtrip tickprocessor test
>
> - Add os.d8Path property
> - Add os.name property
> - Change tickprocssor test to use command line arguments for testing
>   various configurations
> - Change tickprocessor test to create a temporary v8.log and read it
>   back in on linux only
> - Rearrange code in tickprocessor.mjs to allow instantiating the
>   CppEntriesProvider directly
> - Drop complete symbol-list for tickprocessor-test-large.log for better
>   code searching in V8
>
> Change-Id: Ib56dd0a1ba5377282c84c4de6f17e2fd69ee8123
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2929120
> Reviewed-by: Patrick Thier <pthier@chromium.org>
> Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#74892}

Change-Id: I7d7506b370f96365552a21fa767b1c5c608ebb1c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2929380
Auto-Submit: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/master@{#74894}
parent 705527f8
...@@ -2800,24 +2800,6 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { ...@@ -2800,24 +2800,6 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
Local<ObjectTemplate> Shell::CreateOSTemplate(Isolate* isolate) { Local<ObjectTemplate> Shell::CreateOSTemplate(Isolate* isolate) {
Local<ObjectTemplate> os_template = ObjectTemplate::New(isolate); Local<ObjectTemplate> os_template = ObjectTemplate::New(isolate);
AddOSMethods(isolate, os_template); AddOSMethods(isolate, os_template);
#if V8_TARGET_OS_LINUX
const char os_name[] = "linux";
#elif V8_TARGET_OS_WIN
const char os_name[] = "windows";
#elif V8_TARGET_OS_MACOSX
const char os_name[] = "macos";
#elif V8_TARGET_OS_ANDROID
const char os_name[] = "android";
#else
const char os_name[] = "unknown";
#endif
os_template->Set(isolate, "name",
v8::String::NewFromUtf8Literal(isolate, os_name),
PropertyAttribute::ReadOnly);
os_template->Set(
isolate, "d8Path",
v8::String::NewFromUtf8(isolate, options.d8_path).ToLocalChecked(),
PropertyAttribute::ReadOnly);
return os_template; return os_template;
} }
...@@ -4135,7 +4117,6 @@ void Worker::PostMessageOut(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -4135,7 +4117,6 @@ void Worker::PostMessageOut(const v8::FunctionCallbackInfo<v8::Value>& args) {
bool Shell::SetOptions(int argc, char* argv[]) { bool Shell::SetOptions(int argc, char* argv[]) {
bool logfile_per_isolate = false; bool logfile_per_isolate = false;
bool no_always_opt = false; bool no_always_opt = false;
options.d8_path = argv[0];
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
if (strcmp(argv[i], "--") == 0) { if (strcmp(argv[i], "--") == 0) {
argv[i] = nullptr; argv[i] = nullptr;
......
...@@ -351,7 +351,6 @@ class ShellOptions { ...@@ -351,7 +351,6 @@ class ShellOptions {
bool specified_ = false; bool specified_ = false;
}; };
DisallowReassignment<const char*> d8_path = {"d8-path", ""};
DisallowReassignment<bool> fuzzilli_coverage_statistics = { DisallowReassignment<bool> fuzzilli_coverage_statistics = {
"fuzzilli-coverage-statistics", false}; "fuzzilli-coverage-statistics", false};
DisallowReassignment<bool> fuzzilli_enable_builtins_coverage = { DisallowReassignment<bool> fuzzilli_enable_builtins_coverage = {
...@@ -542,30 +541,29 @@ class Shell : public i::AllStatic { ...@@ -542,30 +541,29 @@ class Shell : public i::AllStatic {
// milliseconds on the total running time of the program. Exceptions are // milliseconds on the total running time of the program. Exceptions are
// thrown on timeouts or other errors or if the exit status of the program // thrown on timeouts or other errors or if the exit status of the program
// indicates an error. // indicates an error.
static void System(const v8::FunctionCallbackInfo<v8::Value>& args); //
// os.chdir(dir) changes directory to the given directory. Throws an // os.chdir(dir) changes directory to the given directory. Throws an
// exception/ on error. // exception/ on error.
static void ChangeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args); //
// os.setenv(variable, value) sets an environment variable. Repeated calls to // os.setenv(variable, value) sets an environment variable. Repeated calls to
// this method leak memory due to the API of setenv in the standard C library. // this method leak memory due to the API of setenv in the standard C library.
static void SetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args); //
static void UnsetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args);
// os.umask(alue) calls the umask system call and returns the old umask. // os.umask(alue) calls the umask system call and returns the old umask.
static void SetUMask(const v8::FunctionCallbackInfo<v8::Value>& args); //
// os.mkdirp(name, mask) creates a directory. The mask (if present) is anded // os.mkdirp(name, mask) creates a directory. The mask (if present) is anded
// with the current umask. Intermediate directories are created if necessary. // with the current umask. Intermediate directories are created if necessary.
// An exception is not thrown if the directory already exists. Analogous to // An exception is not thrown if the directory already exists. Analogous to
// the "mkdir -p" command. // the "mkdir -p" command.
static void System(const v8::FunctionCallbackInfo<v8::Value>& args);
static void ChangeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args);
static void SetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args);
static void UnsetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args);
static void SetUMask(const v8::FunctionCallbackInfo<v8::Value>& args);
static void MakeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args); static void MakeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args);
static void RemoveDirectory(const v8::FunctionCallbackInfo<v8::Value>& args); static void RemoveDirectory(const v8::FunctionCallbackInfo<v8::Value>& args);
static MaybeLocal<Promise> HostImportModuleDynamically( static MaybeLocal<Promise> HostImportModuleDynamically(
Local<Context> context, Local<ScriptOrModule> referrer, Local<Context> context, Local<ScriptOrModule> referrer,
Local<String> specifier, Local<FixedArray> import_assertions); Local<String> specifier, Local<FixedArray> import_assertions);
static void ModuleResolutionSuccessCallback( static void ModuleResolutionSuccessCallback(
const v8::FunctionCallbackInfo<v8::Value>& info); const v8::FunctionCallbackInfo<v8::Value>& info);
static void ModuleResolutionFailureCallback( static void ModuleResolutionFailureCallback(
......
...@@ -41,10 +41,6 @@ function arg_error(str) { ...@@ -41,10 +41,6 @@ function arg_error(str) {
} }
} }
const kOsNameValues = ['linux', 'macos', 'windows', 'android', 'unknown'];
assertTrue(kOsNameValues.includes(os.name));
assertTrue(os.d8Path.length > 0);
function str_error(str) { function str_error(str) {
var e = new Object(); var e = new Object();
......
...@@ -2,30 +2,49 @@ Statistical profiling result from v8.log, (303 ticks, 0 unaccounted, 0 excluded) ...@@ -2,30 +2,49 @@ Statistical profiling result from v8.log, (303 ticks, 0 unaccounted, 0 excluded)
[Shared libraries]: [Shared libraries]:
ticks total nonlib name ticks total nonlib name
24 7.9% /usr/local/google/home/cbruni/Documents/v8/v8/out/x64.release/d8 9 3.0% /usr/local/google/home/cbruni/Documents/v8/v8/out/x64.release/d8
10 3.3% /usr/lib/x86_64-linux-gnu/libc-2.31.so 6 2.0% /usr/lib/x86_64-linux-gnu/libc-2.31.so
4 1.3% /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
[JavaScript]: [JavaScript]:
ticks total nonlib name ticks total nonlib name
102 33.7% 38.5% LazyCompile: *<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1 102 33.7% 35.4% LazyCompile: *<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
25 8.3% 9.4% LazyCompile: *ics test/mjsunit/tools/tickprocessor-test.js:47:13 25 8.3% 8.7% LazyCompile: *ics test/mjsunit/tools/tickprocessor-test.js:47:13
21 6.9% 7.9% LazyCompile: *loop test/mjsunit/tools/tickprocessor-test.js:10:14 21 6.9% 7.3% LazyCompile: *loop test/mjsunit/tools/tickprocessor-test.js:10:14
[C++]: [C++]:
ticks total nonlib name ticks total nonlib name
99 32.7% 37.4% v8_Default_embedded_blob_code_data_ 99 32.7% 34.4% v8_Default_embedded_blob_code_data_
12 4.0% 4.5% __write 12 4.0% 4.2% __write
3 1.0% 1.1% fwrite 3 1.0% 1.0% fwrite
2 0.7% 0.8% v8::internal::RootScavengeVisitor::VisitRootPointer(v8::internal::Root, char const*, v8::internal::FullObjectSlot) 2 0.7% 0.7% v8::internal::RootScavengeVisitor::VisitRootPointer(v8::internal::Root, char const*, v8::internal::FullObjectSlot)
1 0.3% 0.4% v8::internal::compiler::TopLevelLiveRange::AddUseInterval(v8::internal::compiler::LifetimePosition, v8::internal::compiler::LifetimePosition, v8::internal::Zone*, bool) 2 0.7% 0.7% __pthread_mutex_unlock_usercnt
2 0.7% 0.7% __libc_malloc
2 0.7% 0.7% _IO_file_xsputn
1 0.3% 0.3% v8::internal::compiler::TopLevelLiveRange::AddUseInterval(v8::internal::compiler::LifetimePosition, v8::internal::compiler::LifetimePosition, v8::internal::Zone*, bool)
1 0.3% 0.3% v8::internal::compiler::Scheduler::PrepareUses()
1 0.3% 0.3% v8::internal::compiler::CommonOperatorBuilder::CommonOperatorBuilder(v8::internal::Zone*)
1 0.3% 0.3% v8::internal::SpaceWithLinearArea::AdvanceAllocationObservers()
1 0.3% 0.3% v8::internal::SerializerDeserializer::Iterate(v8::internal::Isolate*, v8::internal::RootVisitor*)
1 0.3% 0.3% v8::internal::Log::MessageBuilder::AppendString(char const*, unsigned long, bool)
1 0.3% 0.3% v8::internal::LargeObjectSpace::SizeOfObjects()
1 0.3% 0.3% v8::internal::Heap::Scavenge()
1 0.3% 0.3% v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment)
1 0.3% 0.3% v8::internal::Heap::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment)
1 0.3% 0.3% v8::OutputStream::GetChunkSize()
1 0.3% 0.3% std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char)
1 0.3% 0.3% std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > >::do_put(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, std::__1::ios_base&, char, long) const
1 0.3% 0.3% std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(unsigned long)
1 0.3% 0.3% int v8::internal::Deserializer::ReadSingleBytecodeData<v8::internal::SlotAccessorForHeapObject>(unsigned char, v8::internal::SlotAccessorForHeapObject)
1 0.3% 0.3% __pthread_cond_wait
1 0.3% 0.3% __pthread_cond_signal
1 0.3% 0.3% Cr_z_inflate_fast_chunk_
[Summary]: [Summary]:
ticks total nonlib name ticks total nonlib name
148 48.8% 55.8% JavaScript 148 48.8% 51.4% JavaScript
117 38.6% 44.2% C++ 140 46.2% 48.6% C++
20 6.6% 7.5% GC 20 6.6% 6.9% GC
38 12.5% Shared libraries 15 5.0% Shared libraries
[C++ entry points]: [C++ entry points]:
ticks cpp total name ticks cpp total name
...@@ -50,25 +69,17 @@ Statistical profiling result from v8.log, (303 ticks, 0 unaccounted, 0 excluded) ...@@ -50,25 +69,17 @@ Statistical profiling result from v8.log, (303 ticks, 0 unaccounted, 0 excluded)
25 8.3% LazyCompile: *ics test/mjsunit/tools/tickprocessor-test.js:47:13 25 8.3% LazyCompile: *ics test/mjsunit/tools/tickprocessor-test.js:47:13
25 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1 25 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
24 7.9% /usr/local/google/home/cbruni/Documents/v8/v8/out/x64.release/d8
4 16.7% LazyCompile: ~ics test/mjsunit/tools/tickprocessor-test.js:47:13
4 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
3 12.5% v8::internal::Runtime_CompileForOnStackReplacement(int, unsigned long*, v8::internal::Isolate*)
2 66.7% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
1 33.3% LazyCompile: ~loop test/mjsunit/tools/tickprocessor-test.js:10:14
1 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
2 8.3% v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*)
2 100.0% LazyCompile: *<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
2 8.3% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
2 8.3% LazyCompile: ~read_megamorphic test/mjsunit/tools/tickprocessor-test.js:35:26
2 100.0% LazyCompile: ~ics test/mjsunit/tools/tickprocessor-test.js:47:13
2 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
21 6.9% LazyCompile: *loop test/mjsunit/tools/tickprocessor-test.js:10:14 21 6.9% LazyCompile: *loop test/mjsunit/tools/tickprocessor-test.js:10:14
21 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1 21 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
12 4.0% __write 12 4.0% __write
10 3.3% /usr/lib/x86_64-linux-gnu/libc-2.31.so 9 3.0% /usr/local/google/home/cbruni/Documents/v8/v8/out/x64.release/d8
4 44.4% LazyCompile: ~ics test/mjsunit/tools/tickprocessor-test.js:47:13
4 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
2 22.2% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
2 22.2% LazyCompile: ~read_megamorphic test/mjsunit/tools/tickprocessor-test.js:35:26
2 100.0% LazyCompile: ~ics test/mjsunit/tools/tickprocessor-test.js:47:13
2 100.0% Script: ~<anonymous> test/mjsunit/tools/tickprocessor-test.js:1:1
4 1.3% /usr/lib/x86_64-linux-gnu/libpthread-2.31.so 6 2.0% /usr/lib/x86_64-linux-gnu/libc-2.31.so
...@@ -53,6 +53,6 @@ function ics() { ...@@ -53,6 +53,6 @@ function ics() {
} }
} }
for (let i = 0; i < 10_000; i++) { for (let i = 0; i < 100_000; i++) {
ics(); ics();
} }
...@@ -25,11 +25,9 @@ ...@@ -25,11 +25,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --enable-os-system
// Resources: test/mjsunit/tools/tickprocessor-test-func-info.log // Resources: test/mjsunit/tools/tickprocessor-test-func-info.log
// Resources: test/mjsunit/tools/tickprocessor-test-func-info.log.symbols.json // Resources: test/mjsunit/tools/tickprocessor-test-func-info.log.symbols.json
// Resources: test/mjsunit/tools/tickprocessor-test-large.default // Resources: test/mjsunit/tools/tickprocessor-test-large.default
// Resources: test/mjsunit/tools/tickprocessor-test-large.js
// Resources: test/mjsunit/tools/tickprocessor-test-large.log // Resources: test/mjsunit/tools/tickprocessor-test-large.log
// Resources: test/mjsunit/tools/tickprocessor-test-large.log.symbols.json // Resources: test/mjsunit/tools/tickprocessor-test-large.log.symbols.json
// Resources: test/mjsunit/tools/tickprocessor-test.default // Resources: test/mjsunit/tools/tickprocessor-test.default
...@@ -42,12 +40,23 @@ ...@@ -42,12 +40,23 @@
// Resources: test/mjsunit/tools/tickprocessor-test.separate-baseline-handlers // Resources: test/mjsunit/tools/tickprocessor-test.separate-baseline-handlers
// Resources: test/mjsunit/tools/tickprocessor-test.separate-bytecodes // Resources: test/mjsunit/tools/tickprocessor-test.separate-bytecodes
// Resources: test/mjsunit/tools/tickprocessor-test.separate-ic // Resources: test/mjsunit/tools/tickprocessor-test.separate-ic
// Env: TEST_FILE_NAME
import { import {
TickProcessor, ArgumentsProcessor, UnixCppEntriesProvider, TickProcessor, ArgumentsProcessor, UnixCppEntriesProvider,
MacCppEntriesProvider, WindowsCppEntriesProvider MacCppEntriesProvider, WindowsCppEntriesProvider
} from "../../../tools/tickprocessor.mjs"; } from "../../../tools/tickprocessor.mjs";
// TODO(cbruni): Remove after refactoring
export function readFile(fileName) {
try {
return read(fileName);
} catch (e) {
console.log(fileName + ': ' + (e.message || e));
throw e;
}
}
(function testArgumentsProcessor() { (function testArgumentsProcessor() {
var p_default = new ArgumentsProcessor([]); var p_default = new ArgumentsProcessor([]);
assertTrue(p_default.parse()); assertTrue(p_default.parse());
...@@ -363,7 +372,7 @@ import { ...@@ -363,7 +372,7 @@ import {
class CppEntriesProviderMock { class CppEntriesProviderMock {
constructor(filename) { constructor(filename) {
this.isLoaded = false; this.isLoaded = false;
this.symbols = JSON.parse(d8.file.read(filename)); this.symbols = JSON.parse(readFile(filename));
} }
parseVmSymbols(name, startAddr, endAddr, slideAddr, symbolAdder) { parseVmSymbols(name, startAddr, endAddr, slideAddr, symbolAdder) {
if (this.isLoaded) return; if (this.isLoaded) return;
...@@ -383,17 +392,17 @@ class PrintMonitor { ...@@ -383,17 +392,17 @@ class PrintMonitor {
this.expectedOut = this.loadExpectedOutput(outputOrFileName) this.expectedOut = this.loadExpectedOutput(outputOrFileName)
this.outputFile = outputOrFileName; this.outputFile = outputOrFileName;
} }
let expectedOut = this.expectedOut; var expectedOut = this.expectedOut;
let outputPos = 0; var outputPos = 0;
let diffs = this.diffs = []; var diffs = this.diffs = [];
let realOut = this.realOut = []; var realOut = this.realOut = [];
let unexpectedOut = this.unexpectedOut = null; var unexpectedOut = this.unexpectedOut = null;
this.oldPrint = print; this.oldPrint = print;
print = function(str) { print = function(str) {
const strSplit = str.split('\n'); var strSplit = str.split('\n');
for (let i = 0; i < strSplit.length; ++i) { for (var i = 0; i < strSplit.length; ++i) {
const s = strSplit[i]; var s = strSplit[i];
realOut.push(s); realOut.push(s);
if (outputPos < expectedOut.length) { if (outputPos < expectedOut.length) {
if (expectedOut[outputPos] != s) { if (expectedOut[outputPos] != s) {
...@@ -409,95 +418,98 @@ class PrintMonitor { ...@@ -409,95 +418,98 @@ class PrintMonitor {
} }
loadExpectedOutput(fileName) { loadExpectedOutput(fileName) {
const output = d8.file.read(fileName); var output = readFile(fileName);
return output.split('\n'); return output.split('\n');
} }
finish() { finish() {
print = this.oldPrint; print = this.oldPrint;
if (this.diffs.length == 0 && this.unexpectedOut == null) return; if (this.diffs.length > 0 || this.unexpectedOut != null) {
console.log("===== actual output: ====="); console.log("===== actual output: =====");
console.log(this.realOut.join('\n')); console.log(this.realOut.join('\n'));
console.log("===== expected output: ====="); console.log("===== expected output: =====");
if (this.outputFile) { if (this.outputFile) {
console.log("===== File: " + this.outputFile + " ====="); console.log("===== File: " + this.outputFile + " =====");
} }
console.log(this.expectedOut.join('\n')); console.log(this.expectedOut.join('\n'));
if (this.diffs.length > 0) { if (this.diffs.length > 0) {
this.diffs.forEach(line => console.log(line)) this.diffs.forEach(line => console.log(line))
assertEquals([], this.diffs); assertEquals([], this.diffs);
}
assertNull(this.unexpectedOut);
} }
assertNull(this.unexpectedOut);
} }
} }
function driveTickProcessorTest(
separateIc, separateBytecodes, separateBuiltins, separateStubs,
separateBaselineHandlers, ignoreUnknown, stateFilter, logInput,
refOutput, onlySummary) {
// TEST_FILE_NAME must be provided by test runner.
assertEquals('string', typeof TEST_FILE_NAME);
var pathLen = TEST_FILE_NAME.lastIndexOf('/');
if (pathLen == -1) {
pathLen = TEST_FILE_NAME.lastIndexOf('\\');
}
assertTrue(pathLen != -1);
const testsPath = TEST_FILE_NAME.substr(0, pathLen + 1);
const symbolsFile = testsPath + logInput + '.symbols.json';
const tp = new TickProcessor(new CppEntriesProviderMock(symbolsFile),
separateIc,
separateBytecodes,
separateBuiltins,
separateStubs,
separateBaselineHandlers,
TickProcessor.CALL_GRAPH_SIZE,
ignoreUnknown,
stateFilter,
"0",
"auto,auto",
null,
false,
false,
onlySummary);
const pm = new PrintMonitor(testsPath + refOutput);
tp.processLogFileInTest(testsPath + logInput);
tp.printStatistics();
pm.finish();
};
(function testProcessing() { (function testProcessing() {
const testData = { var testData = {
'Default': [ 'Default': [
'tickprocessor-test.log', 'tickprocessor-test.default', false, false, true, true, false, false, null,
['--separate-ic=false']], 'tickprocessor-test.log', 'tickprocessor-test.default', false],
'SeparateBytecodes': [ 'SeparateBytecodes': [
'tickprocessor-test.log', 'tickprocessor-test.separate-bytecodes', false, true, true, true, false, false, null,
['--separate-ic=false', '--separate-bytecodes']], 'tickprocessor-test.log', 'tickprocessor-test.separate-bytecodes', false],
'SeparateBaselineHandlers': [ 'SeparateBaselineHandlers': [
'tickprocessor-test.log', 'tickprocessor-test.separate-baseline-handlers', false, false, true, true, true, false, null,
['--separate-ic=false', '--separate-baseline-handlers']], 'tickprocessor-test.log', 'tickprocessor-test.separate-baseline-handlers', false],
'SeparateIc': [ 'SeparateIc': [
'tickprocessor-test.log', 'tickprocessor-test.separate-ic', true, false, true, true, false, false, null,
['--separate-ic=true']], 'tickprocessor-test.log', 'tickprocessor-test.separate-ic', false],
'IgnoreUnknown': [ 'IgnoreUnknown': [
'tickprocessor-test.log', 'tickprocessor-test.ignore-unknown', false, false, true, true, false, true, null,
['--separate-ic=false', '--ignore-unknown']], 'tickprocessor-test.log', 'tickprocessor-test.ignore-unknown', false],
'GcState': [ 'GcState': [
'tickprocessor-test.log', 'tickprocessor-test.gc-state', ['-g']], false, false, true, true, false, false, TickProcessor.VmStates.GC,
'tickprocessor-test.log', 'tickprocessor-test.gc-state', false],
'OnlySummary': [ 'OnlySummary': [
'tickprocessor-test.log', 'tickprocessor-test.only-summary', false, false, true, true, false, false, null,
['--separate-ic=false', '--only-summary']], 'tickprocessor-test.log', 'tickprocessor-test.only-summary', true],
'FunctionInfo': [ 'FunctionInfo': [
false, false, true, true, false, false, null,
'tickprocessor-test-func-info.log', 'tickprocessor-test.func-info', 'tickprocessor-test-func-info.log', 'tickprocessor-test.func-info',
[''] false],
],
'DefaultLarge': [ 'DefaultLarge': [
'tickprocessor-test-large.log', 'tickprocessor-test-large.default'], false, false, true, true, false, false, null,
'tickprocessor-test-large.log', 'tickprocessor-test-large.default', false],
}; };
for (var testName in testData) { for (var testName in testData) {
console.log('=== testProcessing-' + testName + ' ==='); console.log('=== testProcessing-' + testName + ' ===');
testTickProcessor(...testData[testName]); driveTickProcessorTest(...testData[testName]);
} }
})(); })();
function testTickProcessor(logInput, refOutput, args=[]) {
// /foo/bar/tickprocesser.mjs => /foo/bar/
const dir = import.meta.url.split("/").slice(0, -1).join('/') + '/';
const params = ArgumentsProcessor.process(args);
testExpectations(dir + logInput, dir + refOutput, params);
testEndToEnd(dir + 'tickprocessor-test-large.js', dir + refOutput, params);
}
function testExpectations(logInput, refOutput, params) {
const symbolsFile = logInput + '.symbols.json';
const cppEntries = new CppEntriesProviderMock(symbolsFile);
const tickProcessor = TickProcessor.fromParams(params, cppEntries);
const printMonitor = new PrintMonitor(refOutput);
tickProcessor.processLogFileInTest(logInput);
tickProcessor.printStatistics();
printMonitor.finish();
};
function testEndToEnd(sourceFile, ignoredRefOutput, params) {
// This test only works on linux.
if (!os?.system) return;
if (os.name !== 'linux' && os.name !== 'macos') return;
params.platform = os.name;
const tmpLogFile= `/var/tmp/${Date.now()}.v8.log`
const result = os.system(
os.d8Path, ['--prof', `--logfile=${tmpLogFile}`, sourceFile]);
const tickProcessor = TickProcessor.fromParams(params);
// We will not always get the same ticks due to timing on bots,
// hence we cannot properly compare output expectations.
// Let's just use a dummy file and only test whether we don't throw.
const printMonitor = new PrintMonitor(ignoredRefOutput);
tickProcessor.processLogFileInTest(tmpLogFile);
tickProcessor.printStatistics();
}
\ No newline at end of file
...@@ -25,11 +25,41 @@ ...@@ -25,11 +25,41 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import { ArgumentsProcessor, TickProcessor } from "./tickprocessor.mjs"; import {
ArgumentsProcessor, TickProcessor, UnixCppEntriesProvider,
WindowsCppEntriesProvider, MacCppEntriesProvider
} from "./tickprocessor.mjs";
// Tick Processor's code flow.
const entriesProviders = {
'unix': UnixCppEntriesProvider,
'windows': WindowsCppEntriesProvider,
'mac': MacCppEntriesProvider
};
const params = ArgumentsProcessor.process(arguments); const params = ArgumentsProcessor.process(arguments);
const tickProcessor = TickProcessor.fromParams(params); const tickProcessor = new TickProcessor(
new (entriesProviders[params.platform])(params.nm, params.objdump, params.targetRootFS,
params.apkEmbeddedLibrary),
params.separateIc,
params.separateBytecodes,
params.separateBuiltins,
params.separateStubs,
params.separateBaselineHandlers,
params.callGraphSize,
params.ignoreUnknown,
params.stateFilter,
params.distortion,
params.range,
params.sourceMap,
params.timedRange,
params.pairwiseTimedRange,
params.onlySummary,
params.runtimeTimerFilter,
params.preprocessJson);
tickProcessor.processLogFile(params.logFileName); tickProcessor.processLogFile(params.logFileName);
if (params.serializeVMSymbols) { if (params.serializeVMSymbols) {
tickProcessor.printVMSymbols(); tickProcessor.printVMSymbols();
} else { } else {
......
This diff is collapsed.
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