Changeset 238267 in webkit
- Timestamp:
- Nov 15, 2018 9:12:25 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r238162 r238267 1 2018-11-15 Mark Lam <mark.lam@apple.com> 2 3 RegExp operations should not take fast patch if lastIndex is not numeric. 4 https://bugs.webkit.org/show_bug.cgi?id=191731 5 <rdar://problem/46017305> 6 7 Reviewed by Saam Barati. 8 9 * stress/regress-191731.js: Added. 10 1 11 2018-11-13 Saam Barati <sbarati@apple.com> 2 12 -
trunk/Source/JavaScriptCore/ChangeLog
r238231 r238267 1 2018-11-15 Mark Lam <mark.lam@apple.com> 2 3 RegExp operations should not take fast patch if lastIndex is not numeric. 4 https://bugs.webkit.org/show_bug.cgi?id=191731 5 <rdar://problem/46017305> 6 7 Reviewed by Saam Barati. 8 9 This is because if lastIndex is an object with a valueOf() method, it can execute 10 arbitrary code which may have side effects, and side effects are not permitted by 11 the RegExp fast paths. 12 13 * builtins/RegExpPrototype.js: 14 (globalPrivate.hasObservableSideEffectsForRegExpMatch): 15 (overriddenName.string_appeared_here.search): 16 (globalPrivate.hasObservableSideEffectsForRegExpSplit): 17 (intrinsic.RegExpTestIntrinsic.test): 18 * builtins/StringPrototype.js: 19 (globalPrivate.hasObservableSideEffectsForStringReplace): 20 1 21 2018-11-15 Keith Rollin <krollin@apple.com> 2 22 -
trunk/Source/JavaScriptCore/builtins/RegExpPrototype.js
r233377 r238267 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 68 68 "use strict"; 69 69 70 if (!@isRegExpObject(regexp)) 71 return true; 72 70 73 // This is accessed by the RegExpExec internal function. 71 74 let regexpExec = @tryGetById(regexp, "exec"); … … 80 83 return true; 81 84 82 return !@isRegExpObject(regexp);85 return typeof regexp.lastIndex !== "number"; 83 86 } 84 87 … … 316 319 317 320 // Check for observable side effects and call the fast path if there aren't any. 318 if (@isRegExpObject(regexp) && @tryGetById(regexp, "exec") === @regExpBuiltinExec) 321 if (@isRegExpObject(regexp) 322 && @tryGetById(regexp, "exec") === @regExpBuiltinExec 323 && typeof regexp.lastIndex === "number") 319 324 return @regExpSearchFast.@call(regexp, strArg); 320 325 … … 359 364 "use strict"; 360 365 366 if (!@isRegExpObject(regexp)) 367 return true; 368 361 369 // This is accessed by the RegExpExec internal function. 362 370 let regexpExec = @tryGetById(regexp, "exec"); … … 390 398 if (regexpSource !== @regExpProtoSourceGetter) 391 399 return true; 392 393 return !@isRegExpObject(regexp);400 401 return typeof regexp.lastIndex !== "number"; 394 402 } 395 403 … … 537 545 538 546 // Check for observable side effects and call the fast path if there aren't any. 539 if (@isRegExpObject(regexp) && @tryGetById(regexp, "exec") === @regExpBuiltinExec) 547 if (@isRegExpObject(regexp) 548 && @tryGetById(regexp, "exec") === @regExpBuiltinExec 549 && typeof regexp.lastIndex === "number") 540 550 return @regExpTestFast.@call(regexp, strArg); 541 551 -
trunk/Source/JavaScriptCore/builtins/StringPrototype.js
r233377 r238267 2 2 * Copyright (C) 2015 Andy VanWagoner <andy@vanwagoner.family>. 3 3 * Copyright (C) 2016 Yusuke Suzuki <utatane.tea@gmail.com> 4 * Copyright (C) 2016 Apple Inc. All rights reserved.4 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 5 5 * 6 6 * Redistribution and use in source and binary forms, with or without … … 196 196 "use strict"; 197 197 198 if (!@isRegExpObject(regexp)) 199 return true; 200 198 201 if (replacer !== @regExpPrototypeSymbolReplace) 199 202 return true; … … 211 214 return true; 212 215 213 return !@isRegExpObject(regexp);216 return typeof regexp.lastIndex !== "number"; 214 217 } 215 218
Note: See TracChangeset
for help on using the changeset viewer.