2017-12-20 12:02:45 +00:00
|
|
|
// 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.
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A thin wrapper around shell's 'read' function showing a file name on error.
|
|
|
|
*/
|
|
|
|
function readFile(fileName) {
|
|
|
|
try {
|
|
|
|
return read(fileName);
|
|
|
|
} catch (e) {
|
|
|
|
console.log(fileName + ': ' + (e.message || e));
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
|
|
// This is the only true formatting, why? For an international audience the
|
|
|
|
// confusion between the decimal and thousands separator is big (alternating
|
|
|
|
// between comma "," vs dot "."). The Swiss formatting uses "'" as a thousands
|
|
|
|
// separator, dropping most of that confusion.
|
2018-06-20 12:08:47 +00:00
|
|
|
const numberFormat = new Intl.NumberFormat('de-CH', {
|
2017-12-20 12:02:45 +00:00
|
|
|
maximumFractionDigits: 2,
|
|
|
|
minimumFractionDigits: 2,
|
|
|
|
});
|
|
|
|
|
|
|
|
function formatNumber(value) {
|
2018-06-20 12:08:47 +00:00
|
|
|
return numberFormat.format(value);
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function BYTES(bytes, total) {
|
|
|
|
let units = ['B ', 'kB', 'mB', 'gB'];
|
|
|
|
let unitIndex = 0;
|
|
|
|
let value = bytes;
|
|
|
|
while (value > 1000 && unitIndex < units.length) {
|
|
|
|
value /= 1000;
|
|
|
|
unitIndex++;
|
|
|
|
}
|
|
|
|
let result = formatNumber(value).padStart(10) + ' ' + units[unitIndex];
|
|
|
|
if (total !== void 0 && total != 0) {
|
|
|
|
result += PERCENT(bytes, total).padStart(5);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
function PERCENT(value, total) {
|
|
|
|
return Math.round(value / total * 100) + "%";
|
|
|
|
}
|
|
|
|
|
|
|
|
// ===========================================================================
|
2018-07-03 08:27:31 +00:00
|
|
|
const kNoTimeMetrics = {
|
|
|
|
__proto__: null,
|
|
|
|
executionDuration: 0,
|
|
|
|
firstEventTimestamp: 0,
|
|
|
|
firstParseEventTimestamp: 0,
|
|
|
|
lastParseEventTimestamp: 0,
|
|
|
|
lastEventTimestamp: 0
|
|
|
|
};
|
|
|
|
|
|
|
|
class CompilationUnit {
|
|
|
|
constructor() {
|
2018-07-10 10:57:41 +00:00
|
|
|
this.isEval = false;
|
|
|
|
|
2018-07-03 08:27:31 +00:00
|
|
|
// Lazily computed properties.
|
|
|
|
this.firstEventTimestamp = -1;
|
|
|
|
this.firstParseEventTimestamp = -1;
|
2018-07-10 10:57:41 +00:00
|
|
|
this.firstCompileEventTimestamp = -1;
|
2018-07-03 08:27:31 +00:00
|
|
|
this.lastParseEventTimestamp = -1;
|
|
|
|
this.lastEventTimestamp = -1;
|
2018-07-10 10:57:41 +00:00
|
|
|
this.deserializationTimestamp = -1;
|
2018-07-03 08:27:31 +00:00
|
|
|
|
|
|
|
this.preparseTimestamp = -1;
|
|
|
|
this.parseTimestamp = -1;
|
|
|
|
this.parse2Timestamp = -1;
|
|
|
|
this.resolutionTimestamp = -1;
|
|
|
|
this.compileTimestamp = -1;
|
2018-07-10 10:57:41 +00:00
|
|
|
this.lazyCompileTimestamp = -1;
|
2018-07-03 08:27:31 +00:00
|
|
|
this.executionTimestamp = -1;
|
2018-07-10 10:57:41 +00:00
|
|
|
this.optimizationTimestamp = -1;
|
2018-07-03 08:27:31 +00:00
|
|
|
|
2018-07-10 10:57:41 +00:00
|
|
|
this.deserializationDuration = -0.0;
|
2018-07-03 08:27:31 +00:00
|
|
|
this.preparseDuration = -0.0;
|
|
|
|
this.parseDuration = -0.0;
|
|
|
|
this.parse2Duration = -0.0;
|
|
|
|
this.resolutionDuration = -0.0;
|
|
|
|
this.scopeResolutionDuration = -0.0;
|
|
|
|
this.lazyCompileDuration = -0.0;
|
|
|
|
this.compileDuration = -0.0;
|
2018-07-10 10:57:41 +00:00
|
|
|
this.optimizeDuration = -0.0;
|
2018-07-03 08:27:31 +00:00
|
|
|
|
|
|
|
this.ownBytes = -1;
|
2018-07-10 10:57:41 +00:00
|
|
|
this.compilationCacheHits = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
finalize() {
|
|
|
|
this.firstEventTimestamp = this.timestampMin(
|
|
|
|
this.deserializationTimestamp, this.parseTimestamp,
|
|
|
|
this.preparseTimestamp, this.resolutionTimestamp,
|
|
|
|
this.executionTimestamp);
|
|
|
|
|
|
|
|
this.firstParseEventTimestamp = this.timestampMin(
|
|
|
|
this.deserializationTimestamp, this.parseTimestamp,
|
|
|
|
this.preparseTimestamp, this.resolutionTimestamp);
|
|
|
|
|
|
|
|
this.firstCompileEventTimestamp = this.rawTimestampMin(
|
|
|
|
this.deserializationTimestamp, this.compileTimestamp,
|
|
|
|
this.lazyCompileTimestamp);
|
|
|
|
// Any excuted script needs to be compiled.
|
|
|
|
if (this.hasBeenExecuted() &&
|
|
|
|
(this.firstCompileEventTimestamp <= 0 ||
|
|
|
|
this.executionTimestamp < this.firstCompileTimestamp)) {
|
|
|
|
console.error('Compile < execution timestamp', this);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.ownBytes < 0) console.error(this, 'Own bytes must be positive');
|
|
|
|
}
|
|
|
|
|
|
|
|
hasBeenExecuted() {
|
|
|
|
return this.executionTimestamp > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
addCompilationCacheHit(timestamp) {
|
|
|
|
this.compilationCacheHits.push(timestamp);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the smallest timestamp from the given list, ignoring
|
|
|
|
// uninitialized (-1) values.
|
|
|
|
rawTimestampMin(...timestamps) {
|
|
|
|
timestamps = timestamps.length == 1 ? timestamps[0] : timestamps;
|
|
|
|
let result = timestamps.reduce((min, item) => {
|
|
|
|
return item == -1 ? min : (min == -1 ? item : Math.min(item, item));
|
|
|
|
}, -1);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
timestampMin(...timestamps) {
|
|
|
|
let result = this.rawTimestampMin(...timestamps);
|
|
|
|
if (Number.isNaN(result) || result < 0) {
|
|
|
|
console.error(
|
|
|
|
'Invalid timestamp min:', {result, timestamps, script: this});
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
timestampMax(...timestamps) {
|
|
|
|
timestamps = timestamps.length == 1 ? timestamps[0] : timestamps;
|
|
|
|
let result = Math.max(...timestamps);
|
|
|
|
if (Number.isNaN(result) || result < 0) {
|
|
|
|
console.error(
|
|
|
|
'Invalid timestamp max:', {result, timestamps, script: this});
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return result;
|
2018-07-03 08:27:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
class Script extends CompilationUnit {
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
constructor(id) {
|
2018-07-03 08:27:31 +00:00
|
|
|
super();
|
2017-12-20 12:02:45 +00:00
|
|
|
if (id === void 0 || id <= 0) {
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
throw new Error(`Invalid id=${id} for script`);
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
2018-06-27 08:50:49 +00:00
|
|
|
this.file = '';
|
|
|
|
this.id = id;
|
|
|
|
|
|
|
|
this.isNative = false;
|
|
|
|
this.isBackgroundCompiled = false;
|
2018-07-10 10:57:41 +00:00
|
|
|
this.isStreamingCompiled = false;
|
2018-06-27 08:50:49 +00:00
|
|
|
|
2017-12-20 12:02:45 +00:00
|
|
|
this.funktions = [];
|
|
|
|
this.metrics = new Map();
|
|
|
|
this.maxNestingLevel = 0;
|
|
|
|
|
|
|
|
this.width = 0;
|
2018-06-20 12:08:47 +00:00
|
|
|
this.bytesTotal = -1;
|
2017-12-20 12:02:45 +00:00
|
|
|
this.finalized = false;
|
|
|
|
this.summary = '';
|
2018-07-03 08:27:31 +00:00
|
|
|
this.source = '';
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setFile(name) {
|
|
|
|
this.file = name;
|
|
|
|
this.isNative = name.startsWith('native ');
|
|
|
|
}
|
|
|
|
|
|
|
|
isEmpty() {
|
2018-07-10 10:57:41 +00:00
|
|
|
return this.funktions.length === 0;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
2018-07-10 10:57:41 +00:00
|
|
|
getFunktionAtStartPosition(start) {
|
2018-07-03 08:27:31 +00:00
|
|
|
if (!this.isEval && start === 0) {
|
|
|
|
throw 'position 0 is reserved for the script';
|
|
|
|
}
|
2018-07-10 10:57:41 +00:00
|
|
|
if (this.finalized) {
|
|
|
|
return this.funktions.find(funktion => funktion.start == start);
|
|
|
|
}
|
2017-12-20 12:02:45 +00:00
|
|
|
return this.funktions[start];
|
|
|
|
}
|
|
|
|
|
2018-07-10 10:57:41 +00:00
|
|
|
// Return the innermost function at the given source position.
|
|
|
|
getFunktionForPosition(position) {
|
|
|
|
if (!this.finalized) throw 'Incomplete script';
|
|
|
|
for (let i = this.funktions.length - 1; i >= 0; i--) {
|
|
|
|
let funktion = this.funktions[i];
|
|
|
|
if (funktion.containsPosition(position)) return funktion;
|
|
|
|
}
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
2017-12-20 12:02:45 +00:00
|
|
|
addMissingFunktions(list) {
|
|
|
|
if (this.finalized) throw 'script is finalized!';
|
|
|
|
list.forEach(fn => {
|
|
|
|
if (this.funktions[fn.start] === void 0) {
|
|
|
|
this.addFunktion(fn);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
addFunktion(fn) {
|
|
|
|
if (this.finalized) throw 'script is finalized!';
|
|
|
|
if (fn.start === void 0) throw "Funktion has no start position";
|
|
|
|
if (this.funktions[fn.start] !== void 0) {
|
|
|
|
fn.print();
|
|
|
|
throw "adding same function twice to script";
|
|
|
|
}
|
|
|
|
this.funktions[fn.start] = fn;
|
|
|
|
}
|
|
|
|
|
|
|
|
finalize() {
|
|
|
|
this.finalized = true;
|
|
|
|
// Compact funktions as we no longer need access via start byte position.
|
|
|
|
this.funktions = this.funktions.filter(each => true);
|
|
|
|
let parent = null;
|
|
|
|
let maxNesting = 0;
|
|
|
|
// Iterate over the Funktions in byte position order.
|
|
|
|
this.funktions.forEach(fn => {
|
2018-07-10 10:57:41 +00:00
|
|
|
fn.isEval = this.isEval;
|
2017-12-20 12:02:45 +00:00
|
|
|
if (parent === null) {
|
|
|
|
parent = fn;
|
|
|
|
} else {
|
|
|
|
// Walk up the nested chain of Funktions to find the parent.
|
|
|
|
while (parent !== null && !fn.isNestedIn(parent)) {
|
|
|
|
parent = parent.parent;
|
|
|
|
}
|
|
|
|
fn.parent = parent;
|
|
|
|
if (parent) {
|
|
|
|
maxNesting = Math.max(maxNesting, parent.addNestedFunktion(fn));
|
|
|
|
}
|
|
|
|
parent = fn;
|
|
|
|
}
|
2018-07-10 10:57:41 +00:00
|
|
|
});
|
|
|
|
// Sanity checks to ensure that scripts are executed and parsed before any
|
|
|
|
// of its funktions.
|
|
|
|
let funktionFirstParseEventTimestamp = -1;
|
|
|
|
// Second iteration step to finalize the funktions once the proper
|
|
|
|
// hierarchy has been set up.
|
|
|
|
this.funktions.forEach(fn => {
|
|
|
|
fn.finalize();
|
|
|
|
|
|
|
|
funktionFirstParseEventTimestamp = this.timestampMin(
|
|
|
|
funktionFirstParseEventTimestamp, fn.firstParseEventTimestamp);
|
|
|
|
|
|
|
|
this.lastParseEventTimestamp = this.timestampMax(
|
|
|
|
this.lastParseEventTimestamp, fn.lastParseEventTimestamp);
|
|
|
|
|
2018-07-03 08:27:31 +00:00
|
|
|
this.lastEventTimestamp =
|
2018-07-10 10:57:41 +00:00
|
|
|
this.timestampMax(this.lastEventTimestamp, fn.lastEventTimestamp);
|
2017-12-20 12:02:45 +00:00
|
|
|
});
|
|
|
|
this.maxNestingLevel = maxNesting;
|
2018-07-03 08:27:31 +00:00
|
|
|
|
|
|
|
// Initialize sizes.
|
|
|
|
if (!this.ownBytes === -1) throw 'Invalid state';
|
|
|
|
if (this.funktions.length == 0) {
|
|
|
|
this.bytesTotal = this.ownBytes = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
let toplevelFunktionBytes = this.funktions.reduce(
|
|
|
|
(bytes, each) => bytes + (each.isToplevel() ? each.getBytes() : 0), 0);
|
2018-07-10 10:57:41 +00:00
|
|
|
if (this.isDeserialized || this.isEval || this.isStreamingCompiled) {
|
2018-07-03 08:27:31 +00:00
|
|
|
if (this.getBytes() === -1) {
|
|
|
|
this.bytesTotal = toplevelFunktionBytes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.ownBytes = this.bytesTotal - toplevelFunktionBytes;
|
2018-07-10 10:57:41 +00:00
|
|
|
// Initialize common properties.
|
|
|
|
super.finalize();
|
|
|
|
// Sanity checks after the minimum timestamps have been computed.
|
|
|
|
if (funktionFirstParseEventTimestamp < this.firstParseEventTimestamp) {
|
|
|
|
console.error(
|
|
|
|
'invalid firstCompileEventTimestamp', this,
|
|
|
|
funktionFirstParseEventTimestamp, this.firstParseEventTimestamp);
|
2018-07-03 08:27:31 +00:00
|
|
|
}
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print() {
|
|
|
|
console.log(this.toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
toString() {
|
|
|
|
let str = `SCRIPT id=${this.id} file=${this.file}\n` +
|
|
|
|
`functions[${this.funktions.length}]:`;
|
|
|
|
this.funktions.forEach(fn => str += fn.toString());
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
getBytes() {
|
|
|
|
return this.bytesTotal;
|
|
|
|
}
|
|
|
|
|
|
|
|
getOwnBytes() {
|
|
|
|
return this.ownBytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Also see Funktion.prototype.getMetricBytes
|
|
|
|
getMetricBytes(name) {
|
|
|
|
if (name == 'lazyCompileTimestamp') return this.getOwnBytes();
|
2018-07-03 08:27:31 +00:00
|
|
|
return this.getOwnBytes();
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
2018-07-03 08:27:31 +00:00
|
|
|
getMetricDuration(name) {
|
2017-12-20 12:02:45 +00:00
|
|
|
return this[name];
|
|
|
|
}
|
|
|
|
|
|
|
|
forEach(fn) {
|
|
|
|
fn(this);
|
|
|
|
this.funktions.forEach(fn);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Container helper for TotalScript / Script.
|
|
|
|
getScripts() {
|
|
|
|
return [this];
|
|
|
|
}
|
|
|
|
|
|
|
|
calculateMetrics(printSummary) {
|
|
|
|
let log = (str) => this.summary += str + '\n';
|
|
|
|
log("SCRIPT: " + this.id);
|
|
|
|
let all = this.funktions;
|
|
|
|
if (all.length === 0) return;
|
|
|
|
|
|
|
|
let nofFunktions = all.length;
|
|
|
|
let ownBytesSum = list => {
|
|
|
|
return list.reduce((bytes, each) => bytes + each.getOwnBytes(), 0)
|
|
|
|
};
|
|
|
|
|
|
|
|
let info = (name, funktions) => {
|
|
|
|
let ownBytes = ownBytesSum(funktions);
|
|
|
|
let nofPercent = Math.round(funktions.length / nofFunktions * 100);
|
|
|
|
let value = (funktions.length + "").padStart(6) +
|
|
|
|
(nofPercent + "%").padStart(5) +
|
|
|
|
BYTES(ownBytes, this.bytesTotal).padStart(10);
|
|
|
|
log((" - " + name).padEnd(20) + value);
|
|
|
|
this.metrics.set(name + "-bytes", ownBytes);
|
|
|
|
this.metrics.set(name + "-count", funktions.length);
|
|
|
|
this.metrics.set(name + "-count-percent", nofPercent);
|
|
|
|
this.metrics.set(name + "-bytes-percent",
|
|
|
|
Math.round(ownBytes / this.bytesTotal * 100));
|
|
|
|
};
|
|
|
|
|
|
|
|
log(" - file: " + this.file);
|
2018-06-27 08:50:49 +00:00
|
|
|
log(' - details: ' +
|
|
|
|
'isEval=' + this.isEval + ' deserialized=' + this.isDeserialized +
|
2018-07-10 10:57:41 +00:00
|
|
|
' streamed=' + this.isStreamingCompiled);
|
2017-12-20 12:02:45 +00:00
|
|
|
info("scripts", this.getScripts());
|
|
|
|
info("functions", all);
|
|
|
|
info("toplevel fn", all.filter(each => each.isToplevel()));
|
2018-07-03 08:27:31 +00:00
|
|
|
info('preparsed', all.filter(each => each.preparseDuration > 0));
|
2017-12-20 12:02:45 +00:00
|
|
|
|
2018-07-03 08:27:31 +00:00
|
|
|
info('fully parsed', all.filter(each => each.parseDuration > 0));
|
|
|
|
// info("fn parsed", all.filter(each => each.parse2Duration > 0));
|
|
|
|
// info("resolved", all.filter(each => each.resolutionDuration > 0));
|
2017-12-20 12:02:45 +00:00
|
|
|
info("executed", all.filter(each => each.executionTimestamp > 0));
|
2018-07-10 10:57:41 +00:00
|
|
|
info('forEval', all.filter(each => each.isEval));
|
2017-12-20 12:02:45 +00:00
|
|
|
info("lazy compiled", all.filter(each => each.lazyCompileTimestamp > 0));
|
|
|
|
info("eager compiled", all.filter(each => each.compileTimestamp > 0));
|
|
|
|
|
2018-07-03 08:27:31 +00:00
|
|
|
let parsingCost =
|
|
|
|
new ExecutionCost('parse', all, each => each.parseDuration);
|
2017-12-20 12:02:45 +00:00
|
|
|
parsingCost.setMetrics(this.metrics);
|
2018-07-03 08:27:31 +00:00
|
|
|
log(parsingCost.toString());
|
2017-12-20 12:02:45 +00:00
|
|
|
|
2018-07-03 08:27:31 +00:00
|
|
|
let preParsingCost =
|
|
|
|
new ExecutionCost('preparse', all, each => each.preparseDuration);
|
2017-12-20 12:02:45 +00:00
|
|
|
preParsingCost.setMetrics(this.metrics);
|
2018-07-03 08:27:31 +00:00
|
|
|
log(preParsingCost.toString());
|
2017-12-20 12:02:45 +00:00
|
|
|
|
2018-07-03 08:27:31 +00:00
|
|
|
let resolutionCost =
|
|
|
|
new ExecutionCost('resolution', all, each => each.resolutionDuration);
|
2017-12-20 12:02:45 +00:00
|
|
|
resolutionCost.setMetrics(this.metrics);
|
2018-07-03 08:27:31 +00:00
|
|
|
log(resolutionCost.toString());
|
2017-12-20 12:02:45 +00:00
|
|
|
|
|
|
|
let nesting = new NestingDistribution(all);
|
|
|
|
nesting.setMetrics(this.metrics);
|
2018-07-03 08:27:31 +00:00
|
|
|
log(nesting.toString());
|
2017-12-20 12:02:45 +00:00
|
|
|
|
|
|
|
if (printSummary) console.log(this.summary);
|
|
|
|
}
|
|
|
|
|
2018-07-10 10:57:41 +00:00
|
|
|
getAccumulatedTimeMetrics(
|
|
|
|
metrics, start, end, delta, cumulative = true, useDuration = false) {
|
2017-12-20 12:02:45 +00:00
|
|
|
// Returns an array of the following format:
|
2018-07-03 08:27:31 +00:00
|
|
|
// [ [start, acc(metric0, start, start), acc(metric1, ...), ...],
|
|
|
|
// [start+delta, acc(metric0, start, start+delta), ...],
|
2017-12-20 12:02:45 +00:00
|
|
|
// [start+delta*2, acc(metric0, start, start+delta*2), ...],
|
|
|
|
// ...
|
|
|
|
// ]
|
2018-07-03 08:27:31 +00:00
|
|
|
if (end <= start) throw 'Invalid ranges [' + start + ',' + end + ']';
|
2017-12-20 12:02:45 +00:00
|
|
|
const timespan = end - start;
|
|
|
|
const kSteps = Math.ceil(timespan / delta);
|
|
|
|
// To reduce the time spent iterating over the funktions of this script
|
|
|
|
// we iterate once over all funktions and add the metric changes to each
|
|
|
|
// timepoint:
|
2018-07-03 08:27:31 +00:00
|
|
|
// [ [0, 300, ...], [1, 15, ...], [2, 100, ...], [3, 0, ...] ... ]
|
2017-12-20 12:02:45 +00:00
|
|
|
// In a second step we accumulate all values:
|
|
|
|
// [ [0, 300, ...], [1, 315, ...], [2, 415, ...], [3, 415, ...] ... ]
|
|
|
|
//
|
|
|
|
// To limit the number of data points required in the resulting graphs,
|
|
|
|
// only the rows for entries with actual changes are created.
|
|
|
|
|
|
|
|
const metricProperties = ["time"];
|
|
|
|
metrics.forEach(each => {
|
|
|
|
metricProperties.push(each + 'Timestamp');
|
2018-07-10 10:57:41 +00:00
|
|
|
if (useDuration) metricProperties.push(each + 'Duration');
|
2017-12-20 12:02:45 +00:00
|
|
|
});
|
|
|
|
// Create a packed {rowTemplate} which is copied later-on.
|
|
|
|
let indexToTime = (t) => (start + t * delta) / kSecondsToMillis;
|
|
|
|
let rowTemplate = [indexToTime(0)];
|
|
|
|
for (let i = 1; i < metricProperties.length; i++) rowTemplate.push(0.0);
|
|
|
|
// Create rows with 0-time entry.
|
|
|
|
let rows = new Array(rowTemplate.slice());
|
|
|
|
for (let t = 1; t <= kSteps; t++) rows.push(null);
|
|
|
|
// Create the real metric's property name on the Funktion object.
|
|
|
|
// Add the increments of each Funktion's metric to the result.
|
|
|
|
this.forEach(funktionOrScript => {
|
2018-07-03 08:27:31 +00:00
|
|
|
// Iterate over the Funktion's metric names, skipping position 0 which
|
|
|
|
// is the time.
|
2018-07-10 10:57:41 +00:00
|
|
|
const kMetricIncrement = useDuration ? 2 : 1;
|
|
|
|
for (let i = 1; i < metricProperties.length; i += kMetricIncrement) {
|
2018-07-03 08:27:31 +00:00
|
|
|
let timestampPropertyName = metricProperties[i];
|
|
|
|
let timestamp = funktionOrScript[timestampPropertyName];
|
2017-12-20 12:02:45 +00:00
|
|
|
if (timestamp === void 0) continue;
|
2018-07-03 08:27:31 +00:00
|
|
|
if (timestamp < start || end < timestamp) continue;
|
|
|
|
timestamp -= start;
|
2017-12-20 12:02:45 +00:00
|
|
|
let index = Math.floor(timestamp / delta);
|
|
|
|
let row = rows[index];
|
|
|
|
if (row === null) {
|
|
|
|
// Add a new row if it didn't exist,
|
|
|
|
row = rows[index] = rowTemplate.slice();
|
|
|
|
// .. add the time offset.
|
|
|
|
row[0] = indexToTime(index);
|
|
|
|
}
|
|
|
|
// Add the metric value.
|
2018-07-03 08:27:31 +00:00
|
|
|
row[i] += funktionOrScript.getMetricBytes(timestampPropertyName);
|
2018-07-10 10:57:41 +00:00
|
|
|
if (!useDuration) continue;
|
2018-07-03 08:27:31 +00:00
|
|
|
let durationPropertyName = metricProperties[i + 1];
|
|
|
|
row[i + 1] += funktionOrScript.getMetricDuration(durationPropertyName);
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
// Create a packed array again with only the valid entries.
|
|
|
|
// Accumulate the incremental results by adding the metric values from
|
|
|
|
// the previous time window.
|
|
|
|
let previous = rows[0];
|
|
|
|
let result = [previous];
|
|
|
|
for (let t = 1; t < rows.length; t++) {
|
|
|
|
let current = rows[t];
|
|
|
|
if (current === null) {
|
|
|
|
// Ensure a zero data-point after each non-zero point.
|
2018-07-10 10:57:41 +00:00
|
|
|
if (!cumulative && rows[t - 1] !== null) {
|
2017-12-20 12:02:45 +00:00
|
|
|
let duplicate = rowTemplate.slice();
|
|
|
|
duplicate[0] = indexToTime(t);
|
|
|
|
result.push(duplicate);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
2018-07-10 10:57:41 +00:00
|
|
|
if (cumulative) {
|
2017-12-20 12:02:45 +00:00
|
|
|
// Skip i==0 where the corresponding time value in seconds is.
|
|
|
|
for (let i = 1; i < metricProperties.length; i++) {
|
|
|
|
current[i] += previous[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Make sure we have a data-point in time right before the current one.
|
|
|
|
if (rows[t - 1] === null) {
|
2018-07-10 10:57:41 +00:00
|
|
|
let duplicate = (!cumulative ? rowTemplate : previous).slice();
|
2017-12-20 12:02:45 +00:00
|
|
|
duplicate[0] = indexToTime(t - 1);
|
|
|
|
result.push(duplicate);
|
|
|
|
}
|
|
|
|
previous = current;
|
|
|
|
result.push(current);
|
|
|
|
}
|
|
|
|
// Make sure there is an entry at the last position to make sure all graphs
|
|
|
|
// have the same width.
|
|
|
|
const lastIndex = rows.length - 1;
|
|
|
|
if (rows[lastIndex] === null) {
|
|
|
|
let duplicate = previous.slice();
|
|
|
|
duplicate[0] = indexToTime(lastIndex);
|
|
|
|
result.push(duplicate);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
getFunktionsAtTime(time, delta, metric) {
|
|
|
|
// Returns a list of Funktions whose metric changed in the
|
|
|
|
// [time-delta, time+delta] range.
|
|
|
|
return this.funktions.filter(
|
|
|
|
funktion => funktion.didMetricChange(time, delta, metric));
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class TotalScript extends Script {
|
|
|
|
constructor() {
|
|
|
|
super('all files', 'all files');
|
|
|
|
this.scripts = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
addAllFunktions(script) {
|
|
|
|
// funktions is indexed by byte offset and as such not packed. Add every
|
|
|
|
// Funktion one by one to keep this.funktions packed.
|
|
|
|
script.funktions.forEach(fn => this.funktions.push(fn));
|
|
|
|
this.scripts.push(script);
|
|
|
|
this.bytesTotal += script.bytesTotal;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Iterate over all Scripts and nested Funktions.
|
|
|
|
forEach(fn) {
|
|
|
|
this.scripts.forEach(script => script.forEach(fn));
|
|
|
|
}
|
|
|
|
|
|
|
|
getScripts() {
|
|
|
|
return this.scripts;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
|
|
class NestingDistribution {
|
|
|
|
constructor(funktions) {
|
|
|
|
// Stores the nof bytes per function nesting level.
|
|
|
|
this.accumulator = [0, 0, 0, 0, 0];
|
|
|
|
// Max nof bytes encountered at any nesting level.
|
|
|
|
this.max = 0;
|
|
|
|
// avg bytes per nesting level.
|
|
|
|
this.avg = 0;
|
|
|
|
this.totalBytes = 0;
|
|
|
|
|
|
|
|
funktions.forEach(each => each.accumulateNestingLevel(this.accumulator));
|
|
|
|
this.max = this.accumulator.reduce((max, each) => Math.max(max, each), 0);
|
|
|
|
this.totalBytes = this.accumulator.reduce((sum, each) => sum + each, 0);
|
|
|
|
for (let i = 0; i < this.accumulator.length; i++) {
|
|
|
|
this.avg += this.accumulator[i] * i;
|
|
|
|
}
|
|
|
|
this.avg /= this.totalBytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
print() {
|
|
|
|
console.log(this.toString())
|
|
|
|
}
|
|
|
|
|
|
|
|
toString() {
|
|
|
|
let ticks = " ▁▂▃▄▅▆▇█";
|
|
|
|
let accString = this.accumulator.reduce((str, each) => {
|
|
|
|
let index = Math.round(each / this.max * (ticks.length - 1));
|
|
|
|
return str + ticks[index];
|
|
|
|
}, '');
|
|
|
|
let percent0 = this.accumulator[0]
|
|
|
|
let percent1 = this.accumulator[1];
|
|
|
|
let percent2plus = this.accumulator.slice(2)
|
|
|
|
.reduce((sum, each) => sum + each, 0);
|
|
|
|
return " - nesting level: " +
|
|
|
|
' avg=' + formatNumber(this.avg) +
|
|
|
|
' l0=' + PERCENT(percent0, this.totalBytes) +
|
|
|
|
' l1=' + PERCENT(percent1, this.totalBytes) +
|
|
|
|
' l2+=' + PERCENT(percent2plus, this.totalBytes) +
|
|
|
|
' distribution=[' + accString + ']';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setMetrics(dict) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
class ExecutionCost {
|
|
|
|
constructor(prefix, funktions, time_fn) {
|
|
|
|
this.prefix = prefix;
|
|
|
|
// Time spent on executed functions.
|
|
|
|
this.executedCost = 0
|
|
|
|
// Time spent on not executed functions.
|
|
|
|
this.nonExecutedCost = 0;
|
|
|
|
|
|
|
|
this.executedCost = funktions.reduce((sum, each) => {
|
|
|
|
return sum + (each.hasBeenExecuted() ? time_fn(each) : 0)
|
|
|
|
}, 0);
|
|
|
|
this.nonExecutedCost = funktions.reduce((sum, each) => {
|
|
|
|
return sum + (each.hasBeenExecuted() ? 0 : time_fn(each))
|
|
|
|
}, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
print() {
|
|
|
|
console.log(this.toString())
|
|
|
|
}
|
|
|
|
|
|
|
|
toString() {
|
|
|
|
return (' - ' + this.prefix + '-time:').padEnd(24) +
|
|
|
|
(" executed=" + formatNumber(this.executedCost) + 'ms').padEnd(20) +
|
|
|
|
" non-executed=" + formatNumber(this.nonExecutedCost) + 'ms';
|
|
|
|
}
|
|
|
|
|
|
|
|
setMetrics(dict) {
|
|
|
|
dict.set('parseMetric', this.executionCost);
|
|
|
|
dict.set('parseMetricNegative', this.nonExecutionCost);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
|
2018-07-03 08:27:31 +00:00
|
|
|
class Funktion extends CompilationUnit {
|
2017-12-20 12:02:45 +00:00
|
|
|
constructor(name, start, end, script) {
|
2018-07-03 08:27:31 +00:00
|
|
|
super();
|
2017-12-20 12:02:45 +00:00
|
|
|
if (start < 0) throw "invalid start position: " + start;
|
2018-07-03 08:27:31 +00:00
|
|
|
if (script.isEval) {
|
|
|
|
if (end < start) throw 'invalid start end positions';
|
|
|
|
} else {
|
|
|
|
if (end <= 0) throw 'invalid end position: ' + end;
|
|
|
|
if (end <= start) throw 'invalid start end positions';
|
|
|
|
}
|
2017-12-20 12:02:45 +00:00
|
|
|
|
|
|
|
this.name = name;
|
|
|
|
this.start = start;
|
|
|
|
this.end = end;
|
|
|
|
this.script = script;
|
|
|
|
this.parent = null;
|
|
|
|
this.nested = [];
|
|
|
|
this.nestingLevel = 0;
|
|
|
|
|
|
|
|
if (script) this.script.addFunktion(this);
|
|
|
|
}
|
|
|
|
|
2018-07-10 10:57:41 +00:00
|
|
|
finalize() {
|
|
|
|
this.lastParseEventTimestamp = Math.max(
|
|
|
|
this.preparseTimestamp + this.preparseDuration,
|
|
|
|
this.parseTimestamp + this.parseDuration,
|
|
|
|
this.resolutionTimestamp + this.resolutionDuration);
|
|
|
|
if (!(this.lastParseEventTimestamp > 0)) this.lastParseEventTimestamp = 0;
|
|
|
|
|
|
|
|
this.lastEventTimestamp =
|
|
|
|
Math.max(this.lastParseEventTimestamp, this.executionTimestamp);
|
|
|
|
if (!(this.lastEventTimestamp > 0)) this.lastEventTimestamp = 0;
|
|
|
|
|
|
|
|
this.ownBytes = this.nested.reduce(
|
|
|
|
(bytes, each) => bytes - each.getBytes(), this.getBytes());
|
|
|
|
|
|
|
|
super.finalize();
|
|
|
|
}
|
|
|
|
|
2017-12-20 12:02:45 +00:00
|
|
|
getMetricBytes(name) {
|
|
|
|
if (name == 'lazyCompileTimestamp') return this.getOwnBytes();
|
2018-07-03 08:27:31 +00:00
|
|
|
return this.getOwnBytes();
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
2018-07-03 08:27:31 +00:00
|
|
|
getMetricDuration(name) {
|
2017-12-20 12:02:45 +00:00
|
|
|
if (name in kNoTimeMetrics) return 0;
|
|
|
|
return this[name];
|
|
|
|
}
|
|
|
|
|
|
|
|
isNestedIn(funktion) {
|
|
|
|
if (this.script != funktion.script) throw "Incompatible script";
|
|
|
|
return funktion.start < this.start && this.end <= funktion.end;
|
|
|
|
}
|
|
|
|
|
|
|
|
isToplevel() {
|
2018-07-10 10:57:41 +00:00
|
|
|
return this.parent === null;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
2018-07-10 10:57:41 +00:00
|
|
|
containsPosition(position) {
|
|
|
|
return this.start <= position && position <= this.end;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
accumulateNestingLevel(accumulator) {
|
|
|
|
let value = accumulator[this.nestingLevel] || 0;
|
|
|
|
accumulator[this.nestingLevel] = value + this.getOwnBytes();
|
|
|
|
}
|
|
|
|
|
|
|
|
addNestedFunktion(child) {
|
|
|
|
if (this.script != child.script) throw "Incompatible script";
|
|
|
|
if (child == null) throw "Nesting non child";
|
|
|
|
this.nested.push(child);
|
|
|
|
if (this.nested.length > 1) {
|
|
|
|
// Make sure the nested children don't overlap and have been inserted in
|
|
|
|
// byte start position order.
|
|
|
|
let last = this.nested[this.nested.length - 2];
|
|
|
|
if (last.end > child.start || last.start > child.start ||
|
|
|
|
last.end > child.end || last.start > child.end) {
|
|
|
|
throw "Wrongly nested child added";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
child.nestingLevel = this.nestingLevel + 1;
|
|
|
|
return child.nestingLevel;
|
|
|
|
}
|
|
|
|
|
|
|
|
getBytes() {
|
|
|
|
return this.end - this.start;
|
|
|
|
}
|
|
|
|
|
|
|
|
getOwnBytes() {
|
|
|
|
return this.ownBytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
didMetricChange(time, delta, name) {
|
|
|
|
let value = this[name + 'Timestamp'];
|
|
|
|
return (time - delta) <= value && value <= (time + delta);
|
|
|
|
}
|
|
|
|
|
|
|
|
print() {
|
|
|
|
console.log(this.toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
toString(details = true) {
|
|
|
|
let result = 'function' + (this.name ? ' ' + this.name : '') +
|
2018-07-10 10:57:41 +00:00
|
|
|
`() range=${this.start}-${this.end}`;
|
2017-12-20 12:02:45 +00:00
|
|
|
if (details) result += ` script=${this.script ? this.script.id : 'X'}`;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ===========================================================================
|
|
|
|
|
|
|
|
const kTimestampFactor = 1000;
|
|
|
|
const kSecondsToMillis = 1000;
|
|
|
|
|
|
|
|
function toTimestamp(microseconds) {
|
|
|
|
return microseconds / kTimestampFactor
|
|
|
|
}
|
|
|
|
|
|
|
|
function startOf(timestamp, time) {
|
|
|
|
let result = toTimestamp(timestamp) - time;
|
|
|
|
if (result < 0) throw "start timestamp cannnot be negative";
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class ParseProcessor extends LogReader {
|
|
|
|
constructor() {
|
|
|
|
super();
|
2018-06-06 11:03:19 +00:00
|
|
|
this.dispatchTable_ = {
|
|
|
|
// Avoid accidental leaking of __proto__ properties and force this object
|
|
|
|
// to be in dictionary-mode.
|
|
|
|
__proto__: null,
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
// "function",{event type},
|
|
|
|
// {script id},{start position},{end position},{time},{timestamp},
|
|
|
|
// {function name}
|
2018-06-06 11:03:19 +00:00
|
|
|
'function': {
|
|
|
|
parsers: [
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
parseString, parseInt, parseInt, parseInt, parseFloat, parseInt,
|
|
|
|
parseString
|
2018-06-06 11:03:19 +00:00
|
|
|
],
|
|
|
|
processor: this.processFunctionEvent
|
2018-06-20 12:08:47 +00:00
|
|
|
},
|
2018-07-10 10:57:41 +00:00
|
|
|
// "compilation-cache","hit"|"put",{type},{scriptid},{start position},
|
|
|
|
// {end position},{timestamp}
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
'compilation-cache': {
|
2018-07-10 10:57:41 +00:00
|
|
|
parsers:
|
|
|
|
[parseString, parseString, parseInt, parseInt, parseInt, parseInt],
|
2018-06-20 12:08:47 +00:00
|
|
|
processor: this.processCompilationCacheEvent
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
},
|
|
|
|
'script': {
|
2018-07-10 10:57:41 +00:00
|
|
|
parsers: [parseString, parseInt, parseInt],
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
processor: this.processScriptEvent
|
|
|
|
},
|
|
|
|
// "script-details", {script_id}, {file}, {line}, {column}, {size}
|
|
|
|
'script-details': {
|
|
|
|
parsers: [parseInt, parseString, parseInt, parseInt, parseInt],
|
|
|
|
processor: this.processScriptDetails
|
2018-07-03 08:27:31 +00:00
|
|
|
},
|
|
|
|
'script-source': {
|
|
|
|
parsers: [parseInt, parseString, parseString],
|
|
|
|
processor: this.processScriptSource
|
|
|
|
},
|
2017-12-20 12:02:45 +00:00
|
|
|
};
|
2018-06-06 11:03:19 +00:00
|
|
|
this.functionEventDispatchTable_ = {
|
|
|
|
// Avoid accidental leaking of __proto__ properties and force this object
|
|
|
|
// to be in dictionary-mode.
|
|
|
|
__proto__: null,
|
|
|
|
'full-parse': this.processFull.bind(this),
|
2018-06-20 12:08:47 +00:00
|
|
|
'parse-function': this.processParseFunction.bind(this),
|
|
|
|
// TODO(cbruni): make sure arrow functions emit a normal parse-function
|
|
|
|
// event.
|
|
|
|
'parse': this.processParseFunction.bind(this),
|
2018-07-10 10:57:41 +00:00
|
|
|
'parse-script': this.processParseScript.bind(this),
|
|
|
|
'parse-eval': this.processParseEval.bind(this),
|
2018-06-06 11:03:19 +00:00
|
|
|
'preparse-no-resolution': this.processPreparseNoResolution.bind(this),
|
|
|
|
'preparse-resolution': this.processPreparseResolution.bind(this),
|
|
|
|
'first-execution': this.processFirstExecution.bind(this),
|
|
|
|
'compile-lazy': this.processCompileLazy.bind(this),
|
2018-06-20 12:08:47 +00:00
|
|
|
'compile': this.processCompile.bind(this),
|
|
|
|
'compile-eval': this.processCompileEval.bind(this),
|
2018-07-10 10:57:41 +00:00
|
|
|
'optimize-lazy': this.processOptimizeLazy.bind(this),
|
|
|
|
'deserialize': this.processDeserialize.bind(this),
|
2017-12-20 12:02:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
this.idToScript = new Map();
|
|
|
|
this.fileToScript = new Map();
|
|
|
|
this.nameToFunction = new Map();
|
|
|
|
this.scripts = [];
|
|
|
|
this.totalScript = new TotalScript();
|
2018-07-03 08:27:31 +00:00
|
|
|
this.firstEventTimestamp = -1;
|
|
|
|
this.lastParseEventTimestamp = -1;
|
|
|
|
this.lastEventTimestamp = -1;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print() {
|
|
|
|
console.log("scripts:");
|
|
|
|
this.idToScript.forEach(script => script.print());
|
|
|
|
}
|
|
|
|
|
|
|
|
processString(string) {
|
|
|
|
let end = string.length;
|
|
|
|
let current = 0;
|
|
|
|
let next = 0;
|
|
|
|
let line;
|
|
|
|
let i = 0;
|
|
|
|
let entry;
|
|
|
|
while (current < end) {
|
|
|
|
next = string.indexOf("\n", current);
|
|
|
|
if (next === -1) break;
|
|
|
|
i++;
|
|
|
|
line = string.substring(current, next);
|
|
|
|
current = next + 1;
|
|
|
|
this.processLogLine(line);
|
|
|
|
}
|
|
|
|
this.postProcess();
|
|
|
|
}
|
|
|
|
|
|
|
|
processLogFile(fileName) {
|
|
|
|
this.collectEntries = true
|
|
|
|
this.lastLogFileName_ = fileName;
|
|
|
|
var line;
|
|
|
|
while (line = readline()) {
|
|
|
|
this.processLogLine(line);
|
|
|
|
}
|
|
|
|
this.postProcess();
|
|
|
|
}
|
|
|
|
|
|
|
|
postProcess() {
|
|
|
|
this.scripts = Array.from(this.idToScript.values())
|
|
|
|
.filter(each => !each.isNative);
|
|
|
|
|
2018-06-27 08:50:49 +00:00
|
|
|
this.scripts.forEach(script => {
|
|
|
|
script.finalize();
|
|
|
|
script.calculateMetrics(false)
|
|
|
|
});
|
2017-12-20 12:02:45 +00:00
|
|
|
|
|
|
|
this.scripts.forEach(script => this.totalScript.addAllFunktions(script));
|
|
|
|
this.totalScript.calculateMetrics(true);
|
2018-07-10 10:57:41 +00:00
|
|
|
|
|
|
|
this.firstEventTimestamp = this.totalScript.timestampMin(
|
|
|
|
this.scripts.map(each => each.firstEventTimestamp));
|
|
|
|
this.lastParseEventTimestamp = this.totalScript.timestampMax(
|
|
|
|
this.scripts.map(each => each.lastParseEventTimestamp));
|
|
|
|
this.lastEventTimestamp = this.totalScript.timestampMax(
|
|
|
|
this.scripts.map(each => each.lastEventTimestamp));
|
|
|
|
|
2018-06-20 12:08:47 +00:00
|
|
|
const series = {
|
|
|
|
firstParseEvent: 'Any Parse Event',
|
|
|
|
parse: 'Parsing',
|
|
|
|
preparse: 'Preparsing',
|
|
|
|
resolution: 'Preparsing with Var. Resolution',
|
|
|
|
lazyCompile: 'Lazy Compilation',
|
|
|
|
compile: 'Eager Compilation',
|
|
|
|
execution: 'First Execution',
|
|
|
|
};
|
|
|
|
let metrics = Object.keys(series);
|
2018-07-03 08:27:31 +00:00
|
|
|
this.totalScript.getAccumulatedTimeMetrics(
|
|
|
|
metrics, 0, this.lastEventTimestamp, 10);
|
2018-06-06 11:03:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
processFunctionEvent(
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
eventName, scriptId, startPosition, endPosition, duration, timestamp,
|
|
|
|
functionName) {
|
2018-06-06 11:03:19 +00:00
|
|
|
let handlerFn = this.functionEventDispatchTable_[eventName];
|
|
|
|
if (handlerFn === undefined) {
|
|
|
|
console.error('Couldn\'t find handler for function event:' + eventName);
|
|
|
|
}
|
|
|
|
handlerFn(
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
scriptId, startPosition, endPosition, duration, timestamp,
|
2018-06-06 11:03:19 +00:00
|
|
|
functionName);
|
|
|
|
}
|
2017-12-20 12:02:45 +00:00
|
|
|
|
|
|
|
addEntry(entry) {
|
|
|
|
this.entries.push(entry);
|
|
|
|
}
|
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
lookupScript(id) {
|
|
|
|
return this.idToScript.get(id);
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
getOrCreateFunction(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
|
|
|
if (scriptId == -1) {
|
2018-06-06 11:03:19 +00:00
|
|
|
return this.lookupFunktionByRange(startPosition, endPosition);
|
|
|
|
}
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
let script = this.lookupScript(scriptId);
|
2018-07-10 10:57:41 +00:00
|
|
|
let funktion = script.getFunktionAtStartPosition(startPosition);
|
2017-12-20 12:02:45 +00:00
|
|
|
if (funktion === void 0) {
|
|
|
|
funktion = new Funktion(functionName, startPosition, endPosition, script);
|
|
|
|
}
|
|
|
|
return funktion;
|
|
|
|
}
|
|
|
|
|
2018-06-06 11:03:19 +00:00
|
|
|
// Iterates over all functions and tries to find matching ones.
|
|
|
|
lookupFunktionsByRange(start, end) {
|
|
|
|
let results = [];
|
|
|
|
this.idToScript.forEach(script => {
|
|
|
|
script.forEach(funktion => {
|
|
|
|
if (funktion.startPostion == start && funktion.endPosition == end) {
|
|
|
|
results.push(funktion);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return results;
|
|
|
|
}
|
|
|
|
lookupFunktionByRange(start, end) {
|
|
|
|
let results = this.lookupFunktionsByRange(start, end);
|
|
|
|
if (results.length != 1) throw "Could not find unique function by range";
|
|
|
|
return results[0];
|
|
|
|
}
|
|
|
|
|
2018-07-10 10:57:41 +00:00
|
|
|
processScriptEvent(eventName, scriptId, timestamp) {
|
|
|
|
let script = this.idToScript.get(scriptId);
|
|
|
|
switch (eventName) {
|
|
|
|
case 'create':
|
|
|
|
case 'reserve-id':
|
|
|
|
case 'deserialize': {
|
|
|
|
if (script !== undefined) return;
|
|
|
|
script = new Script(scriptId);
|
|
|
|
this.idToScript.set(scriptId, script);
|
|
|
|
if (eventName == 'deserialize') {
|
|
|
|
script.deserializationTimestamp = toTimestamp(timestamp);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 'background-compile':
|
|
|
|
if (script.isBackgroundCompiled) {
|
|
|
|
throw 'Cannot background-compile twice';
|
|
|
|
}
|
|
|
|
script.isBackgroundCompiled = true;
|
|
|
|
// TODO(cbruni): remove once backwards compatibility is no longer needed.
|
|
|
|
script.isStreamingCompiled = true;
|
|
|
|
// TODO(cbruni): fix parse events for background compilation scripts
|
|
|
|
script.preparseTimestamp = toTimestamp(timestamp);
|
|
|
|
return;
|
|
|
|
case 'streaming-compile':
|
|
|
|
if (script.isStreamingCompiled) throw 'Cannot stream-compile twice';
|
|
|
|
// TODO(cbruni): remove once backwards compatibility is no longer needed.
|
|
|
|
script.isBackgroundCompiled = true;
|
|
|
|
script.isStreamingCompiled = true;
|
|
|
|
// TODO(cbruni): fix parse events for background compilation scripts
|
|
|
|
script.preparseTimestamp = toTimestamp(timestamp);
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
console.error('Unhandled script event: ' + eventName);
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
processScriptDetails(scriptId, file, startLine, startColumn, size) {
|
|
|
|
let script = this.lookupScript(scriptId);
|
|
|
|
script.setFile(file);
|
|
|
|
}
|
|
|
|
|
2018-07-03 08:27:31 +00:00
|
|
|
processScriptSource(scriptId, url, source) {
|
|
|
|
let script = this.lookupScript(scriptId);
|
|
|
|
script.source = source;
|
|
|
|
}
|
|
|
|
|
2018-07-10 10:57:41 +00:00
|
|
|
processParseEval(
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
2018-07-10 10:57:41 +00:00
|
|
|
if (startPosition != 0 && startPosition != -1) {
|
|
|
|
console.error('Invalid start position for parse-eval', arguments);
|
|
|
|
}
|
|
|
|
let script = this.processParseScript(...arguments);
|
2017-12-20 12:02:45 +00:00
|
|
|
script.isEval = true;
|
|
|
|
}
|
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
processFull(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
2018-06-20 12:08:47 +00:00
|
|
|
if (startPosition == 0) {
|
|
|
|
// This should only happen for eval.
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
let script = this.lookupScript(scriptId);
|
2018-06-20 12:08:47 +00:00
|
|
|
script.isEval = true;
|
|
|
|
return;
|
|
|
|
}
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
let funktion = this.getOrCreateFunction(...arguments);
|
2017-12-20 12:02:45 +00:00
|
|
|
// TODO(cbruni): this should never happen, emit differen event from the
|
|
|
|
// parser.
|
|
|
|
if (funktion.parseTimestamp > 0) return;
|
2018-06-20 12:08:47 +00:00
|
|
|
funktion.parseTimestamp = startOf(timestamp, duration);
|
2018-07-03 08:27:31 +00:00
|
|
|
funktion.parseDuration = duration;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
processParseFunction(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
|
|
|
let funktion = this.getOrCreateFunction(...arguments);
|
2018-06-20 12:08:47 +00:00
|
|
|
funktion.parseTimestamp = startOf(timestamp, duration);
|
2018-07-03 08:27:31 +00:00
|
|
|
funktion.parseDuration = duration;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
2018-07-10 10:57:41 +00:00
|
|
|
processParseScript(
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
2018-06-20 12:08:47 +00:00
|
|
|
// TODO timestamp and duration
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
let script = this.lookupScript(scriptId);
|
2018-06-20 12:08:47 +00:00
|
|
|
let ts = startOf(timestamp, duration);
|
2017-12-20 12:02:45 +00:00
|
|
|
script.parseTimestamp = ts;
|
2018-07-03 08:27:31 +00:00
|
|
|
script.parseDuration = duration;
|
2018-07-10 10:57:41 +00:00
|
|
|
return script;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
processPreparseResolution(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
|
|
|
let funktion = this.getOrCreateFunction(...arguments);
|
2017-12-20 12:02:45 +00:00
|
|
|
// TODO(cbruni): this should never happen, emit different event from the
|
|
|
|
// parser.
|
|
|
|
if (funktion.resolutionTimestamp > 0) return;
|
2018-06-20 12:08:47 +00:00
|
|
|
funktion.resolutionTimestamp = startOf(timestamp, duration);
|
2018-07-03 08:27:31 +00:00
|
|
|
funktion.resolutionDuration = duration;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
processPreparseNoResolution(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
|
|
|
let funktion = this.getOrCreateFunction(...arguments);
|
2018-06-20 12:08:47 +00:00
|
|
|
funktion.preparseTimestamp = startOf(timestamp, duration);
|
2018-07-03 08:27:31 +00:00
|
|
|
funktion.preparseDuration = duration;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
processFirstExecution(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
|
|
|
let script = this.lookupScript(scriptId);
|
2017-12-20 12:02:45 +00:00
|
|
|
if (startPosition === 0) {
|
|
|
|
// undefined = eval fn execution
|
|
|
|
if (script) {
|
|
|
|
script.executionTimestamp = toTimestamp(timestamp);
|
|
|
|
}
|
|
|
|
} else {
|
2018-07-10 10:57:41 +00:00
|
|
|
let funktion = script.getFunktionAtStartPosition(startPosition);
|
2017-12-20 12:02:45 +00:00
|
|
|
if (funktion) {
|
|
|
|
funktion.executionTimestamp = toTimestamp(timestamp);
|
2018-07-10 10:57:41 +00:00
|
|
|
} else {
|
|
|
|
// TODO(cbruni): handle funktions from compilation-cache hits.
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
processCompileLazy(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
|
|
|
let funktion = this.getOrCreateFunction(...arguments);
|
2018-06-20 12:08:47 +00:00
|
|
|
funktion.lazyCompileTimestamp = startOf(timestamp, duration);
|
2018-07-03 08:27:31 +00:00
|
|
|
funktion.lazyCompileDuration = duration;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
processCompile(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
|
|
|
let script = this.lookupScript(scriptId);
|
2017-12-20 12:02:45 +00:00
|
|
|
if (startPosition === 0) {
|
2018-06-20 12:08:47 +00:00
|
|
|
script.compileTimestamp = startOf(timestamp, duration);
|
2018-07-03 08:27:31 +00:00
|
|
|
script.compileDuration = duration;
|
2017-12-20 12:02:45 +00:00
|
|
|
script.bytesTotal = endPosition;
|
2018-07-10 10:57:41 +00:00
|
|
|
return script;
|
2017-12-20 12:02:45 +00:00
|
|
|
} else {
|
2018-07-10 10:57:41 +00:00
|
|
|
let funktion = script.getFunktionAtStartPosition(startPosition);
|
2018-06-20 12:08:47 +00:00
|
|
|
if (funktion === undefined) {
|
|
|
|
// This should not happen since any funktion has to be parsed first.
|
2018-07-10 10:57:41 +00:00
|
|
|
console.error('processCompile funktion not found', ...arguments);
|
|
|
|
return;
|
2018-06-20 12:08:47 +00:00
|
|
|
}
|
|
|
|
funktion.compileTimestamp = startOf(timestamp, duration);
|
2018-07-03 08:27:31 +00:00
|
|
|
funktion.compileDuration = duration;
|
2018-07-10 10:57:41 +00:00
|
|
|
return funktion;
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
}
|
2018-06-20 12:08:47 +00:00
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
processCompileEval(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
2018-07-10 10:57:41 +00:00
|
|
|
let compilationUnit = this.processCompile(...arguments);
|
|
|
|
compilationUnit.isEval = true;
|
2018-06-20 12:08:47 +00:00
|
|
|
}
|
|
|
|
|
Reland "[parser][log] Log script id during background compilation"
This reverts commit a800e05007d42c84cd5627e5dfb305dfb9912844.
Original change's description:
> Revert "[parser][log] Log script id during background compilation"
>
> This reverts commit aafd5c52ab98608e37284a5a944a4c63045625b9.
>
> Reason for revert: Tentative revert for
>
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64/24825
> https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Win64%20-%20msvc/3242
>
> Original change's description:
> > [parser][log] Log script id during background compilation
> >
> > - Add separate script-create, script-reserve-id and script-details log events
> > - Add log events for CompilationCache hits and puts
> > - Simplify function event logging by only pass along the script id
> > - Explicitly create Scripts in parse-processor.js on script events only
> > - Create a temporary script id in the ParseInfo for use during background
> > parsing and compilation
> > - Clean up ParseInfo initialization to centralize creation and use of
> > script ids
> > - Allow creating Scripts with predefined script ids
> >
> > Bug: chromium:757467, chromium:850038
> > Change-Id: I02dfd1d5725795b9fe0ea94ef57b287b934a1efe
> > Reviewed-on: https://chromium-review.googlesource.com/1097131
> > Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
> > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#53978}
>
> TBR=ulan@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
>
> Change-Id: I629f72f51d5e086e2b54658c1fdd18cec268aab2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:757467, chromium:850038
> Reviewed-on: https://chromium-review.googlesource.com/1112538
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Commit-Queue: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53984}
TBR=ulan@chromium.org,yangguo@chromium.org,cbruni@chromium.org,gsathya@chromium.org,leszeks@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:757467, chromium:850038
Change-Id: I3088c86362c06ee50464f1f14e25350b1b8048ad
Reviewed-on: https://chromium-review.googlesource.com/1112539
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53994}
2018-06-25 09:00:21 +00:00
|
|
|
processOptimizeLazy(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
2018-07-10 10:57:41 +00:00
|
|
|
let compilationUnit = this.lookupScript(scriptId);
|
|
|
|
if (startPosition > 0) {
|
|
|
|
compilationUnit =
|
|
|
|
compilationUnit.getFunktionAtStartPosition(startPosition);
|
|
|
|
if (compilationUnit === undefined) {
|
|
|
|
// This should not happen since any funktion has to be parsed first.
|
|
|
|
console.error('processOptimizeLazy funktion not found', ...arguments);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
compilationUnit.optimizationTimestamp = startOf(timestamp, duration);
|
|
|
|
compilationUnit.optimizationDuration = duration;
|
2018-06-20 12:08:47 +00:00
|
|
|
}
|
|
|
|
|
2018-07-10 10:57:41 +00:00
|
|
|
processDeserialize(
|
|
|
|
scriptId, startPosition, endPosition, duration, timestamp, functionName) {
|
|
|
|
let compilationUnit = this.lookupScript(scriptId);
|
|
|
|
if (startPosition === 0) {
|
|
|
|
compilationUnit.bytesTotal = endPosition;
|
|
|
|
} else {
|
|
|
|
compilationUnit = this.getOrCreateFunction(...arguments);
|
|
|
|
}
|
|
|
|
compilationUnit.deserializationTimestamp = startOf(timestamp, duration);
|
|
|
|
compilationUnit.deserializationDuration = duration;
|
|
|
|
}
|
|
|
|
|
|
|
|
processCompilationCacheEvent(
|
|
|
|
eventType, cacheType, scriptId, startPosition, endPosition, timestamp) {
|
|
|
|
if (eventType !== 'hit') return;
|
|
|
|
let compilationUnit = this.lookupScript(scriptId);
|
|
|
|
if (startPosition > 0) {
|
|
|
|
compilationUnit =
|
|
|
|
compilationUnit.getFunktionAtStartPosition(startPosition);
|
|
|
|
}
|
|
|
|
compilationUnit.addCompilationCacheHit(toTimestamp(timestamp));
|
2018-06-20 12:08:47 +00:00
|
|
|
}
|
|
|
|
|
2017-12-20 12:02:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class ArgumentsProcessor extends BaseArgumentsProcessor {
|
|
|
|
getArgsDispatch() {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
getDefaultResults() {
|
|
|
|
return {
|
|
|
|
logFileName: 'v8.log',
|
|
|
|
range: 'auto,auto',
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|