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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 # To avoid ES2015 Function name inference. | 110 # To avoid ES2015 Function name inference. |
111 macro ANONYMOUS_FUNCTION(fn) = (0, (fn)); | 111 macro ANONYMOUS_FUNCTION(fn) = (0, (fn)); |
112 | 112 |
113 # Constants. The compiler constant folds them. | 113 # Constants. The compiler constant folds them. |
114 define INFINITY = (1/0); | 114 define INFINITY = (1/0); |
115 define UNDEFINED = (void 0); | 115 define UNDEFINED = (void 0); |
116 | 116 |
117 # Macros implemented in Python. | 117 # Macros implemented in Python. |
118 python macro CHAR_CODE(str) = ord(str[1]); | 118 python macro CHAR_CODE(str) = ord(str[1]); |
119 | 119 |
120 # Constants used on an array to implement the properties of the RegExp object. | 120 # Layout of internal RegExpLastMatchInfo object. |
121 define REGEXP_NUMBER_OF_CAPTURES = 0; | 121 define REGEXP_NUMBER_OF_CAPTURES = 0; |
| 122 define REGEXP_LAST_SUBJECT = 1; |
| 123 define REGEXP_LAST_INPUT = 2; |
122 define REGEXP_FIRST_CAPTURE = 3; | 124 define REGEXP_FIRST_CAPTURE = 3; |
| 125 define CAPTURE0 = 3; # Aliases REGEXP_FIRST_CAPTURE. |
| 126 define CAPTURE1 = 4; |
| 127 |
| 128 macro NUMBER_OF_CAPTURES(array) = ((array)[REGEXP_NUMBER_OF_CAPTURES]); |
| 129 macro LAST_SUBJECT(array) = ((array)[REGEXP_LAST_SUBJECT]); |
| 130 macro LAST_INPUT(array) = ((array)[REGEXP_LAST_INPUT]); |
| 131 macro CAPTURE(index) = (REGEXP_FIRST_CAPTURE + (index)); |
123 | 132 |
124 # Macros for internal slot access. | 133 # Macros for internal slot access. |
125 macro REGEXP_GLOBAL(regexp) = (%_RegExpFlags(regexp) & 1); | 134 macro REGEXP_GLOBAL(regexp) = (%_RegExpFlags(regexp) & 1); |
126 macro REGEXP_IGNORE_CASE(regexp) = (%_RegExpFlags(regexp) & 2); | 135 macro REGEXP_IGNORE_CASE(regexp) = (%_RegExpFlags(regexp) & 2); |
127 macro REGEXP_MULTILINE(regexp) = (%_RegExpFlags(regexp) & 4); | 136 macro REGEXP_MULTILINE(regexp) = (%_RegExpFlags(regexp) & 4); |
128 macro REGEXP_STICKY(regexp) = (%_RegExpFlags(regexp) & 8); | 137 macro REGEXP_STICKY(regexp) = (%_RegExpFlags(regexp) & 8); |
129 macro REGEXP_UNICODE(regexp) = (%_RegExpFlags(regexp) & 16); | 138 macro REGEXP_UNICODE(regexp) = (%_RegExpFlags(regexp) & 16); |
130 macro REGEXP_SOURCE(regexp) = (%_RegExpSource(regexp)); | 139 macro REGEXP_SOURCE(regexp) = (%_RegExpSource(regexp)); |
131 | 140 |
132 # We can't put macros in macros so we use constants here. | |
133 # REGEXP_NUMBER_OF_CAPTURES | |
134 macro NUMBER_OF_CAPTURES(array) = ((array)[0]); | |
135 | |
136 # Last input and last subject of regexp matches. | |
137 define LAST_SUBJECT_INDEX = 1; | |
138 macro LAST_SUBJECT(array) = ((array)[1]); | |
139 macro LAST_INPUT(array) = ((array)[2]); | |
140 | |
141 # REGEXP_FIRST_CAPTURE | |
142 macro CAPTURE(index) = (3 + (index)); | |
143 define CAPTURE0 = 3; | |
144 define CAPTURE1 = 4; | |
145 | |
146 # For the regexp capture override array. This has the same | 141 # For the regexp capture override array. This has the same |
147 # format as the arguments to a function called from | 142 # format as the arguments to a function called from |
148 # String.prototype.replace. | 143 # String.prototype.replace. |
149 macro OVERRIDE_MATCH(override) = ((override)[0]); | 144 macro OVERRIDE_MATCH(override) = ((override)[0]); |
150 macro OVERRIDE_POS(override) = ((override)[(override).length - 2]); | 145 macro OVERRIDE_POS(override) = ((override)[(override).length - 2]); |
151 macro OVERRIDE_SUBJECT(override) = ((override)[(override).length - 1]); | 146 macro OVERRIDE_SUBJECT(override) = ((override)[(override).length - 1]); |
152 # 1-based so index of 1 returns the first capture | 147 # 1-based so index of 1 returns the first capture |
153 macro OVERRIDE_CAPTURE(override, index) = ((override)[(index)]); | 148 macro OVERRIDE_CAPTURE(override, index) = ((override)[(index)]); |
154 | 149 |
155 # For messages.js | 150 # For messages.js |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 define kSloppyModeBlockScopedFunctionRedefinition = 22; | 223 define kSloppyModeBlockScopedFunctionRedefinition = 22; |
229 define kForInInitializer = 23; | 224 define kForInInitializer = 23; |
230 define kArrayProtectorDirtied = 24; | 225 define kArrayProtectorDirtied = 24; |
231 define kArraySpeciesModified = 25; | 226 define kArraySpeciesModified = 25; |
232 define kArrayPrototypeConstructorModified = 26; | 227 define kArrayPrototypeConstructorModified = 26; |
233 define kArrayInstanceProtoModified = 27; | 228 define kArrayInstanceProtoModified = 27; |
234 define kArrayInstanceConstructorModified = 28; | 229 define kArrayInstanceConstructorModified = 28; |
235 define kLegacyFunctionDeclaration = 29; | 230 define kLegacyFunctionDeclaration = 29; |
236 define kRegExpPrototypeSourceGetter = 30; | 231 define kRegExpPrototypeSourceGetter = 30; |
237 define kRegExpPrototypeOldFlagGetter = 31; | 232 define kRegExpPrototypeOldFlagGetter = 31; |
OLD | NEW |