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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineJSProfile.js

Issue 2495903003: DevTools: Show friendly names for Parse/Compile RCS (Closed)
Patch Set: 4 landing Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 WebInspector.TimelineJSProfileProcessor = class { 5 WebInspector.TimelineJSProfileProcessor = class {
6 /** 6 /**
7 * @param {!WebInspector.CPUProfileDataModel} jsProfileModel 7 * @param {!WebInspector.CPUProfileDataModel} jsProfileModel
8 * @param {!WebInspector.TracingModel.Thread} thread 8 * @param {!WebInspector.TracingModel.Thread} thread
9 * @return {!Array<!WebInspector.TracingModel.Event>} 9 * @return {!Array<!WebInspector.TracingModel.Event>}
10 */ 10 */
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 var jsFrameEvents = []; 73 var jsFrameEvents = [];
74 var jsFramesStack = []; 74 var jsFramesStack = [];
75 var lockedJsStackDepth = []; 75 var lockedJsStackDepth = [];
76 var ordinal = 0; 76 var ordinal = 0;
77 const showAllEvents = Runtime.experiments.isEnabled('timelineShowAllEvents') ; 77 const showAllEvents = Runtime.experiments.isEnabled('timelineShowAllEvents') ;
78 const showRuntimeCallStats = Runtime.experiments.isEnabled('timelineV8Runtim eCallStats'); 78 const showRuntimeCallStats = Runtime.experiments.isEnabled('timelineV8Runtim eCallStats');
79 const showNativeFunctions = WebInspector.moduleSetting('showNativeFunctionsI nJSProfile').get(); 79 const showNativeFunctions = WebInspector.moduleSetting('showNativeFunctionsI nJSProfile').get();
80 80
81 const visibleV8RuntimeStatsItems = new Set([
82 'Compile',
83 'CompileCode',
84 'CompileCodeLazy',
85 'CompileDeserialize',
86 'CompileEval',
87 'CompileFullCode',
88 'CompileIgnition',
89 'CompilerDispatcher',
90 'CompileSerialize',
91 'DeoptimizeCode',
92 'OptimizeCode',
93 'ParseProgram',
94 'ParseFunction',
95 'RecompileConcurrent',
96 'RecompileSynchronous',
97 'ParseLazy'
98 ]);
99
100 /** 81 /**
101 * @param {!WebInspector.TracingModel.Event} e 82 * @param {!WebInspector.TracingModel.Event} e
102 */ 83 */
103 function onStartEvent(e) { 84 function onStartEvent(e) {
104 e.ordinal = ++ordinal; 85 e.ordinal = ++ordinal;
105 extractStackTrace(e); 86 extractStackTrace(e);
106 // For the duration of the event we cannot go beyond the stack associated with it. 87 // For the duration of the event we cannot go beyond the stack associated with it.
107 lockedJsStackDepth.push(jsFramesStack.length); 88 lockedJsStackDepth.push(jsFramesStack.length);
108 } 89 }
109 90
(...skipping 29 matching lines...) Expand all
139 if (jsFramesStack.length < depth) { 120 if (jsFramesStack.length < depth) {
140 console.error(`Trying to truncate higher than the current stack size at ${time}`); 121 console.error(`Trying to truncate higher than the current stack size at ${time}`);
141 depth = jsFramesStack.length; 122 depth = jsFramesStack.length;
142 } 123 }
143 for (var k = 0; k < jsFramesStack.length; ++k) 124 for (var k = 0; k < jsFramesStack.length; ++k)
144 jsFramesStack[k].setEndTime(time); 125 jsFramesStack[k].setEndTime(time);
145 jsFramesStack.length = depth; 126 jsFramesStack.length = depth;
146 } 127 }
147 128
148 /** 129 /**
130 * @param {string} name
131 * @return {boolean}
132 */
133 function showNativeName(name) {
134 return showRuntimeCallStats && !!WebInspector.TimelineJSProfileProcessor.n ativeGroup(name);
135 }
136
137 /**
149 * @param {!Array<!Protocol.Runtime.CallFrame>} stack 138 * @param {!Array<!Protocol.Runtime.CallFrame>} stack
150 */ 139 */
151 function filterStackFrames(stack) { 140 function filterStackFrames(stack) {
152 if (showAllEvents) 141 if (showAllEvents)
153 return; 142 return;
154 var isPreviousFrameNative = false; 143 var isPreviousFrameNative = false;
155 for (var i = 0, j = 0; i < stack.length; ++i) { 144 for (var i = 0, j = 0; i < stack.length; ++i) {
156 const frame = stack[i]; 145 const frame = stack[i];
157 const url = frame.url; 146 const url = frame.url;
158 const isNativeFrame = url && url.startsWith('native '); 147 const isNativeFrame = url && url.startsWith('native ');
159 if (!showNativeFunctions && isNativeFrame) 148 if (!showNativeFunctions && isNativeFrame)
160 continue; 149 continue;
161 if (url === 'native V8Runtime' && (!visibleV8RuntimeStatsItems.has(frame .functionName) || !showRuntimeCallStats)) 150 if (WebInspector.TimelineJSProfileProcessor.isNativeRuntimeFrame(frame) && !showNativeName(frame.functionName))
162 continue; 151 continue;
163 if (isPreviousFrameNative && isNativeFrame) 152 if (isPreviousFrameNative && isNativeFrame)
164 continue; 153 continue;
165 isPreviousFrameNative = isNativeFrame; 154 isPreviousFrameNative = isNativeFrame;
166 stack[j++] = frame; 155 stack[j++] = frame;
167 } 156 }
168 stack.length = j; 157 stack.length = j;
169 } 158 }
170 159
171 /** 160 /**
(...skipping 29 matching lines...) Expand all
201 jsFrameEvents.push(jsFrameEvent); 190 jsFrameEvents.push(jsFrameEvent);
202 } 191 }
203 } 192 }
204 193
205 const firstTopLevelEvent = events.find(WebInspector.TracingModel.isTopLevelE vent); 194 const firstTopLevelEvent = events.find(WebInspector.TracingModel.isTopLevelE vent);
206 if (firstTopLevelEvent) 195 if (firstTopLevelEvent)
207 WebInspector.TimelineModel.forEachEvent( 196 WebInspector.TimelineModel.forEachEvent(
208 events, onStartEvent, onEndEvent, onInstantEvent, firstTopLevelEvent.s tartTime); 197 events, onStartEvent, onEndEvent, onInstantEvent, firstTopLevelEvent.s tartTime);
209 return jsFrameEvents; 198 return jsFrameEvents;
210 } 199 }
200
201 /**
202 * @param {!Protocol.Runtime.CallFrame} frame
203 * @return {boolean}
204 */
205 static isNativeRuntimeFrame(frame) {
206 return frame.url === 'native V8Runtime';
207 }
208
209 /**
210 * @param {string} nativeName
211 * @return {?WebInspector.TimelineJSProfileProcessor.NativeGroups}
212 */
213 static nativeGroup(nativeName) {
214 var map = WebInspector.TimelineJSProfileProcessor.nativeGroup._map;
215 if (!map) {
216 const nativeGroups = WebInspector.TimelineJSProfileProcessor.NativeGroups;
217 map = new Map([
218 ['Compile', nativeGroups.Compile],
219 ['CompileCode', nativeGroups.Compile],
220 ['CompileCodeLazy', nativeGroups.Compile],
221 ['CompileDeserialize', nativeGroups.Compile],
222 ['CompileEval', nativeGroups.Compile],
223 ['CompileFullCode', nativeGroups.Compile],
224 ['CompileIgnition', nativeGroups.Compile],
225 ['CompilerDispatcher', nativeGroups.Compile],
226 ['CompileSerialize', nativeGroups.Compile],
227 ['ParseProgram', nativeGroups.Parse],
228 ['ParseFunction', nativeGroups.Parse],
229 ['RecompileConcurrent', nativeGroups.Compile],
230 ['RecompileSynchronous', nativeGroups.Compile],
231 ['ParseLazy', nativeGroups.Parse]
232 ]);
233 /** @type {!Map<string, !WebInspector.TimelineJSProfileProcessor.NativeGro ups>} */
234 WebInspector.TimelineJSProfileProcessor.nativeGroup._map = map;
235 }
236 return map.get(nativeName) || null;
237 }
211 }; 238 };
239
240 /** @enum {string} */
241 WebInspector.TimelineJSProfileProcessor.NativeGroups = {
242 'Compile': 'Compile',
243 'Parse': 'Parse'
244 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698