OLD | NEW |
1 # Copyright 2006-2008 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 |
11 # with the distribution. | 11 # with the distribution. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); | 92 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); |
93 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInteger(arg)); | 93 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInteger(arg)); |
94 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInt32(arg)); | 94 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInt32(arg)); |
95 | 95 |
96 # Macros implemented in Python. | 96 # Macros implemented in Python. |
97 python macro CHAR_CODE(str) = ord(str[1]); | 97 python macro CHAR_CODE(str) = ord(str[1]); |
98 | 98 |
99 # Accessors for original global properties that ensure they have been loaded. | 99 # Accessors for original global properties that ensure they have been loaded. |
100 const ORIGINAL_REGEXP = (global.RegExp, $RegExp); | 100 const ORIGINAL_REGEXP = (global.RegExp, $RegExp); |
101 const ORIGINAL_DATE = (global.Date, $Date); | 101 const ORIGINAL_DATE = (global.Date, $Date); |
| 102 |
| 103 # Constants used on an array to implement the properties of the RegExp object. |
| 104 const REGEXP_NUMBER_OF_CAPTURES = 0; |
| 105 const REGEXP_FIRST_CAPTURE = 1; |
| 106 |
| 107 # We can't put macros in macros so we use constants here. |
| 108 # REGEXP_NUMBER_OF_CAPTURES |
| 109 macro NUMBER_OF_CAPTURES(array) = ((array)[0]); |
| 110 |
| 111 # Last input and last subject are after the captures so we can omit them on |
| 112 # results returned from global searches. Beware - these evaluate their |
| 113 # arguments twice. |
| 114 macro LAST_SUBJECT(array) = ((array)[(array)[0] + 1]); |
| 115 macro LAST_INPUT(array) = ((array)[(array)[0] + 2]); |
| 116 |
| 117 # REGEXP_FIRST_CAPTURE |
| 118 macro CAPTURE(index) = (1 + (index)); |
| 119 const CAPTURE0 = 1; |
| 120 const CAPTURE1 = 2; |
OLD | NEW |