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 // This file relies on the fact that the following declaration has been made | 5 // This file relies on the fact that the following declaration has been made |
6 // in runtime.js: | 6 // in runtime.js: |
7 // var $Object = global.Object; | 7 // var $Object = global.Object; |
8 // var $Array = global.Array; | 8 // var $Array = global.Array; |
9 | 9 |
10 var $RegExp = global.RegExp; | 10 var $RegExp = global.RegExp; |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 }; | 403 }; |
404 var RegExpSetInput = function(string) { | 404 var RegExpSetInput = function(string) { |
405 LAST_INPUT(lastMatchInfo) = ToString(string); | 405 LAST_INPUT(lastMatchInfo) = ToString(string); |
406 }; | 406 }; |
407 | 407 |
408 %OptimizeObjectForAddingMultipleProperties($RegExp, 22); | 408 %OptimizeObjectForAddingMultipleProperties($RegExp, 22); |
409 %DefineAccessorPropertyUnchecked($RegExp, 'input', RegExpGetInput, | 409 %DefineAccessorPropertyUnchecked($RegExp, 'input', RegExpGetInput, |
410 RegExpSetInput, DONT_DELETE); | 410 RegExpSetInput, DONT_DELETE); |
411 %DefineAccessorPropertyUnchecked($RegExp, '$_', RegExpGetInput, | 411 %DefineAccessorPropertyUnchecked($RegExp, '$_', RegExpGetInput, |
412 RegExpSetInput, DONT_ENUM | DONT_DELETE); | 412 RegExpSetInput, DONT_ENUM | DONT_DELETE); |
413 %DefineAccessorPropertyUnchecked($RegExp, '$input', RegExpGetInput, | |
414 RegExpSetInput, DONT_ENUM | DONT_DELETE); | |
415 | 413 |
416 // The properties multiline and $* are aliases for each other. When this | 414 // The properties multiline and $* are aliases for each other. When this |
417 // value is set in SpiderMonkey, the value it is set to is coerced to a | 415 // value is set in SpiderMonkey, the value it is set to is coerced to a |
418 // boolean. We mimic that behavior with a slight difference: in SpiderMonkey | 416 // boolean. We mimic that behavior with a slight difference: in SpiderMonkey |
419 // the value of the expression 'RegExp.multiline = null' (for instance) is the | 417 // the value of the expression 'RegExp.multiline = null' (for instance) is the |
420 // boolean false (i.e., the value after coercion), while in V8 it is the value | 418 // boolean false (i.e., the value after coercion), while in V8 it is the value |
421 // null (i.e., the value before coercion). | 419 // null (i.e., the value before coercion). |
422 | 420 |
423 // Getter and setter for multiline. | 421 // Getter and setter for multiline. |
424 var multiline = false; | 422 var multiline = false; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 | 455 |
458 for (var i = 1; i < 10; ++i) { | 456 for (var i = 1; i < 10; ++i) { |
459 %DefineAccessorPropertyUnchecked($RegExp, '$' + i, | 457 %DefineAccessorPropertyUnchecked($RegExp, '$' + i, |
460 RegExpMakeCaptureGetter(i), NoOpSetter, | 458 RegExpMakeCaptureGetter(i), NoOpSetter, |
461 DONT_DELETE); | 459 DONT_DELETE); |
462 } | 460 } |
463 %ToFastProperties($RegExp); | 461 %ToFastProperties($RegExp); |
464 } | 462 } |
465 | 463 |
466 SetUpRegExp(); | 464 SetUpRegExp(); |
OLD | NEW |