diff options
Diffstat (limited to 'tools/eslint/node_modules/lodash/internal/setData.js')
-rw-r--r-- | tools/eslint/node_modules/lodash/internal/setData.js | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/tools/eslint/node_modules/lodash/internal/setData.js b/tools/eslint/node_modules/lodash/internal/setData.js deleted file mode 100644 index 7eb3f40b83..0000000000 --- a/tools/eslint/node_modules/lodash/internal/setData.js +++ /dev/null @@ -1,41 +0,0 @@ -var baseSetData = require('./baseSetData'), - now = require('../date/now'); - -/** Used to detect when a function becomes hot. */ -var HOT_COUNT = 150, - HOT_SPAN = 16; - -/** - * Sets metadata for `func`. - * - * **Note:** If this function becomes hot, i.e. is invoked a lot in a short - * period of time, it will trip its breaker and transition to an identity function - * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070) - * for more details. - * - * @private - * @param {Function} func The function to associate metadata with. - * @param {*} data The metadata. - * @returns {Function} Returns `func`. - */ -var setData = (function() { - var count = 0, - lastCalled = 0; - - return function(key, value) { - var stamp = now(), - remaining = HOT_SPAN - (stamp - lastCalled); - - lastCalled = stamp; - if (remaining > 0) { - if (++count >= HOT_COUNT) { - return key; - } - } else { - count = 0; - } - return baseSetData(key, value); - }; -}()); - -module.exports = setData; |