diff options
author | Xuejie Xiao <xxuejie@gmail.com> | 2012-12-10 20:41:58 -0500 |
---|---|---|
committer | Xuejie Xiao <xxuejie@gmail.com> | 2012-12-10 20:47:47 -0500 |
commit | 3732b13dce850dd6dc43ab390a7caf363d9d8edd (patch) | |
tree | cf55fefff939b60b05dffe37b34d51de4d22c26a | |
parent | 1522befda65f6bc6c9cf5234ae7e078437cb5e65 (diff) |
Remove regexp case since it is slow and rarely used
-rw-r--r-- | src/jsifier.js | 26 | ||||
-rw-r--r-- | src/settings.js | 7 |
2 files changed, 11 insertions, 22 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index ea278342..aaa827bb 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -486,25 +486,17 @@ function JSify(data, functionsOnly, givenFunctions) { } }); - function functionNameFilterTest(ident) { - if (LABEL_FUNCTION_FILTERS.length == 0) { - // empty array means filter is disabled + // function for filtering functions for label debugging + if (LABEL_FUNCTION_FILTERS.length > 0) { + var LABEL_FUNCTION_FILTER_SET = set(LABEL_FUNCTION_FILTERS); + var functionNameFilterTest = function(ident) { + return (ident in LABEL_FUNCTION_FILTER_SET); + }; + } else { + // no filters are specified, all function names are printed + var functionNameFilterTest = function(ident) { return true; } - - for (var i = 0; i < LABEL_FUNCTION_FILTERS.length; i++) { - var filter = LABEL_FUNCTION_FILTERS[i]; - var match = false; - - if (typeof filter == 'string') { - match = (filter == ident); - } else if (filter instanceof RegExp) { // typeof would return 'object' for RegExp - match = filter.test(ident); - } - - if (match) return true; - } - return false; } // function reconstructor & post-JS optimizer diff --git a/src/settings.js b/src/settings.js index f32a8792..77111ed5 100644 --- a/src/settings.js +++ b/src/settings.js @@ -135,11 +135,8 @@ var LABEL_DEBUG = 0; // 1: Print out functions as we enter them var LABEL_FUNCTION_FILTERS = []; // Filters for function label debug. // The items for this array will be used // as filters for function names. Only the - // labels of functions that match one particular - // filter are printed out. - // The filters can be specified in both string - // type (use equality test) and regular expression - // (use match test). + // labels of functions that is equaled to + // one of the filters are printed out // When the array is empty, the filter is disabled. var EXCEPTION_DEBUG = 1; // Print out exceptions in emscriptened code |