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(); |