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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 %CheckIsBootstrapping(); |
410 %FunctionSetInstanceClassName($RegExp, 'RegExp'); | 410 %FunctionSetInstanceClassName($RegExp, 'RegExp'); |
411 %FunctionSetPrototype($RegExp, new $RegExp()); | |
412 %SetProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM); | 411 %SetProperty($RegExp.prototype, 'constructor', $RegExp, DONT_ENUM); |
413 %SetCode($RegExp, RegExpConstructor); | 412 %SetCode($RegExp, RegExpConstructor); |
| 413 %FunctionSetPrototype($RegExp, new $RegExp()); |
414 | 414 |
415 InstallFunctions($RegExp.prototype, DONT_ENUM, $Array( | 415 InstallFunctions($RegExp.prototype, DONT_ENUM, $Array( |
416 "exec", RegExpExec, | 416 "exec", RegExpExec, |
417 "test", RegExpTest, | 417 "test", RegExpTest, |
418 "toString", RegExpToString, | 418 "toString", RegExpToString, |
419 "compile", CompileRegExp | 419 "compile", CompileRegExp |
420 )); | 420 )); |
421 | 421 |
422 // The length of compile is 1 in SpiderMonkey. | 422 // The length of compile is 1 in SpiderMonkey. |
423 %FunctionSetLength($RegExp.prototype.compile, 1); | 423 %FunctionSetLength($RegExp.prototype.compile, 1); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 %DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext, DONT_ENUM | DONT
_DELETE); | 479 %DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext, DONT_ENUM | DONT
_DELETE); |
480 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); | 480 %DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE); |
481 | 481 |
482 for (var i = 1; i < 10; ++i) { | 482 for (var i = 1; i < 10; ++i) { |
483 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); | 483 %DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_D
ELETE); |
484 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); | 484 %DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE); |
485 } | 485 } |
486 } | 486 } |
487 | 487 |
488 SetUpRegExp(); | 488 SetUpRegExp(); |
OLD | NEW |