Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: src/js/regexp.js

Issue 1714903004: Return undefined from RegExp.prototype.compile (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-585775.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-585775.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698