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

Side by Side Diff: src/macros.py

Issue 28184: Avoids allocating a JSArray of capture information on each non-global... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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 | Annotate | Revision Log
OLDNEW
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
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.
113 macro LAST_SUBJECT(array) = ((array)[(array)[0] + 1]);
Christian Plesner Hansen 2009/02/26 15:18:53 Beware: this evaluates its argument twice.
114 macro LAST_INPUT(array) = ((array)[(array)[0] + 2]);
115
116 # REGEXP_FIRST_CAPTURE
117 macro CAPTURE(index) = (1 + (index));
118 const CAPTURE0 = 1;
119 const CAPTURE1 = 2;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698