Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: src/js/macros.py

Issue 2415103002: [regexp] Turn last match info into a simple FixedArray (Closed)
Patch Set: Don't check instance type before map check Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/js/regexp.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 define READ_ONLY = 1; 32 define READ_ONLY = 1;
33 define DONT_ENUM = 2; 33 define DONT_ENUM = 2;
34 define DONT_DELETE = 4; 34 define DONT_DELETE = 4;
35 35
36 # 2^53 - 1 36 # 2^53 - 1
37 define kMaxSafeInteger = 9007199254740991; 37 define kMaxSafeInteger = 9007199254740991;
38 38
39 # 2^32 - 1 39 # 2^32 - 1
40 define kMaxUint32 = 4294967295; 40 define kMaxUint32 = 4294967295;
41 41
42 # Native cache ids.
43 define STRING_TO_REGEXP_CACHE_ID = 0;
44
45 # Type query macros. 42 # Type query macros.
46 # 43 #
47 # Note: We have special support for typeof(foo) === 'bar' in the compiler. 44 # Note: We have special support for typeof(foo) === 'bar' in the compiler.
48 # It will *not* generate a runtime typeof call for the most important 45 # It will *not* generate a runtime typeof call for the most important
49 # values of 'bar'. 46 # values of 'bar'.
50 macro IS_ARRAY(arg) = (%_IsArray(arg)); 47 macro IS_ARRAY(arg) = (%_IsArray(arg));
51 macro IS_ARRAYBUFFER(arg) = (%_ClassOf(arg) === 'ArrayBuffer'); 48 macro IS_ARRAYBUFFER(arg) = (%_ClassOf(arg) === 'ArrayBuffer');
52 macro IS_BOOLEAN(arg) = (typeof(arg) === 'boolean'); 49 macro IS_BOOLEAN(arg) = (typeof(arg) === 'boolean');
53 macro IS_DATAVIEW(arg) = (%_ClassOf(arg) === 'DataView'); 50 macro IS_DATAVIEW(arg) = (%_ClassOf(arg) === 'DataView');
54 macro IS_DATE(arg) = (%IsDate(arg)); 51 macro IS_DATE(arg) = (%IsDate(arg));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 # To avoid ES2015 Function name inference. 107 # To avoid ES2015 Function name inference.
111 macro ANONYMOUS_FUNCTION(fn) = (0, (fn)); 108 macro ANONYMOUS_FUNCTION(fn) = (0, (fn));
112 109
113 # Constants. The compiler constant folds them. 110 # Constants. The compiler constant folds them.
114 define INFINITY = (1/0); 111 define INFINITY = (1/0);
115 define UNDEFINED = (void 0); 112 define UNDEFINED = (void 0);
116 113
117 # Macros implemented in Python. 114 # Macros implemented in Python.
118 python macro CHAR_CODE(str) = ord(str[1]); 115 python macro CHAR_CODE(str) = ord(str[1]);
119 116
120 # Layout of internal RegExpLastMatchInfo object.
121 define REGEXP_NUMBER_OF_CAPTURES = 0;
122 define REGEXP_LAST_SUBJECT = 1;
123 define REGEXP_LAST_INPUT = 2;
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));
132
133 # Macros for internal slot access.
134 macro REGEXP_GLOBAL(regexp) = (%_RegExpFlags(regexp) & 1);
135 macro REGEXP_IGNORE_CASE(regexp) = (%_RegExpFlags(regexp) & 2);
136 macro REGEXP_MULTILINE(regexp) = (%_RegExpFlags(regexp) & 4);
137 macro REGEXP_STICKY(regexp) = (%_RegExpFlags(regexp) & 8);
138 macro REGEXP_UNICODE(regexp) = (%_RegExpFlags(regexp) & 16);
139 macro REGEXP_SOURCE(regexp) = (%_RegExpSource(regexp));
140
141 # For the regexp capture override array. This has the same
142 # format as the arguments to a function called from
143 # String.prototype.replace.
144 macro OVERRIDE_MATCH(override) = ((override)[0]);
145 macro OVERRIDE_POS(override) = ((override)[(override).length - 2]);
146 macro OVERRIDE_SUBJECT(override) = ((override)[(override).length - 1]);
147 # 1-based so index of 1 returns the first capture
148 macro OVERRIDE_CAPTURE(override, index) = ((override)[(index)]);
149
150 # For messages.js 117 # For messages.js
151 # Matches Script::Type from objects.h 118 # Matches Script::Type from objects.h
152 define TYPE_NATIVE = 0; 119 define TYPE_NATIVE = 0;
153 define TYPE_EXTENSION = 1; 120 define TYPE_EXTENSION = 1;
154 define TYPE_NORMAL = 2; 121 define TYPE_NORMAL = 2;
155 122
156 # Matches Script::CompilationType from objects.h 123 # Matches Script::CompilationType from objects.h
157 define COMPILATION_TYPE_HOST = 0; 124 define COMPILATION_TYPE_HOST = 0;
158 define COMPILATION_TYPE_EVAL = 1; 125 define COMPILATION_TYPE_EVAL = 1;
159 define COMPILATION_TYPE_JSON = 2; 126 define COMPILATION_TYPE_JSON = 2;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 define kSloppyModeBlockScopedFunctionRedefinition = 22; 190 define kSloppyModeBlockScopedFunctionRedefinition = 22;
224 define kForInInitializer = 23; 191 define kForInInitializer = 23;
225 define kArrayProtectorDirtied = 24; 192 define kArrayProtectorDirtied = 24;
226 define kArraySpeciesModified = 25; 193 define kArraySpeciesModified = 25;
227 define kArrayPrototypeConstructorModified = 26; 194 define kArrayPrototypeConstructorModified = 26;
228 define kArrayInstanceProtoModified = 27; 195 define kArrayInstanceProtoModified = 27;
229 define kArrayInstanceConstructorModified = 28; 196 define kArrayInstanceConstructorModified = 28;
230 define kLegacyFunctionDeclaration = 29; 197 define kLegacyFunctionDeclaration = 29;
231 define kRegExpPrototypeSourceGetter = 30; 198 define kRegExpPrototypeSourceGetter = 30;
232 define kRegExpPrototypeOldFlagGetter = 31; 199 define kRegExpPrototypeOldFlagGetter = 31;
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/js/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698