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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 regexp_val = | 264 regexp_val = |
265 new GlobalRegExp( | 265 new GlobalRegExp( |
266 %_SubString(REGEXP_SOURCE(regexp), 2, REGEXP_SOURCE(regexp).length), | 266 %_SubString(REGEXP_SOURCE(regexp), 2, REGEXP_SOURCE(regexp).length), |
267 (REGEXP_IGNORE_CASE(regexp) ? REGEXP_MULTILINE(regexp) ? "im" : "i" | 267 (REGEXP_IGNORE_CASE(regexp) ? REGEXP_MULTILINE(regexp) ? "im" : "i" |
268 : REGEXP_MULTILINE(regexp) ? "m" : "")); | 268 : REGEXP_MULTILINE(regexp) ? "m" : "")); |
269 } | 269 } |
270 return regexp_val; | 270 return regexp_val; |
271 } | 271 } |
272 | 272 |
273 | 273 |
274 var kRegExpPrototypeToString = 12; | |
275 | |
276 function RegExpToString() { | 274 function RegExpToString() { |
277 if (!IS_REGEXP(this)) { | 275 if (!IS_REGEXP(this)) { |
278 // RegExp.prototype.toString() returns '/(?:)/' as a compatibility fix; | 276 // RegExp.prototype.toString() returns '/(?:)/' as a compatibility fix; |
279 // a UseCounter is incremented to track it. | 277 // a UseCounter is incremented to track it. |
280 // TODO(littledan): Remove this workaround or standardize it | 278 // TODO(littledan): Remove this workaround or standardize it |
281 if (this === GlobalRegExpPrototype) { | 279 if (this === GlobalRegExpPrototype) { |
282 %IncrementUseCounter(kRegExpPrototypeToString); | 280 %IncrementUseCounter(kRegExpPrototypeToString); |
283 return '/(?:)/'; | 281 return '/(?:)/'; |
284 } | 282 } |
285 throw MakeTypeError(kIncompatibleMethodReceiver, | 283 throw MakeTypeError(kIncompatibleMethodReceiver, |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 // Exports | 572 // Exports |
575 | 573 |
576 utils.Export(function(to) { | 574 utils.Export(function(to) { |
577 to.RegExpExec = DoRegExpExec; | 575 to.RegExpExec = DoRegExpExec; |
578 to.RegExpExecNoTests = RegExpExecNoTests; | 576 to.RegExpExecNoTests = RegExpExecNoTests; |
579 to.RegExpLastMatchInfo = RegExpLastMatchInfo; | 577 to.RegExpLastMatchInfo = RegExpLastMatchInfo; |
580 to.RegExpTest = RegExpTest; | 578 to.RegExpTest = RegExpTest; |
581 }); | 579 }); |
582 | 580 |
583 }) | 581 }) |
OLD | NEW |