Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: tracing/tracing/extras/importer/trace_code_entry.html

Issue 1276003004: Process v8 sampling data into the trace model. (Closed) Base URL: git@github.com:catapult-project/catapult.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tracing/tracing/extras/importer/trace_code_entry.html
diff --git a/tracing/tracing/extras/importer/trace_code_entry.html b/tracing/tracing/extras/importer/trace_code_entry.html
new file mode 100644
index 0000000000000000000000000000000000000000..9db86e3a8d8861278694a144e86e635466fdd4e8
--- /dev/null
+++ b/tracing/tracing/extras/importer/trace_code_entry.html
@@ -0,0 +1,72 @@
+<!DOCTYPE html>
+<!--
+Copyright 2015 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/codemap.html">
+<link rel="import" href="/tracing/model/source_info/js_source_info.html">
+
+<script>
+'use strict';
+
+/**
+ * @fileoverview TraceCodeEntry is a wrapper around the V8 CodeEntry that
+ * extract extra context information for each item. This includes things like
petrcermak 2015/08/13 15:15:56 nit: s/extract/extracts/ (one wrapper)
dsinclair 2015/08/13 15:43:38 Done.
+ * the source file, line and if the function is a native method or not.
+ */
+tr.exportTo('tr.e.importer', function() {
+ function TraceCodeEntry(size, name, scriptId) {
+ var methodName = undefined;
+ var script = undefined;
+ var lineNum = -1;
+ var isNative = false;
+
+ if (name.startsWith('LazyCompile:')) {
+ var cleanName = name.replace(/LazyCompile:~?/, '');
+ var idx = cleanName.lastIndexOf(' ');
+ if (idx < 0) {
+ methodName = cleanName;
+ } else {
+ methodName = cleanName.substring(0, idx);
+ script = cleanName.substring(idx + 1);
+
+ var matches = script.match(/(.*):(\d+)$/);
+ if (matches !== null) {
+ script = matches[1];
+ lineNum = parseInt(matches[2]);
+ }
+ }
+
+ if (methodName.endsWith(' native')) {
+ isNative = true;
+ methodName = methodName.replace(/\s+native$/, '');
+ }
+
+ if (methodName === '')
+ methodName = 'unknown';
+ } else {
+ methodName = name;
+ }
+
+ tr.e.importer.v8.CodeMap.CodeEntry.call(this, size, methodName);
+
+ this.sourceInfo_ = new tr.model.source_info.JSSourceInfo(
+ script, lineNum, isNative, scriptId);
+ };
+
+ TraceCodeEntry.prototype = {
+ __proto__: tr.e.importer.v8.CodeMap.CodeEntry.prototype,
+
+ get sourceInfo() {
+ return this.sourceInfo_;
+ }
+ };
+
+ return {
+ TraceCodeEntry: TraceCodeEntry
+ };
+});
+</script>
+

Powered by Google App Engine
This is Rietveld 408576698