| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
| 8 | 8 |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 // Imports | 10 // Imports |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 "RegExp.prototype.compile", this); | 105 "RegExp.prototype.compile", this); |
| 106 } | 106 } |
| 107 | 107 |
| 108 if (IS_REGEXP(pattern)) { | 108 if (IS_REGEXP(pattern)) { |
| 109 if (!IS_UNDEFINED(flags)) throw MakeTypeError(kRegExpFlags); | 109 if (!IS_UNDEFINED(flags)) throw MakeTypeError(kRegExpFlags); |
| 110 | 110 |
| 111 flags = PatternFlags(pattern); | 111 flags = PatternFlags(pattern); |
| 112 pattern = REGEXP_SOURCE(pattern); | 112 pattern = REGEXP_SOURCE(pattern); |
| 113 } | 113 } |
| 114 | 114 |
| 115 return RegExpInitialize(this, pattern, flags); | 115 RegExpInitialize(this, pattern, flags); |
| 116 |
| 117 // Return undefined for compatibility with JSC. |
| 118 // See http://crbug.com/585775 for web compat details. |
| 116 } | 119 } |
| 117 | 120 |
| 118 | 121 |
| 119 function DoRegExpExec(regexp, string, index) { | 122 function DoRegExpExec(regexp, string, index) { |
| 120 return %_RegExpExec(regexp, string, index, RegExpLastMatchInfo); | 123 return %_RegExpExec(regexp, string, index, RegExpLastMatchInfo); |
| 121 } | 124 } |
| 122 | 125 |
| 123 | 126 |
| 124 // This is kind of performance sensitive, so we want to avoid unnecessary | 127 // This is kind of performance sensitive, so we want to avoid unnecessary |
| 125 // type checks on inputs. But we also don't want to inline it several times | 128 // type checks on inputs. But we also don't want to inline it several times |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 // Exports | 756 // Exports |
| 754 | 757 |
| 755 utils.Export(function(to) { | 758 utils.Export(function(to) { |
| 756 to.RegExpExec = DoRegExpExec; | 759 to.RegExpExec = DoRegExpExec; |
| 757 to.RegExpExecNoTests = RegExpExecNoTests; | 760 to.RegExpExecNoTests = RegExpExecNoTests; |
| 758 to.RegExpLastMatchInfo = RegExpLastMatchInfo; | 761 to.RegExpLastMatchInfo = RegExpLastMatchInfo; |
| 759 to.RegExpTest = RegExpTest; | 762 to.RegExpTest = RegExpTest; |
| 760 }); | 763 }); |
| 761 | 764 |
| 762 }) | 765 }) |
| OLD | NEW |