diff options
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/extras/importer/v8')
5 files changed, 0 insertions, 1581 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/codemap.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/codemap.html deleted file mode 100644 index b7d80554373..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/codemap.html +++ /dev/null @@ -1,382 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2012 The Chromium Authors. All rights reserved. -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. ---> - -<link rel="import" href="/tracing/extras/importer/v8/splaytree.html"> - -<script> -'use strict'; - -/** - * @fileoverview Map addresses to dynamically created functions. - */ -tr.exportTo('tr.e.importer.v8', function() { - /** - * Constructs a mapper that maps addresses into code entries. - * - * @constructor - */ - function CodeMap() { - /** - * Dynamic code entries. Used for JIT compiled code. - */ - this.dynamics_ = new tr.e.importer.v8.SplayTree(); - - /** - * Name generator for entries having duplicate names. - */ - this.dynamicsNameGen_ = new tr.e.importer.v8.CodeMap.NameGenerator(); - - /** - * Static code entries. Used for statically compiled code. - */ - this.statics_ = new tr.e.importer.v8.SplayTree(); - - /** - * Libraries entries. Used for the whole static code libraries. - */ - this.libraries_ = new tr.e.importer.v8.SplayTree(); - - /** - * Map of memory pages occupied with static code. - */ - this.pages_ = []; - }; - - /** - * The number of alignment bits in a page address. - */ - CodeMap.PAGE_ALIGNMENT = 12; - - /** - * Page size in bytes. - */ - CodeMap.PAGE_SIZE = 1 << CodeMap.PAGE_ALIGNMENT; - - /** - * Adds a dynamic (i.e. moveable and discardable) code entry. - * - * @param {number} start The starting address. - * @param {CodeMap.CodeEntry} codeEntry Code entry object. - */ - CodeMap.prototype.addCode = function(start, codeEntry) { - this.deleteAllCoveredNodes_(this.dynamics_, start, start + codeEntry.size); - this.dynamics_.insert(start, codeEntry); - }; - - /** - * Moves a dynamic code entry. Throws an exception if there is no dynamic - * code entry with the specified starting address. - * - * @param {number} from The starting address of the entry being moved. - * @param {number} to The destination address. - */ - CodeMap.prototype.moveCode = function(from, to) { - var removedNode = this.dynamics_.remove(from); - this.deleteAllCoveredNodes_(this.dynamics_, to, - to + removedNode.value.size); - this.dynamics_.insert(to, removedNode.value); - }; - - /** - * Discards a dynamic code entry. Throws an exception if there is no dynamic - * code entry with the specified starting address. - * - * @param {number} start The starting address of the entry being deleted. - */ - CodeMap.prototype.deleteCode = function(start) { - var removedNode = this.dynamics_.remove(start); - }; - - /** - * Adds a library entry. - * - * @param {number} start The starting address. - * @param {CodeMap.CodeEntry} codeEntry Code entry object. - */ - CodeMap.prototype.addLibrary = function( - start, codeEntry) { - this.markPages_(start, start + codeEntry.size); - this.libraries_.insert(start, codeEntry); - }; - - /** - * Adds a static code entry. - * - * @param {number} start The starting address. - * @param {CodeMap.CodeEntry} codeEntry Code entry object. - */ - CodeMap.prototype.addStaticCode = function( - start, codeEntry) { - this.statics_.insert(start, codeEntry); - }; - - /** - * @private - */ - CodeMap.prototype.markPages_ = function(start, end) { - for (var addr = start; addr <= end; - addr += CodeMap.PAGE_SIZE) { - this.pages_[addr >>> CodeMap.PAGE_ALIGNMENT] = 1; - } - }; - - /** - * @private - */ - CodeMap.prototype.deleteAllCoveredNodes_ = function(tree, start, end) { - var to_delete = []; - var addr = end - 1; - while (addr >= start) { - var node = tree.findGreatestLessThan(addr); - if (!node) break; - var start2 = node.key, end2 = start2 + node.value.size; - if (start2 < end && start < end2) to_delete.push(start2); - addr = start2 - 1; - } - for (var i = 0, l = to_delete.length; i < l; ++i) tree.remove(to_delete[i]); - }; - - /** - * @private - */ - CodeMap.prototype.isAddressBelongsTo_ = function(addr, node) { - return addr >= node.key && addr < (node.key + node.value.size); - }; - - /** - * @private - */ - CodeMap.prototype.findInTree_ = function(tree, addr) { - var node = tree.findGreatestLessThan(addr); - return node && this.isAddressBelongsTo_(addr, node) ? node.value : null; - }; - - /** - * Finds a code entry that contains the specified address in static libraries. - * - * @param {number} addr Address. - */ - CodeMap.prototype.findEntryInLibraries = function(addr) { - var pageAddr = addr >>> CodeMap.PAGE_ALIGNMENT; - if (pageAddr in this.pages_) - return this.findInTree_(this.libraries_, addr); - return undefined; - }; - - /** - * Finds a code entry that contains the specified address. Both static and - * dynamic code entries are considered. - * - * @param {number} addr Address. - */ - CodeMap.prototype.findEntry = function(addr) { - var pageAddr = addr >>> CodeMap.PAGE_ALIGNMENT; - if (pageAddr in this.pages_) { - // Static code entries can contain "holes" of unnamed code. - // In this case, the whole library is assigned to this address. - return this.findInTree_(this.statics_, addr) || - this.findInTree_(this.libraries_, addr); - } - var min = this.dynamics_.findMin(); - var max = this.dynamics_.findMax(); - if (max != null && addr < (max.key + max.value.size) && addr >= min.key) { - var dynaEntry = this.findInTree_(this.dynamics_, addr); - if (dynaEntry == null) return null; - // Dedupe entry name. - if (!dynaEntry.nameUpdated_) { - dynaEntry.name = this.dynamicsNameGen_.getName(dynaEntry.name); - dynaEntry.nameUpdated_ = true; - } - return dynaEntry; - } - return null; - }; - - /** - * Returns a dynamic code entry using its starting address. - * - * @param {number} addr Address. - */ - CodeMap.prototype.findDynamicEntryByStartAddress = - function(addr) { - var node = this.dynamics_.find(addr); - return node ? node.value : null; - }; - - /** - * Returns an array of all dynamic code entries. - */ - CodeMap.prototype.getAllDynamicEntries = function() { - return this.dynamics_.exportValues(); - }; - - /** - * Returns an array of pairs of all dynamic code entries and their addresses. - */ - CodeMap.prototype.getAllDynamicEntriesWithAddresses = function() { - return this.dynamics_.exportKeysAndValues(); - }; - - /** - * Returns an array of all static code entries. - */ - CodeMap.prototype.getAllStaticEntries = function() { - return this.statics_.exportValues(); - }; - - /** - * Returns an array of all libraries entries. - */ - CodeMap.prototype.getAllLibrariesEntries = function() { - return this.libraries_.exportValues(); - }; - - /** - * Enum for code state regarding its dynamic optimization. - * - * @enum {number} - */ - CodeMap.CodeState = { - COMPILED: 0, - OPTIMIZABLE: 1, - OPTIMIZED: 2 - }; - - /** - * Creates a code entry object. - * - * @param {number} size Code entry size in bytes. - * @param {string=} opt_name Code entry name. - * @constructor - */ - CodeMap.CodeEntry = function(size, opt_name, opt_type) { - this.id = tr.b.GUID.allocateSimple(); - this.size = size; - this.name_ = opt_name || ''; - this.type = opt_type || ''; - this.nameUpdated_ = false; - }; - - CodeMap.CodeEntry.prototype = { - __proto__: Object.prototype, - - get name() { - return this.name_; - }, - - set name(value) { - this.name_ = value; - }, - - toString: function() { - this.name_ + ': ' + this.size.toString(16); - } - }; - - CodeMap.CodeEntry.TYPE = { - SHARED_LIB: 'SHARED_LIB', - CPP: 'CPP' - }; - - /** - * Creates a dynamic code entry. - * - * @param {number} size Code size. - * @param {string} type Code type. - * @param {CodeMap.FunctionEntry} func Shared function entry. - * @param {CodeMap.CodeState} state Code optimization state. - * @constructor - */ - CodeMap.DynamicFuncCodeEntry = function(size, type, func, state) { - CodeMap.CodeEntry.call(this, size, '', type); - this.func = func; - this.state = state; - }; - - CodeMap.DynamicFuncCodeEntry.STATE_PREFIX = ['', '~', '*']; - - CodeMap.DynamicFuncCodeEntry.prototype = { - __proto__: CodeMap.CodeEntry.prototype, - - /** - * Returns node name. - */ - get name() { - return CodeMap.DynamicFuncCodeEntry.STATE_PREFIX[this.state] + - this.func.name; - }, - - set name(value) { - this.name_ = value; - }, - - /** - * Returns raw node name (without type decoration). - */ - getRawName: function() { - return this.func.getName(); - }, - - isJSFunction: function() { - return true; - }, - - toString: function() { - return this.type + ': ' + this.name + ': ' + this.size.toString(16); - } - }; - - /** - * Creates a shared function object entry. - * - * @param {string} name Function name. - * @constructor - */ - CodeMap.FunctionEntry = function(name) { - CodeMap.CodeEntry.call(this, 0, name); - }; - - CodeMap.FunctionEntry.prototype = { - __proto__: CodeMap.CodeEntry.prototype, - - /** - * Returns node name. - */ - get name() { - var name = this.name_; - if (name.length == 0) { - name = '<anonymous>'; - } else if (name.charAt(0) == ' ') { - // An anonymous function with location: " aaa.js:10". - name = '<anonymous>' + name; - } - return name; - }, - - set name(value) { - this.name_ = value; - } - }; - - CodeMap.NameGenerator = function() { - this.knownNames_ = {}; - }; - - CodeMap.NameGenerator.prototype.getName = function(name) { - if (!(name in this.knownNames_)) { - this.knownNames_[name] = 0; - return name; - } - var count = ++this.knownNames_[name]; - return name + ' {' + count + '}'; - }; - return { - CodeMap: CodeMap - }; -}); -</script> - diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/log_reader.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/log_reader.html deleted file mode 100644 index 9b10ab69b96..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/log_reader.html +++ /dev/null @@ -1,213 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2012 The Chromium Authors. All rights reserved. -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. ---> -<link rel="import" href="/tracing/base/base.html"> -<script> -'use strict'; - -/** - * @fileoverview Log Reader is used to process log file produced by V8. - */ -tr.exportTo('tr.e.importer.v8', function() { - /** - * Creates a CSV lines parser. - */ - function CsvParser() { }; - - /** - * A regex for matching a CSV field. - * @private - */ - CsvParser.CSV_FIELD_RE_ = /^"((?:[^"]|"")*)"|([^,]*)/; - - /** - * A regex for matching a double quote. - * @private - */ - CsvParser.DOUBLE_QUOTE_RE_ = /""/g; - - /** - * Parses a line of CSV-encoded values. Returns an array of fields. - * - * @param {string} line Input line. - */ - CsvParser.prototype.parseLine = function(line) { - var fieldRe = CsvParser.CSV_FIELD_RE_; - var doubleQuoteRe = CsvParser.DOUBLE_QUOTE_RE_; - var pos = 0; - var endPos = line.length; - var fields = []; - if (endPos > 0) { - do { - var fieldMatch = fieldRe.exec(line.substr(pos)); - if (typeof fieldMatch[1] === 'string') { - var field = fieldMatch[1]; - pos += field.length + 3; // Skip comma and quotes. - fields.push(field.replace(doubleQuoteRe, '"')); - } else { - // The second field pattern will match anything, thus - // in the worst case the match will be an empty string. - var field = fieldMatch[2]; - pos += field.length + 1; // Skip comma. - fields.push(field); - } - } while (pos <= endPos); - } - return fields; - }; - - /** - * Base class for processing log files. - * - * @param {Array.<Object>} dispatchTable A table used for parsing and - * processing log records. - * - * @constructor - */ - function LogReader(dispatchTable) { - /** - * @type {Array.<Object>} - */ - this.dispatchTable_ = dispatchTable; - - /** - * Current line. - * @type {number} - */ - this.lineNum_ = 0; - - /** - * CSV lines parser. - * @type {CsvParser} - */ - this.csvParser_ = new CsvParser(); - }; - - /** - * Used for printing error messages. - * - * @param {string} str Error message. - */ - LogReader.prototype.printError = function(str) { - // Do nothing. - }; - - /** - * Processes a portion of V8 profiler event log. - * - * @param {string} chunk A portion of log. - */ - LogReader.prototype.processLogChunk = function(chunk) { - this.processLog_(chunk.split('\n')); - }; - - /** - * Processes a line of V8 profiler event log. - * - * @param {string} line A line of log. - */ - LogReader.prototype.processLogLine = function(line) { - this.processLog_([line]); - }; - - /** - * Processes stack record. - * - * @param {number} pc Program counter. - * @param {number} func JS Function. - * @param {Array.<string>} stack String representation of a stack. - * @return {Array.<number>} Processed stack. - */ - LogReader.prototype.processStack = function(pc, func, stack) { - var fullStack = func ? [pc, func] : [pc]; - var prevFrame = pc; - for (var i = 0, n = stack.length; i < n; ++i) { - var frame = stack[i]; - var firstChar = frame.charAt(0); - if (firstChar == '+' || firstChar == '-') { - // An offset from the previous frame. - prevFrame += parseInt(frame, 16); - fullStack.push(prevFrame); - // Filter out possible 'overflow' string. - } else if (firstChar != 'o') { - fullStack.push(parseInt(frame, 16)); - } - } - return fullStack; - }; - - /** - * Returns whether a particular dispatch must be skipped. - * - * @param {!Object} dispatch Dispatch record. - * @return {boolean} True if dispatch must be skipped. - */ - LogReader.prototype.skipDispatch = function(dispatch) { - return false; - }; - - /** - * Does a dispatch of a log record. - * - * @param {Array.<string>} fields Log record. - * @private - */ - LogReader.prototype.dispatchLogRow_ = function(fields) { - // Obtain the dispatch. - var command = fields[0]; - if (!(command in this.dispatchTable_)) return; - - var dispatch = this.dispatchTable_[command]; - - if (dispatch === null || this.skipDispatch(dispatch)) { - return; - } - - // Parse fields. - var parsedFields = []; - for (var i = 0; i < dispatch.parsers.length; ++i) { - var parser = dispatch.parsers[i]; - if (parser === null) { - parsedFields.push(fields[1 + i]); - } else if (typeof parser == 'function') { - parsedFields.push(parser(fields[1 + i])); - } else { - // var-args - parsedFields.push(fields.slice(1 + i)); - break; - } - } - - // Run the processor. - dispatch.processor.apply(this, parsedFields); - }; - - /** - * Processes log lines. - * - * @param {Array.<string>} lines Log lines. - * @private - */ - LogReader.prototype.processLog_ = function(lines) { - for (var i = 0, n = lines.length; i < n; ++i, ++this.lineNum_) { - var line = lines[i]; - if (!line) { - continue; - } - try { - var fields = this.csvParser_.parseLine(line); - this.dispatchLogRow_(fields); - } catch (e) { - this.printError('line ' + (this.lineNum_ + 1) + ': ' + - (e.message || e)); - } - } - }; - return { - LogReader: LogReader - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/splaytree.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/splaytree.html deleted file mode 100644 index 05f803765db..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/splaytree.html +++ /dev/null @@ -1,306 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2012 The Chromium Authors. All rights reserved. -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. ---> -<link rel="import" href="/tracing/base/base.html"> -<script> -'use strict'; - -/** - * @fileoverview Splay tree used by CodeMap. - */ -tr.exportTo('tr.e.importer.v8', function() { - /** - * Constructs a Splay tree. A splay tree is a self-balancing binary - * search tree with the additional property that recently accessed - * elements are quick to access again. It performs basic operations - * such as insertion, look-up and removal in O(log(n)) amortized time. - * - * @constructor - */ - function SplayTree() { }; - - /** - * Pointer to the root node of the tree. - * - * @type {SplayTree.Node} - * @private - */ - SplayTree.prototype.root_ = null; - - /** - * @return {boolean} Whether the tree is empty. - */ - SplayTree.prototype.isEmpty = function() { - return !this.root_; - }; - - /** - * Inserts a node into the tree with the specified key and value if - * the tree does not already contain a node with the specified key. If - * the value is inserted, it becomes the root of the tree. - * - * @param {number} key Key to insert into the tree. - * @param {*} value Value to insert into the tree. - */ - SplayTree.prototype.insert = function(key, value) { - if (this.isEmpty()) { - this.root_ = new SplayTree.Node(key, value); - return; - } - // Splay on the key to move the last node on the search path for - // the key to the root of the tree. - this.splay_(key); - if (this.root_.key == key) { - return; - } - var node = new SplayTree.Node(key, value); - if (key > this.root_.key) { - node.left = this.root_; - node.right = this.root_.right; - this.root_.right = null; - } else { - node.right = this.root_; - node.left = this.root_.left; - this.root_.left = null; - } - this.root_ = node; - }; - - - /** - * Removes a node with the specified key from the tree if the tree - * contains a node with this key. The removed node is returned. If the - * key is not found, an exception is thrown. - * - * @param {number} key Key to find and remove from the tree. - * @return {SplayTree.Node} The removed node. - */ - SplayTree.prototype.remove = function(key) { - if (this.isEmpty()) { - throw Error('Key not found: ' + key); - } - this.splay_(key); - if (this.root_.key != key) { - throw Error('Key not found: ' + key); - } - var removed = this.root_; - if (!this.root_.left) { - this.root_ = this.root_.right; - } else { - var right = this.root_.right; - this.root_ = this.root_.left; - // Splay to make sure that the new root has an empty right child. - this.splay_(key); - // Insert the original right child as the right child of the new - // root. - this.root_.right = right; - } - return removed; - }; - - - /** - * Returns the node having the specified key or null if the tree doesn't - * contain a node with the specified key. - * - * - * @param {number} key Key to find in the tree. - * @return {SplayTree.Node} Node having the specified key. - */ - SplayTree.prototype.find = function(key) { - if (this.isEmpty()) { - return null; - } - this.splay_(key); - return this.root_.key == key ? this.root_ : null; - }; - - /** - * @return {SplayTree.Node} Node having the minimum key value. - */ - SplayTree.prototype.findMin = function() { - if (this.isEmpty()) { - return null; - } - var current = this.root_; - while (current.left) { - current = current.left; - } - return current; - }; - - /** - * @return {SplayTree.Node} Node having the maximum key value. - */ - SplayTree.prototype.findMax = function(opt_startNode) { - if (this.isEmpty()) { - return null; - } - var current = opt_startNode || this.root_; - while (current.right) { - current = current.right; - } - return current; - }; - - /** - * @return {SplayTree.Node} Node having the maximum key value that - * is less or equal to the specified key value. - */ - SplayTree.prototype.findGreatestLessThan = function(key) { - if (this.isEmpty()) { - return null; - } - // Splay on the key to move the node with the given key or the last - // node on the search path to the top of the tree. - this.splay_(key); - // Now the result is either the root node or the greatest node in - // the left subtree. - if (this.root_.key <= key) { - return this.root_; - } else if (this.root_.left) { - return this.findMax(this.root_.left); - } else { - return null; - } - }; - - /** - * @return {Array<*>} An array containing all the values of tree's nodes - * paired with keys. - * - */ - SplayTree.prototype.exportKeysAndValues = function() { - var result = []; - this.traverse_(function(node) { result.push([node.key, node.value]); }); - return result; - }; - - /** - * @return {Array<*>} An array containing all the values of tree's nodes. - */ - SplayTree.prototype.exportValues = function() { - var result = []; - this.traverse_(function(node) { result.push(node.value); }); - return result; - }; - - /** - * Perform the splay operation for the given key. Moves the node with - * the given key to the top of the tree. If no node has the given - * key, the last node on the search path is moved to the top of the - * tree. This is the simplified top-down splaying algorithm from: - * "Self-adjusting Binary Search Trees" by Sleator and Tarjan - * - * @param {number} key Key to splay the tree on. - * @private - */ - SplayTree.prototype.splay_ = function(key) { - if (this.isEmpty()) { - return; - } - // Create a dummy node. The use of the dummy node is a bit - // counter-intuitive: The right child of the dummy node will hold - // the L tree of the algorithm. The left child of the dummy node - // will hold the R tree of the algorithm. Using a dummy node, left - // and right will always be nodes and we avoid special cases. - var dummy, left, right; - dummy = left = right = new SplayTree.Node(null, null); - var current = this.root_; - while (true) { - if (key < current.key) { - if (!current.left) { - break; - } - if (key < current.left.key) { - // Rotate right. - var tmp = current.left; - current.left = tmp.right; - tmp.right = current; - current = tmp; - if (!current.left) { - break; - } - } - // Link right. - right.left = current; - right = current; - current = current.left; - } else if (key > current.key) { - if (!current.right) { - break; - } - if (key > current.right.key) { - // Rotate left. - var tmp = current.right; - current.right = tmp.left; - tmp.left = current; - current = tmp; - if (!current.right) { - break; - } - } - // Link left. - left.right = current; - left = current; - current = current.right; - } else { - break; - } - } - // Assemble. - left.right = current.left; - right.left = current.right; - current.left = dummy.right; - current.right = dummy.left; - this.root_ = current; - }; - - /** - * Performs a preorder traversal of the tree. - * - * @param {function(SplayTree.Node)} f Visitor function. - * @private - */ - SplayTree.prototype.traverse_ = function(f) { - var nodesToVisit = [this.root_]; - while (nodesToVisit.length > 0) { - var node = nodesToVisit.shift(); - if (node == null) { - continue; - } - f(node); - nodesToVisit.push(node.left); - nodesToVisit.push(node.right); - } - }; - - /** - * Constructs a Splay tree node. - * - * @param {number} key Key. - * @param {*} value Value. - */ - SplayTree.Node = function(key, value) { - this.key = key; - this.value = value; - }; - - /** - * @type {SplayTree.Node} - */ - SplayTree.Node.prototype.left = null; - - /** - * @type {SplayTree.Node} - */ - SplayTree.Node.prototype.right = null; - - return { - SplayTree: SplayTree - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer.html deleted file mode 100644 index 0fa1a9992c2..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer.html +++ /dev/null @@ -1,375 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 The Chromium Authors. All rights reserved. -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. ---> - -<link rel="import" href="/tracing/base/color_scheme.html"> -<link rel="import" href="/tracing/extras/importer/v8/codemap.html"> -<link rel="import" href="/tracing/extras/importer/v8/log_reader.html"> -<link rel="import" href="/tracing/importer/importer.html"> -<link rel="import" href="/tracing/model/model.html"> -<link rel="import" href="/tracing/model/slice.html"> - -<script> - -'use strict'; - -/** - * @fileoverview V8LogImporter imports v8.log files into the provided model. - */ -tr.exportTo('tr.e.importer.v8', function() { - var CodeEntry = tr.e.importer.v8.CodeMap.CodeEntry; - var CodeMap = tr.e.importer.v8.CodeMap; - var ColorScheme = tr.b.ColorScheme; - var DynamicFuncCodeEntry = tr.e.importer.v8.CodeMap.DynamicFuncCodeEntry; - var FunctionEntry = tr.e.importer.v8.CodeMap.FunctionEntry; - - function V8LogImporter(model, eventData) { - this.importPriority = 3; - this.model_ = model; - - this.logData_ = eventData; - - this.code_map_ = new CodeMap(); - this.v8_timer_thread_ = undefined; - this.v8_thread_ = undefined; - - this.root_stack_frame_ = new tr.model.StackFrame( - undefined, 'v8-root-stack-frame', 'v8-root-stack-frame', 0); - - // We reconstruct the stack timeline from ticks. - this.v8_stack_timeline_ = new Array(); - } - - var kV8BinarySuffixes = ['/d8', '/libv8.so']; - - - var TimerEventDefaultArgs = { - 'V8.Execute': { pause: false, no_execution: false}, - 'V8.External': { pause: false, no_execution: true}, - 'V8.CompileFullCode': { pause: true, no_execution: true}, - 'V8.RecompileSynchronous': { pause: true, no_execution: true}, - 'V8.RecompileParallel': { pause: false, no_execution: false}, - 'V8.CompileEval': { pause: true, no_execution: true}, - 'V8.Parse': { pause: true, no_execution: true}, - 'V8.PreParse': { pause: true, no_execution: true}, - 'V8.ParseLazy': { pause: true, no_execution: true}, - 'V8.GCScavenger': { pause: true, no_execution: true}, - 'V8.GCCompactor': { pause: true, no_execution: true}, - 'V8.GCContext': { pause: true, no_execution: true} - }; - - /** - * @return {boolean} Whether obj is a V8 log string. - */ - V8LogImporter.canImport = function(eventData) { - if (typeof(eventData) !== 'string' && !(eventData instanceof String)) - return false; - - return eventData.substring(0, 11) == 'v8-version,' || - eventData.substring(0, 12) == 'timer-event,' || - eventData.substring(0, 5) == 'tick,' || - eventData.substring(0, 15) == 'shared-library,' || - eventData.substring(0, 9) == 'profiler,' || - eventData.substring(0, 14) == 'code-creation,'; - }; - - V8LogImporter.prototype = { - - __proto__: tr.importer.Importer.prototype, - - get importerName() { - return 'V8LogImporter'; - }, - - processTimerEvent_: function(name, start, length) { - var args = TimerEventDefaultArgs[name]; - if (args === undefined) return; - start /= 1000; // Convert to milliseconds. - length /= 1000; - var colorId = ColorScheme.getColorIdForGeneralPurposeString(name); - var slice = new tr.model.Slice('v8', name, colorId, start, - args, length); - this.v8_timer_thread_.sliceGroup.pushSlice(slice); - }, - - processTimerEventStart_: function(name, start) { - var args = TimerEventDefaultArgs[name]; - if (args === undefined) return; - start /= 1000; // Convert to milliseconds. - this.v8_timer_thread_.sliceGroup.beginSlice('v8', name, start, args); - }, - - processTimerEventEnd_: function(name, end) { - end /= 1000; // Convert to milliseconds. - this.v8_timer_thread_.sliceGroup.endSlice(end); - }, - - processCodeCreateEvent_: function(type, kind, address, size, name, - maybe_func) { - function parseState(s) { - switch (s) { - case '': return CodeMap.CodeState.COMPILED; - case '~': return CodeMap.CodeState.OPTIMIZABLE; - case '*': return CodeMap.CodeState.OPTIMIZED; - } - throw new Error('unknown code state: ' + s); - } - - if (maybe_func.length) { - var funcAddr = parseInt(maybe_func[0]); - var state = parseState(maybe_func[1]); - var func = this.code_map_.findDynamicEntryByStartAddress(funcAddr); - if (!func) { - func = new FunctionEntry(name); - func.kind = kind; - this.code_map_.addCode(funcAddr, func); - } else if (func.name !== name) { - // Function object has been overwritten with a new one. - func.name = name; - } - var entry = this.code_map_.findDynamicEntryByStartAddress(address); - if (entry) { - if (entry.size === size && entry.func === func) { - // Entry state has changed. - entry.state = state; - } - } else { - entry = new DynamicFuncCodeEntry(size, type, func, state); - entry.kind = kind; - this.code_map_.addCode(address, entry); - } - } else { - var code_entry = new CodeEntry(size, name); - code_entry.kind = kind; - this.code_map_.addCode(address, code_entry); - } - }, - - processCodeMoveEvent_: function(from, to) { - this.code_map_.moveCode(from, to); - }, - - processCodeDeleteEvent_: function(address) { - this.code_map_.deleteCode(address); - }, - - processSharedLibrary_: function(name, start, end) { - var code_entry = new CodeEntry(end - start, name, - CodeEntry.TYPE.SHARED_LIB); - code_entry.kind = -3; // External code kind. - for (var i = 0; i < kV8BinarySuffixes.length; i++) { - var suffix = kV8BinarySuffixes[i]; - if (name.indexOf(suffix, name.length - suffix.length) >= 0) { - code_entry.kind = -1; // V8 runtime code kind. - break; - } - } - this.code_map_.addLibrary(start, code_entry); - }, - - processCppSymbol_: function(address, size, name) { - var code_entry = new CodeEntry(size, name, CodeEntry.TYPE.CPP); - code_entry.kind = -1; - this.code_map_.addStaticCode(address, code_entry); - }, - - processTickEvent_: function(pc, start, is_external_callback, - tos_or_external_callback, vmstate, stack) { - start /= 1000; - - function findChildWithEntryID(stackFrame, entryID) { - for (var i = 0; i < stackFrame.children.length; i++) { - if (stackFrame.children[i].entryID == entryID) - return stackFrame.children[i]; - } - return undefined; - } - - function processStack(pc, func, stack) { - var fullStack = func ? [pc, func] : [pc]; - var prevFrame = pc; - for (var i = 0, n = stack.length; i < n; ++i) { - var frame = stack[i]; - var firstChar = frame.charAt(0); - if (firstChar === '+' || firstChar === '-') { - // An offset from the previous frame. - prevFrame += parseInt(frame, 16); - fullStack.push(prevFrame); - // Filter out possible 'overflow' string. - } else if (firstChar !== 'o') { - fullStack.push(parseInt(frame, 16)); - } - // Otherwise, they will be skipped. - } - return fullStack; - } - - if (is_external_callback) { - // Don't use PC when in external callback code, as it can point - // inside callback's code, and we will erroneously report - // that a callback calls itself. Instead use tos_or_external_callback, - // as simply resetting PC will produce unaccounted ticks. - pc = tos_or_external_callback; - tos_or_external_callback = 0; - } else if (tos_or_external_callback) { - // Find out, if top of stack was pointing inside a JS function - // meaning that we have encountered a frameless invocation. - var funcEntry = this.code_map_.findEntry(tos_or_external_callback); - if (!funcEntry || !funcEntry.isJSFunction || !funcEntry.isJSFunction()) - tos_or_external_callback = 0; - } - - var processedStack = processStack(pc, tos_or_external_callback, stack); - var lastStackFrame = this.root_stack_frame_; - // v8 log stacks are inverted, leaf first and the root at the end. - processedStack = processedStack.reverse(); - for (var i = 0, n = processedStack.length; i < n; i++) { - var frame = processedStack[i]; - if (!frame) - break; - var entry = this.code_map_.findEntry(frame); - - if (!entry && i !== 0) { - continue; - } - - var sourceInfo = undefined; - if (entry && entry.type === CodeEntry.TYPE.CPP) { - var libEntry = this.code_map_.findEntryInLibraries(frame); - if (libEntry) - sourceInfo = libEntry.name; - } - - var entryID = entry ? entry.id : 'Unknown'; - var childFrame = findChildWithEntryID(lastStackFrame, entryID); - if (childFrame === undefined) { - var entryName = entry ? entry.name : 'Unknown'; - lastStackFrame = new tr.model.StackFrame( - lastStackFrame, 'v8sf-' + tr.b.GUID.allocateSimple(), entryName, - ColorScheme.getColorIdForGeneralPurposeString(entryName), - sourceInfo); - lastStackFrame.entryID = entryID; - this.model_.addStackFrame(lastStackFrame); - } else { - lastStackFrame = childFrame; - } - } - - if (lastStackFrame !== this.root_stack_frame_) { - var sample = new tr.model.Sample( - undefined, this.v8_thread_, 'V8 PC', - start, lastStackFrame, 1); - this.model_.samples.push(sample); - } - }, - - processDistortion_: function(distortion_in_picoseconds) { - // Do nothing. - }, - - processPlotRange_: function(start, end) { - // Do nothing. - }, - - processV8Version_: function(major, minor, build, patch, candidate) { - // Do nothing. - }, - - /** - * Walks through the events_ list and outputs the structures discovered to - * model_. - */ - importEvents: function() { - var logreader = new tr.e.importer.v8.LogReader( - { 'timer-event' : { - parsers: [null, parseInt, parseInt], - processor: this.processTimerEvent_.bind(this) - }, - 'shared-library': { - parsers: [null, parseInt, parseInt], - processor: this.processSharedLibrary_.bind(this) - }, - 'timer-event-start' : { - parsers: [null, parseInt], - processor: this.processTimerEventStart_.bind(this) - }, - 'timer-event-end' : { - parsers: [null, parseInt], - processor: this.processTimerEventEnd_.bind(this) - }, - 'code-creation': { - parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'], - processor: this.processCodeCreateEvent_.bind(this) - }, - 'code-move': { - parsers: [parseInt, parseInt], - processor: this.processCodeMoveEvent_.bind(this) - }, - 'code-delete': { - parsers: [parseInt], - processor: this.processCodeDeleteEvent_.bind(this) - }, - 'cpp': { - parsers: [parseInt, parseInt, null], - processor: this.processCppSymbol_.bind(this) - }, - 'tick': { - parsers: [parseInt, parseInt, parseInt, parseInt, parseInt, - 'var-args'], - processor: this.processTickEvent_.bind(this) - }, - 'distortion': { - parsers: [parseInt], - processor: this.processDistortion_.bind(this) - }, - 'plot-range': { - parsers: [parseInt, parseInt], - processor: this.processPlotRange_.bind(this) - }, - 'v8-version': { - parsers: [parseInt, parseInt, parseInt, parseInt, parseInt], - processor: this.processV8Version_.bind(this) - } - }); - - this.v8_timer_thread_ = - this.model_.getOrCreateProcess(-32).getOrCreateThread(1); - this.v8_timer_thread_.name = 'V8 Timers'; - this.v8_thread_ = - this.model_.getOrCreateProcess(-32).getOrCreateThread(2); - this.v8_thread_.name = 'V8'; - - var lines = this.logData_.split('\n'); - for (var i = 0; i < lines.length; i++) { - logreader.processLogLine(lines[i]); - } - - // The processing of samples adds all the root stack frame to - // this.root_stack_frame_. But, we don't want that stack frame in the real - // model. So get rid of it. - this.root_stack_frame_.removeAllChildren(); - - function addSlices(slices, thread) { - for (var i = 0; i < slices.length; i++) { - var duration = slices[i].end - slices[i].start; - var slice = new tr.model.Slice('v8', slices[i].name, - ColorScheme.getColorIdForGeneralPurposeString(slices[i].name), - slices[i].start, {}, duration); - thread.sliceGroup.pushSlice(slice); - addSlices(slices[i].children, thread); - } - } - addSlices(this.v8_stack_timeline_, this.v8_thread_); - } - }; - - tr.importer.Importer.register(V8LogImporter); - - return { - V8LogImporter: V8LogImporter - }; -}); -</script> diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer_test.html deleted file mode 100644 index fdbe447ca60..00000000000 --- a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer_test.html +++ /dev/null @@ -1,305 +0,0 @@ -<!DOCTYPE html> -<!-- -Copyright (c) 2013 The Chromium Authors. All rights reserved. -Use of this source code is governed by a BSD-style license that can be -found in the LICENSE file. ---> - -<link rel="import" href="/tracing/core/test_utils.html"> -<link rel="import" href="/tracing/extras/importer/v8/v8_log_importer.html"> - -<script> - -'use strict'; - -tr.b.unittest.testSuite(function() { - var V8LogImporter = tr.e.importer.v8.V8LogImporter; - - function newModel(events) { - return tr.c.TestUtils.newModelWithEvents([events], { - shiftWorldToZero: false - }); - } - - test('tickEventInSharedLibrary', function() { - var lines = [ - 'shared-library,"/usr/lib/libc++.1.dylib",0x99d8aae0,0x99dce729', - 'tick,0x99d8aae4,12158,0,0x0,5']; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var t = p.findAllThreadsNamed('V8')[0]; - assert.equal(t.samples.length, 1); - assert.equal(t.samples[0].title, 'V8 PC'); - assert.equal(t.samples[0].start, 12158 / 1000); - assert.equal(t.samples[0].leafStackFrame.title, '/usr/lib/libc++.1.dylib'); - }); - - test('tickEventInGeneratedCode', function() { - var lines = [ - 'shared-library,"/usr/lib/libc++.1.dylib",0x99d8aae0,0x99dce729', - 'code-creation,Stub,2,0x5b60ce80,1259,"StringAddStub"', - 'tick,0x5b60ce84,12158,0,0x0,5']; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var threads = p.findAllThreadsNamed('V8'); - var t = threads[0]; - assert.equal(t.samples.length, 1); - assert.equal(t.samples[0].leafStackFrame.title, 'StringAddStub'); - }); - - test('tickEventInUknownCode', function() { - var lines = [ - 'shared-library,"/usr/lib/libc++.1.dylib",0x99d8aae0,0x99dce729', - 'code-creation,Stub,2,0x5b60ce80,1259,"StringAddStub"', - 'tick,0x4,0xbff02f08,12158,0,0x0,5']; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var threads = p.findAllThreadsNamed('V8'); - var t = threads[0]; - assert.equal(t.samples.length, 1); - assert.equal(t.samples[0].leafStackFrame.title, 'Unknown'); - }); - - test('tickEventWithStack', function() { - var lines = [ - 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck - 'tick,0x7fc6fe34,528674,0,0x3,0,0x2905d304']; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var t = p.findAllThreadsNamed('V8')[0]; - assert.equal(t.samples.length, 1); - assert.deepEqual( - ['InstantiateFunction native apinatives.js:26:29'], - t.samples[0].getUserFriendlyStackTrace()); - }); - - test('twoTickEventsWithStack', function() { - var lines = [ - 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck - 'tick,0x7fc6fe34,528674,0,0x3,0,0x2905d304', - 'tick,0x7fd2a534,536213,0,0x81d8d080,0,0x2905d304']; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var t = p.findAllThreadsNamed('V8')[0]; - assert.equal(t.samples.length, 2); - assert.equal(t.samples[0].start, 528674 / 1000); - assert.equal(t.samples[1].start, 536213 / 1000); - assert.deepEqual( - ['InstantiateFunction native apinatives.js:26:29'], - t.samples[0].getUserFriendlyStackTrace()); - assert.deepEqual( - ['InstantiateFunction native apinatives.js:26:29'], - t.samples[1].getUserFriendlyStackTrace()); - assert.equal(t.samples[0].leafStackFrame, - t.samples[1].leafStackFrame); - }); - - test('twoTickEventsWithTwoStackFrames', function() { - var lines = [ - 'code-creation,LazyCompile,0,0x2904d560,876,"Instantiate native apinatives.js:9:21",0x56b190c8,~', // @suppress longLineCheck - 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck - 'tick,0x7fc6fe34,528674,0,0x3,0,0x2905d304,0x2904d6e8', - 'tick,0x7fd2a534,536213,0,0x81d8d080,0,0x2905d304,0x2904d6e8']; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var t = p.findAllThreadsNamed('V8')[0]; - assert.equal(t.samples.length, 2); - - assert.equal(t.samples[0].start, 528674 / 1000); - assert.equal(t.samples[1].start, 536213 / 1000); - assert.deepEqual( - ['InstantiateFunction native apinatives.js:26:29', - '~Instantiate native apinatives.js:9:21'], - t.samples[0].getUserFriendlyStackTrace()); - assert.deepEqual( - ['InstantiateFunction native apinatives.js:26:29', - '~Instantiate native apinatives.js:9:21'], - t.samples[1].getUserFriendlyStackTrace()); - - var childStackFrame = t.samples[0].leafStackFrame; - assert.equal(childStackFrame, t.samples[1].leafStackFrame); - assert.equal(childStackFrame.children.length, 0); - - var parentStackFrame = childStackFrame.parentFrame; - assert.equal(parentStackFrame.children.length, 1); - assert.equal(childStackFrame, parentStackFrame.children[0]); - - }); - - test('threeTickEventsWithTwoStackFrames', function() { - var lines = [ - 'code-creation,LazyCompile,0,0x2904d560,876,"Instantiate native apinatives.js:9:21",0x56b190c8,~', // @suppress longLineCheck - 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck - 'tick,0x7fd7f75c,518328,0,0x81d86da8,2,0x2904d6e8', - 'tick,0x7fc6fe34,528674,0,0x3,0,0x2905d304,0x2904d6e8', - 'tick,0x7fd2a534,536213,0,0x81d8d080,0,0x2905d304,0x2904d6e8']; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var threads = p.findAllThreadsNamed('V8'); - - var t = threads[0]; - assert.equal(t.samples.length, 3); - assert.equal(t.samples[0].start, 518328 / 1000); - assert.equal(t.samples[1].start, 528674 / 1000); - assert.equal(t.samples[2].start, 536213 / 1000); - assert.deepEqual( - ['~Instantiate native apinatives.js:9:21'], - t.samples[0].getUserFriendlyStackTrace()); - assert.deepEqual( - ['InstantiateFunction native apinatives.js:26:29', - '~Instantiate native apinatives.js:9:21'], - t.samples[1].getUserFriendlyStackTrace()); - assert.deepEqual( - ['InstantiateFunction native apinatives.js:26:29', - '~Instantiate native apinatives.js:9:21'], - t.samples[2].getUserFriendlyStackTrace()); - - var topLevelStackFrame = t.samples[0].leafStackFrame; - var childStackFrame = t.samples[1].leafStackFrame; - assert.equal(t.samples[2].leafStackFrame, childStackFrame); - assert.equal(topLevelStackFrame, childStackFrame.parentFrame); - assert.equal(topLevelStackFrame.children.length, 1); - assert.equal(childStackFrame.children.length, 0); - assert.equal(childStackFrame, topLevelStackFrame.children[0]); - }); - - test('twoSubStacks', function() { - var lines = [ - 'code-creation,LazyCompile,0,0x2904d560,876,"Instantiate native apinatives.js:9:21",0x56b190c8,~', // @suppress longLineCheck - 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck - 'tick,0x7fd7f75c,518328,0,0x81d86da8,2,0x2904d6e8', - 'tick,0x7fc6fe34,528674,0,0x3,0,0x2905d304,0x2904d6e8', - 'tick,0x7fd2a534,536213,0,0x81d8d080,0,0x2905d304,0x2904d6e8', - 'code-creation,Script,0,0x2906a7c0,792,"http://www.google.com/",0x5b12fe50,~', // @suppress longLineCheck - 'tick,0xb6f51d30,794049,0,0xb6f7b368,2,0x2906a914', - 'tick,0xb6f51d30,799146,0,0xb6f7b368,0,0x2906a914' - ]; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var threads = p.findAllThreadsNamed('V8'); - var t = threads[0]; - assert.equal(t.samples.length, 5); - - assert.equal(t.samples[0].start, 518328 / 1000); - assert.equal(t.samples[1].start, 528674 / 1000); - assert.equal(t.samples[2].start, 536213 / 1000); - assert.equal(t.samples[3].start, 794049 / 1000); - assert.equal(t.samples[4].start, 799146 / 1000); - - assert.deepEqual( - ['~Instantiate native apinatives.js:9:21'], - t.samples[0].getUserFriendlyStackTrace()); - assert.deepEqual( - ['InstantiateFunction native apinatives.js:26:29', - '~Instantiate native apinatives.js:9:21'], - t.samples[1].getUserFriendlyStackTrace()); - assert.deepEqual( - ['InstantiateFunction native apinatives.js:26:29', - '~Instantiate native apinatives.js:9:21'], - t.samples[2].getUserFriendlyStackTrace()); - assert.deepEqual(['~http://www.google.com/'], - t.samples[3].getUserFriendlyStackTrace()); - assert.deepEqual(['~http://www.google.com/'], - t.samples[4].getUserFriendlyStackTrace()); - - var firsStackTopLevelStackFrame = t.samples[0].leafStackFrame; - var firsStackChildStackFrame = t.samples[1].leafStackFrame; - assert.equal(firsStackChildStackFrame, t.samples[2].leafStackFrame); - assert.equal(firsStackTopLevelStackFrame, - firsStackChildStackFrame.parentFrame); - assert.equal(firsStackTopLevelStackFrame.children.length, 1); - assert.equal(firsStackChildStackFrame.children.length, 0); - assert.equal(firsStackChildStackFrame, - firsStackTopLevelStackFrame.children[0]); - - var secondStackStackFrame = t.samples[3].leafStackFrame; - assert.equal(secondStackStackFrame, t.samples[4].leafStackFrame); - assert.equal(secondStackStackFrame.children.length, 0); - assert.isUndefined(secondStackStackFrame.parentFrame); - }); - - test('timerEventSliceCreation', function() { - var lines = ['timer-event,"V8.External",38189483,3']; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var threads = p.findAllThreadsNamed('V8 Timers'); - assert.isDefined(threads); - assert.equal(threads.length, 1); - var t = threads[0]; - assert.equal(t.sliceGroup.length, 1); - }); - - test('processThreadCreation', function() { - var lines = ['timer-event,"V8.External",38189483,3']; - var m = newModel(lines.join('\n')); - assert.isDefined(m); - var p = m.processes[-32]; - assert.isDefined(p); - var threads = p.findAllThreadsNamed('V8 Timers'); - assert.isDefined(threads); - assert.equal(1, threads.length); - var t = threads[0]; - assert.equal('V8 Timers', t.name); - }); - - test('canImport', function() { - assert.isTrue(V8LogImporter.canImport( - 'timer-event,"V8.External",38189483,3')); - assert.isTrue(V8LogImporter.canImport('v8-version,4,3,66,0,0')); - assert.isFalse(V8LogImporter.canImport('')); - assert.isFalse(V8LogImporter.canImport([])); - }); - - test('CppSymbolsProcess', function() { - var lines = [ - 'shared-library,"/usr/loca/v8/out/native/d8",0x00400000, 0x01860000', - 'cpp,0x00600000,100,"v8::internal::Heap::AllocateByteArray"', - 'cpp,0x00700000,100,"v8::internal::Utf8StringKey::AsHandle"', - 'tick,0x00600010,121,0,0x0,5', - 'tick,0x00700010,122,0,0x0,5', - 'tick,0x00800010,123,0,0x0,5']; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var t = p.findAllThreadsNamed('V8')[0]; - assert.equal(t.samples.length, 3); - assert.equal(t.samples[0].leafStackFrame.title, - 'v8::internal::Heap::AllocateByteArray /usr/loca/v8/out/native/d8'); // @suppress longLineCheck - assert.equal(t.samples[1].leafStackFrame.title, - 'v8::internal::Utf8StringKey::AsHandle /usr/loca/v8/out/native/d8'); // @suppress longLineCheck - assert.equal(t.samples[2].leafStackFrame.title, - '/usr/loca/v8/out/native/d8'); - }); - - test('CppSymbolsWithJsStack', function() { - var lines = [ - 'shared-library,"/usr/loca/v8/out/native/d8",0x00400000, 0x01860000', - 'cpp,0x00600000,100,"v8::internal::Heap::AllocateByteArray"', - 'cpp,0x00700000,100,"v8::internal::Utf8StringKey::AsHandle"', - 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck - 'tick,0x00700010,1,0,0x3,0,0x2905d304', - 'tick,0x00600010,3,0,0x3,0,0x2905d306', - 'tick,0x00800010,5,0,0x3,0,0x2905d306', - 'tick,0x01860010,5,0,0x3,0,0x2905d306']; - var m = newModel(lines.join('\n')); - var p = m.processes[-32]; - var t = p.findAllThreadsNamed('V8')[0]; - assert.equal(t.samples.length, 4); - assert.deepEqual(t.samples[0].stackTrace.map(r => r.title), [ - 'v8::internal::Utf8StringKey::AsHandle /usr/loca/v8/out/native/d8', - 'InstantiateFunction native apinatives.js:26:29' - ]); - assert.deepEqual(t.samples[1].stackTrace.map(r => r.title), [ - 'v8::internal::Heap::AllocateByteArray /usr/loca/v8/out/native/d8', - 'InstantiateFunction native apinatives.js:26:29' - ]); - assert.deepEqual(t.samples[2].stackTrace.map(r => r.title), [ - '/usr/loca/v8/out/native/d8', - 'InstantiateFunction native apinatives.js:26:29' - ]); - assert.deepEqual(t.samples[3].stackTrace.map(r => r.title), [ - 'InstantiateFunction native apinatives.js:26:29' - ]); - }); -}); -</script> - |