diff options
-rw-r--r-- | webkit/glue/devtools/js/profiler_processor.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/webkit/glue/devtools/js/profiler_processor.js b/webkit/glue/devtools/js/profiler_processor.js index 48893e6..b655229 100644 --- a/webkit/glue/devtools/js/profiler_processor.js +++ b/webkit/glue/devtools/js/profiler_processor.js @@ -110,21 +110,32 @@ goog.inherits(devtools.profiler.JsProfile, devtools.profiler.Profile); /** - * RegExp that leaves only non-native JS functions. + * RegExp that leaves only JS functions. * @type {RegExp} */ -devtools.profiler.JsProfile.JS_NON_NATIVE_RE = new RegExp( - '^' + - '(?:Callback:)|' + - '(?:Script: (?!native))|' + - '(?:(?:LazyCompile|Function): [^ ]*(?: (?!native ).*\\.js:\\d+)?$)'); +devtools.profiler.JsProfile.JS_FUNC_RE = /^(LazyCompile|Function|Script|Callback):/; + +/** + * RegExp that filters out native code (ending with "native src.js:xxx"). + * @type {RegExp} + */ +devtools.profiler.JsProfile.JS_NATIVE_FUNC_RE = /\ native\ \w+\.js:\d+$/; + +/** + * RegExp that filters out native scripts. + * @type {RegExp} + */ +devtools.profiler.JsProfile.JS_NATIVE_SCRIPT_RE = /^Script:\ native/; /** * @override */ devtools.profiler.JsProfile.prototype.skipThisFunction = function(name) { - return !devtools.profiler.JsProfile.JS_NON_NATIVE_RE.test(name); + return !devtools.profiler.JsProfile.JS_FUNC_RE.test(name) || + // To profile V8's natives comment out two lines below and '||' above. + devtools.profiler.JsProfile.JS_NATIVE_FUNC_RE.test(name) || + devtools.profiler.JsProfile.JS_NATIVE_SCRIPT_RE.test(name); }; |