summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-28 17:40:29 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-28 17:40:29 +0000
commit468d0a051ed14b487321ff3535f2adc9b47f62a1 (patch)
tree446ad38358849b18cf998ebce04cf2f101e6f25d
parent379e7dd8c93fc59287a73bf801b134e459c2b10b (diff)
downloadchromium_src-468d0a051ed14b487321ff3535f2adc9b47f62a1.zip
chromium_src-468d0a051ed14b487321ff3535f2adc9b47f62a1.tar.gz
chromium_src-468d0a051ed14b487321ff3535f2adc9b47f62a1.tar.bz2
Revert 37407 - DevTools: speed up a function in cpu profiles processor.
By using a single regex instead of three called one by one, the function now works about 50% times faster. BUG=none TEST=none Review URL: http://codereview.chromium.org/554117 TBR=mnaganov@chromium.org, victorw@chromium.org Review URL: http://codereview.chromium.org/548183 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37413 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/devtools/js/profiler_processor.js25
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);
};