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

Unified Diff: src/js/regexp.js

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/js/macros.py ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/regexp.js
diff --git a/src/js/regexp.js b/src/js/regexp.js
index 67b203236e49ae944c4d6897958720d72c31fc66..dbe4837c6456b87ae1484687c1065396b2d63cee 100644
--- a/src/js/regexp.js
+++ b/src/js/regexp.js
@@ -38,15 +38,17 @@ utils.Import(function(from) {
// regexp match. The property RegExpLastMatchInfo includes the matchIndices
// array of the last successful regexp match (an array of start/end index
// pairs for the match and all the captured substrings), the invariant is
-// that there are at least two capture indeces. The array also contains
+// that there are at least two capture indices. The array also contains
// the subject string for the last successful match.
-var RegExpLastMatchInfo = new InternalPackedArray(
- 2, // REGEXP_NUMBER_OF_CAPTURES
- "", // Last subject.
- UNDEFINED, // Last input - settable with RegExpSetInput.
- 0, // REGEXP_FIRST_CAPTURE + 0
- 0 // REGEXP_FIRST_CAPTURE + 1
-);
+// We use a JSObject rather than a JSArray so we don't have to manually update
+// its length.
+var RegExpLastMatchInfo = {
+ REGEXP_NUMBER_OF_CAPTURES: 2,
+ REGEXP_LAST_SUBJECT: "",
+ REGEXP_LAST_INPUT: UNDEFINED, // Settable with RegExpSetInput.
+ CAPTURE0: 0,
+ CAPTURE1: 0
+};
// -------------------------------------------------------------------
@@ -1201,7 +1203,13 @@ for (var i = 1; i < 10; ++i) {
// -------------------------------------------------------------------
// Internal
-var InternalRegExpMatchInfo = new InternalPackedArray(2, "", UNDEFINED, 0, 0);
+var InternalRegExpMatchInfo = {
+ REGEXP_NUMBER_OF_CAPTURES: 2,
+ REGEXP_LAST_SUBJECT: "",
+ REGEXP_LAST_INPUT: UNDEFINED,
+ CAPTURE0: 0,
+ CAPTURE1: 0
+};
function InternalRegExpMatch(regexp, subject) {
var matchInfo = %_RegExpExec(regexp, subject, 0, InternalRegExpMatchInfo);
« no previous file with comments | « src/js/macros.py ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698