Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/filterText.js

Issue 29909576: [experiment] Issue 7045 - Optimize V8 memory layout of filter text Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Remove check in lib/filterClasses.js Created Oct. 15, 2018, 9:25 p.m.
Right Patch Set: Make domains parameter nullable and optional Created Oct. 15, 2018, 9:28 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/filterClasses.js ('k') | test/filterText.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 */ 57 */
58 function trueSlice(string) 58 function trueSlice(string)
59 { 59 {
60 return JSON.parse(JSON.stringify(string)); 60 return JSON.parse(JSON.stringify(string));
61 } 61 }
62 62
63 /** 63 /**
64 * Optimizes content filter text. 64 * Optimizes content filter text.
65 * 65 *
66 * @param {string} text The filter text. 66 * @param {string} text The filter text.
67 * @param {string} domains The domains part of the filter text. 67 * @param {?string} [domains] The domains part of the filter text.
68 * @param {?string} [type] The type part of the filter text, either 68 * @param {?string} [type] The type part of the filter text, either
69 * <code>null</code> or <code>undefined</code>, or one of <code>@</code>, 69 * <code>null</code> or <code>undefined</code>, or one of <code>@</code>,
70 * <code>?</code>, and <code>$</code>. 70 * <code>?</code>, and <code>$</code>.
71 * @param {string} body The body part of the filter text. 71 * @param {string} body The body part of the filter text.
72 * 72 *
73 * @returns {Array.<string>} An array containing the optimized filter text and 73 * @returns {Array.<string>} An array containing the optimized filter text and
74 * its optimized parts. 74 * its optimized parts.
75 */ 75 */
76 function optimizeContentFilterText(text, domains, type, body) 76 function optimizeContentFilterText(text, domains, type, body)
77 { 77 {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 else 149 else
150 { 150 {
151 strings.set(domains, domains); 151 strings.set(domains, domains);
152 } 152 }
153 } 153 }
154 154
155 return [text, pattern, domains, sitekeys, csp, rewrite]; 155 return [text, pattern, domains, sitekeys, csp, rewrite];
156 } 156 }
157 157
158 exports.optimizeRegExpFilterText = optimizeRegExpFilterText; 158 exports.optimizeRegExpFilterText = optimizeRegExpFilterText;
LEFTRIGHT

Powered by Google App Engine
This is Rietveld