@@ -14,14 +14,10 @@ function String_match(regexp) {
1414 }
1515
1616 // Step 2.
17- var isPatternString = typeof regexp === "string" ;
18- if (
19- ! ( isPatternString && CanOptimizeStringProtoSymbolLookup ( ) ) &&
20- ! IsNullOrUndefined ( regexp )
21- ) {
17+ if ( IsObject ( regexp ) ) {
2218 // Fast path for regular expressions with the original
2319 // RegExp.prototype[@@match ] function.
24- if ( IsObject ( regexp ) && IsOptimizableRegExpObject ( regexp ) ) {
20+ if ( IsOptimizableRegExpObject ( regexp ) ) {
2521 return callFunction ( RegExpMatch , regexp , this ) ;
2622 }
2723
@@ -30,17 +26,14 @@ function String_match(regexp) {
3026
3127 // Step 2.b.
3228 if ( matcher !== undefined ) {
33- if ( ! IsObject ( regexp ) ) {
34- RegExpSymbolProtocolOnPrimitiveCounter ( ) ;
35- }
3629 return callContentFunction ( matcher , regexp , this ) ;
3730 }
3831 }
3932
4033 // Step 3.
4134 var S = ToString ( this ) ;
4235
43- if ( isPatternString && IsRegExpPrototypeOptimizable ( ) ) {
36+ if ( typeof regexp === "string" && IsRegExpPrototypeOptimizable ( ) ) {
4437 var flatResult = FlatStringMatch ( S , regexp ) ;
4538 if ( flatResult !== undefined ) {
4639 return flatResult ;
@@ -69,7 +62,7 @@ function String_matchAll(regexp) {
6962 }
7063
7164 // Step 2.
72- if ( ! IsNullOrUndefined ( regexp ) ) {
65+ if ( IsObject ( regexp ) ) {
7366 // Steps 2.a-b.
7467 if ( IsRegExp ( regexp ) ) {
7568 // Step 2.b.i.
@@ -88,7 +81,7 @@ function String_matchAll(regexp) {
8881
8982 // Fast path for regular expressions with the original
9083 // RegExp.prototype[@@matchAll ] function.
91- if ( IsObject ( regexp ) && IsOptimizableRegExpObject ( regexp ) ) {
84+ if ( IsOptimizableRegExpObject ( regexp ) ) {
9285 return callFunction ( RegExpMatchAll , regexp , this ) ;
9386 }
9487
@@ -97,9 +90,6 @@ function String_matchAll(regexp) {
9790
9891 // Step 2.d.
9992 if ( matcher !== undefined ) {
100- if ( ! IsObject ( regexp ) ) {
101- RegExpSymbolProtocolOnPrimitiveCounter ( ) ;
102- }
10393 return callContentFunction ( matcher , regexp , this ) ;
10494 }
10595 }
@@ -212,13 +202,10 @@ function String_replace(searchValue, replaceValue) {
212202 }
213203
214204 // Step 2.
215- if (
216- ! ( typeof searchValue === "string" && CanOptimizeStringProtoSymbolLookup ( ) ) &&
217- ! IsNullOrUndefined ( searchValue )
218- ) {
205+ if ( IsObject ( searchValue ) ) {
219206 // Fast path for regular expressions with the original
220207 // RegExp.prototype[@@replace ] function.
221- if ( IsObject ( searchValue ) && IsOptimizableRegExpObject ( searchValue ) ) {
208+ if ( IsOptimizableRegExpObject ( searchValue ) ) {
222209 return callFunction ( RegExpReplace , searchValue , this , replaceValue ) ;
223210 }
224211
@@ -227,9 +214,6 @@ function String_replace(searchValue, replaceValue) {
227214
228215 // Step 2.b.
229216 if ( replacer !== undefined ) {
230- if ( ! IsObject ( searchValue ) ) {
231- RegExpSymbolProtocolOnPrimitiveCounter ( ) ;
232- }
233217 return callContentFunction ( replacer , searchValue , this , replaceValue ) ;
234218 }
235219 }
@@ -294,7 +278,7 @@ function String_replaceAll(searchValue, replaceValue) {
294278 }
295279
296280 // Step 2.
297- if ( ! IsNullOrUndefined ( searchValue ) ) {
281+ if ( IsObject ( searchValue ) ) {
298282 // Steps 2.a-b.
299283 if ( IsRegExp ( searchValue ) ) {
300284 // Step 2.b.i.
@@ -313,7 +297,7 @@ function String_replaceAll(searchValue, replaceValue) {
313297
314298 // Fast path for regular expressions with the original
315299 // RegExp.prototype[@@replace ] function.
316- if ( IsObject ( searchValue ) && IsOptimizableRegExpObject ( searchValue ) ) {
300+ if ( IsOptimizableRegExpObject ( searchValue ) ) {
317301 return callFunction ( RegExpReplace , searchValue , this , replaceValue ) ;
318302 }
319303
@@ -322,9 +306,6 @@ function String_replaceAll(searchValue, replaceValue) {
322306
323307 // Step 2.b.
324308 if ( replacer !== undefined ) {
325- if ( ! IsObject ( searchValue ) ) {
326- RegExpSymbolProtocolOnPrimitiveCounter ( ) ;
327- }
328309 return callContentFunction ( replacer , searchValue , this , replaceValue ) ;
329310 }
330311 }
@@ -425,13 +406,10 @@ function String_search(regexp) {
425406
426407 // Step 2.
427408 var isPatternString = typeof regexp === "string" ;
428- if (
429- ! ( isPatternString && CanOptimizeStringProtoSymbolLookup ( ) ) &&
430- ! IsNullOrUndefined ( regexp )
431- ) {
409+ if ( IsObject ( regexp ) ) {
432410 // Fast path for regular expressions with the original
433411 // RegExp.prototype[@@search ] function.
434- if ( IsObject ( regexp ) && IsOptimizableRegExpObject ( regexp ) ) {
412+ if ( IsOptimizableRegExpObject ( regexp ) ) {
435413 return callFunction ( RegExpSearch , regexp , this ) ;
436414 }
437415
@@ -440,9 +418,6 @@ function String_search(regexp) {
440418
441419 // Step 2.b.
442420 if ( searcher !== undefined ) {
443- if ( ! IsObject ( regexp ) ) {
444- RegExpSymbolProtocolOnPrimitiveCounter ( ) ;
445- }
446421 return callContentFunction ( searcher , regexp , this ) ;
447422 }
448423 }
@@ -479,25 +454,20 @@ function String_split(separator, limit) {
479454 // are constants. Following sequence of if's cannot be put together in
480455 // order that IonMonkey sees the constant if present (bug 1246141).
481456 if ( typeof this === "string" ) {
482- if ( CanOptimizeStringProtoSymbolLookup ( ) ) {
483- if ( typeof separator === "string" ) {
484- if ( limit === undefined ) {
485- // inlineConstantStringSplitString needs both arguments to
486- // be MConstant, so pass them directly.
487- return StringSplitString ( this , separator ) ;
488- }
457+ if ( typeof separator === "string" ) {
458+ if ( limit === undefined ) {
459+ // inlineConstantStringSplitString needs both arguments to
460+ // be MConstant, so pass them directly.
461+ return StringSplitString ( this , separator ) ;
489462 }
490463 }
491464 }
492465
493466 // Step 2.
494- if (
495- ! ( typeof separator === "string" && CanOptimizeStringProtoSymbolLookup ( ) ) &&
496- ! IsNullOrUndefined ( separator )
497- ) {
467+ if ( IsObject ( separator ) ) {
498468 // Fast path for regular expressions with the original
499469 // RegExp.prototype[@@split ] function.
500- if ( IsObject ( separator ) && IsOptimizableRegExpObject ( separator ) ) {
470+ if ( IsOptimizableRegExpObject ( separator ) ) {
501471 return callFunction ( RegExpSplit , separator , this , limit ) ;
502472 }
503473
@@ -506,9 +476,6 @@ function String_split(separator, limit) {
506476
507477 // Step 2.b.
508478 if ( splitter !== undefined ) {
509- if ( ! IsObject ( separator ) ) {
510- RegExpSymbolProtocolOnPrimitiveCounter ( ) ;
511- }
512479 return callContentFunction ( splitter , separator , this , limit ) ;
513480 }
514481 }
0 commit comments