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

Unified Diff: src/js/macros.py

Issue 2244673002: [regexp][liveedit] Fix inconsistent JSArrays (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/js/regexp.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/macros.py
diff --git a/src/js/macros.py b/src/js/macros.py
index 57e931e0c28ab1e83893bc0a57ebb1d2020bb3f2..cdc3d0ae0c1a187ee9cb5b1ceaf55d4d23781843 100644
--- a/src/js/macros.py
+++ b/src/js/macros.py
@@ -117,9 +117,18 @@ define UNDEFINED = (void 0);
# Macros implemented in Python.
python macro CHAR_CODE(str) = ord(str[1]);
-# Constants used on an array to implement the properties of the RegExp object.
+# Layout of internal RegExpLastMatchInfo object.
define REGEXP_NUMBER_OF_CAPTURES = 0;
+define REGEXP_LAST_SUBJECT = 1;
+define REGEXP_LAST_INPUT = 2;
define REGEXP_FIRST_CAPTURE = 3;
+define CAPTURE0 = 3; # Aliases REGEXP_FIRST_CAPTURE.
+define CAPTURE1 = 4;
+
+macro NUMBER_OF_CAPTURES(array) = ((array)[REGEXP_NUMBER_OF_CAPTURES]);
+macro LAST_SUBJECT(array) = ((array)[REGEXP_LAST_SUBJECT]);
+macro LAST_INPUT(array) = ((array)[REGEXP_LAST_INPUT]);
+macro CAPTURE(index) = (REGEXP_FIRST_CAPTURE + (index));
# Macros for internal slot access.
macro REGEXP_GLOBAL(regexp) = (%_RegExpFlags(regexp) & 1);
@@ -129,20 +138,6 @@ macro REGEXP_STICKY(regexp) = (%_RegExpFlags(regexp) & 8);
macro REGEXP_UNICODE(regexp) = (%_RegExpFlags(regexp) & 16);
macro REGEXP_SOURCE(regexp) = (%_RegExpSource(regexp));
-# We can't put macros in macros so we use constants here.
-# REGEXP_NUMBER_OF_CAPTURES
-macro NUMBER_OF_CAPTURES(array) = ((array)[0]);
-
-# Last input and last subject of regexp matches.
-define LAST_SUBJECT_INDEX = 1;
-macro LAST_SUBJECT(array) = ((array)[1]);
-macro LAST_INPUT(array) = ((array)[2]);
-
-# REGEXP_FIRST_CAPTURE
-macro CAPTURE(index) = (3 + (index));
-define CAPTURE0 = 3;
-define CAPTURE1 = 4;
-
# For the regexp capture override array. This has the same
# format as the arguments to a function called from
# String.prototype.replace.
« 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