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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // a UseCounter is incremented to track it. | 275 // a UseCounter is incremented to track it. |
276 // TODO(littledan): Remove this workaround or standardize it | 276 // TODO(littledan): Remove this workaround or standardize it |
277 if (this === GlobalRegExpPrototype) { | 277 if (this === GlobalRegExpPrototype) { |
278 %IncrementUseCounter(kRegExpPrototypeToString); | 278 %IncrementUseCounter(kRegExpPrototypeToString); |
279 return '/(?:)/'; | 279 return '/(?:)/'; |
280 } | 280 } |
281 if (!IS_RECEIVER(this)) { | 281 if (!IS_RECEIVER(this)) { |
282 throw MakeTypeError( | 282 throw MakeTypeError( |
283 kIncompatibleMethodReceiver, 'RegExp.prototype.toString', this); | 283 kIncompatibleMethodReceiver, 'RegExp.prototype.toString', this); |
284 } | 284 } |
285 return '/' + TO_STRING(this.pattern()) + '/' + TO_STRING(this.flags()); | 285 return '/' + TO_STRING(this.source) + '/' + TO_STRING(this.flags); |
286 } | 286 } |
287 var result = '/' + REGEXP_SOURCE(this) + '/'; | 287 var result = '/' + REGEXP_SOURCE(this) + '/'; |
288 if (REGEXP_GLOBAL(this)) result += 'g'; | 288 if (REGEXP_GLOBAL(this)) result += 'g'; |
289 if (REGEXP_IGNORE_CASE(this)) result += 'i'; | 289 if (REGEXP_IGNORE_CASE(this)) result += 'i'; |
290 if (REGEXP_MULTILINE(this)) result += 'm'; | 290 if (REGEXP_MULTILINE(this)) result += 'm'; |
291 if (REGEXP_UNICODE(this)) result += 'u'; | 291 if (REGEXP_UNICODE(this)) result += 'u'; |
292 if (REGEXP_STICKY(this)) result += 'y'; | 292 if (REGEXP_STICKY(this)) result += 'y'; |
293 return result; | 293 return result; |
294 } | 294 } |
295 | 295 |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 // Exports | 753 // Exports |
754 | 754 |
755 utils.Export(function(to) { | 755 utils.Export(function(to) { |
756 to.RegExpExec = DoRegExpExec; | 756 to.RegExpExec = DoRegExpExec; |
757 to.RegExpExecNoTests = RegExpExecNoTests; | 757 to.RegExpExecNoTests = RegExpExecNoTests; |
758 to.RegExpLastMatchInfo = RegExpLastMatchInfo; | 758 to.RegExpLastMatchInfo = RegExpLastMatchInfo; |
759 to.RegExpTest = RegExpTest; | 759 to.RegExpTest = RegExpTest; |
760 }); | 760 }); |
761 | 761 |
762 }) | 762 }) |
OLD | NEW |