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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 ); | 398 ); |
399 | 399 |
400 // Override last match info with an array of actual substrings. | 400 // Override last match info with an array of actual substrings. |
401 // Used internally by replace regexp with function. | 401 // Used internally by replace regexp with function. |
402 // The array has the format of an "apply" argument for a replacement | 402 // The array has the format of an "apply" argument for a replacement |
403 // function. | 403 // function. |
404 var lastMatchInfoOverride = null; | 404 var lastMatchInfoOverride = null; |
405 | 405 |
406 // ------------------------------------------------------------------- | 406 // ------------------------------------------------------------------- |
407 | 407 |
408 function SetupRegExp() { | 408 function SetUpRegExp() { |
| 409 %CheckIsBootstrapping(); |
409 %FunctionSetInstanceClassName($RegExp, 'RegExp'); | 410 %FunctionSetInstanceClassName($RegExp, 'RegExp'); |
410 %FunctionSetPrototype($RegExp, new $Object()); | 411 %FunctionSetPrototype($RegExp, new $Object()); |
411 %SetProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM); | 412 %SetProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM); |
412 %SetCode($RegExp, RegExpConstructor); | 413 %SetCode($RegExp, RegExpConstructor); |
413 | 414 |
414 InstallFunctions($RegExp.prototype, DONT_ENUM, $Array( | 415 InstallFunctions($RegExp.prototype, DONT_ENUM, $Array( |
415 "exec", RegExpExec, | 416 "exec", RegExpExec, |
416 "test", RegExpTest, | 417 "test", RegExpTest, |
417 "toString", RegExpToString, | 418 "toString", RegExpToString, |
418 "compile", CompileRegExp | 419 "compile", CompileRegExp |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 %DefineAccessor($RegExp, 'rightContext', SETTER, NoOpSetter, DONT_DELETE); | 478 %DefineAccessor($RegExp, 'rightContext', SETTER, NoOpSetter, DONT_DELETE); |
478 %DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext, DONT_ENUM | DONT
_DELETE); | 479 %DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext, DONT_ENUM | DONT
_DELETE); |
479 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); | 480 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
480 | 481 |
481 for (var i = 1; i < 10; ++i) { | 482 for (var i = 1; i < 10; ++i) { |
482 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); | 483 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); |
483 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); | 484 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); |
484 } | 485 } |
485 } | 486 } |
486 | 487 |
487 | 488 SetUpRegExp(); |
488 SetupRegExp(); | |
OLD | NEW |