| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 290 } |
| 291 | 291 |
| 292 var lastIndex = this.lastIndex; | 292 var lastIndex = this.lastIndex; |
| 293 | 293 |
| 294 var cache = regExpCache; | 294 var cache = regExpCache; |
| 295 if (%_ObjectEquals(cache.type, 'test') && | 295 if (%_ObjectEquals(cache.type, 'test') && |
| 296 %_IsRegExpEquivalent(cache.regExp, this) && | 296 %_IsRegExpEquivalent(cache.regExp, this) && |
| 297 %_ObjectEquals(cache.subject, string) && | 297 %_ObjectEquals(cache.subject, string) && |
| 298 %_ObjectEquals(0, lastIndex)) { | 298 %_ObjectEquals(0, lastIndex)) { |
| 299 // The regexp.lastIndex value must be 0 for non-global RegExps, and for | 299 // The regexp.lastIndex value must be 0 for non-global RegExps, and for |
| 300 // global RegExps we only cache negative results, which gives a resulting | 300 // global RegExps we only cache negative results, which gives a resulting |
| 301 // lastIndex of zero as well. | 301 // lastIndex of zero as well. |
| 302 if (global) this.lastIndex = 0; | 302 if (global) this.lastIndex = 0; |
| 303 return cache.answer; | 303 return cache.answer; |
| 304 } | 304 } |
| 305 | 305 |
| 306 var s; | 306 var s; |
| 307 if (IS_STRING(string)) { | 307 if (IS_STRING(string)) { |
| 308 s = string; | 308 s = string; |
| 309 } else { | 309 } else { |
| 310 s = ToString(string); | 310 s = ToString(string); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); | 561 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
| 562 | 562 |
| 563 for (var i = 1; i < 10; ++i) { | 563 for (var i = 1; i < 10; ++i) { |
| 564 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); | 564 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); |
| 565 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); | 565 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 | 568 |
| 569 | 569 |
| 570 SetupRegExp(); | 570 SetupRegExp(); |
| OLD | NEW |