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

Unified Diff: src/factory.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 9e1fff4d85b3c4d89a7fda0a4a62c9df4d2b58c6..74bd611646dae53385173b158fcaa597f28d27d3 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -2494,6 +2494,23 @@ void Factory::SetRegExpIrregexpData(Handle<JSRegExp> regexp,
regexp->set_data(*store);
}
+Handle<RegExpMatchInfo> Factory::NewRegExpMatchInfo() {
+ // Initially, the last match info consists of all fixed fields plus space for
+ // the match itself (i.e., 2 capture indices).
+ static const int kInitialSize = RegExpMatchInfo::kFirstCaptureIndex +
+ RegExpMatchInfo::kInitialCaptureIndices;
+
+ Handle<FixedArray> elems = NewFixedArray(kInitialSize);
+ Handle<RegExpMatchInfo> result = Handle<RegExpMatchInfo>::cast(elems);
+
+ result->SetNumberOfCaptureRegisters(RegExpMatchInfo::kInitialCaptureIndices);
+ result->SetLastSubject(*empty_string());
+ result->SetLastInput(*undefined_value());
+ result->SetCapture(0, 0);
+ result->SetCapture(1, 0);
+
+ return result;
+}
Handle<Object> Factory::GlobalConstantFor(Handle<Name> name) {
if (Name::Equals(name, undefined_string())) return undefined_value();
« no previous file with comments | « src/factory.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698