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

Unified Diff: src/objects-inl.h

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/objects.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index c033c333e43a887c53a2f2b7dbd9203d96df751f..40cda3140eb36ba54872c3d6a213b00b497acb28 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -716,6 +716,8 @@ bool HeapObject::IsFrameArray() const { return IsFixedArray(); }
bool HeapObject::IsArrayList() const { return IsFixedArray(); }
+bool HeapObject::IsRegExpMatchInfo() const { return IsFixedArray(); }
+
bool Object::IsLayoutDescriptor() const {
return IsSmi() || IsFixedTypedArrayBase();
}
@@ -2535,6 +2537,48 @@ void ArrayList::Clear(int index, Object* undefined) {
->set(kFirstIndex + index, undefined, SKIP_WRITE_BARRIER);
}
+int RegExpMatchInfo::NumberOfCaptureRegisters() {
+ DCHECK_GE(length(), kLastMatchOverhead);
+ Object* obj = get(kNumberOfCapturesIndex);
+ return Smi::cast(obj)->value();
+}
+
+void RegExpMatchInfo::SetNumberOfCaptureRegisters(int value) {
+ DCHECK_GE(length(), kLastMatchOverhead);
+ set(kNumberOfCapturesIndex, Smi::FromInt(value));
+}
+
+String* RegExpMatchInfo::LastSubject() {
+ DCHECK_GE(length(), kLastMatchOverhead);
+ Object* obj = get(kLastSubjectIndex);
+ return String::cast(obj);
+}
+
+void RegExpMatchInfo::SetLastSubject(String* value) {
+ DCHECK_GE(length(), kLastMatchOverhead);
+ set(kLastSubjectIndex, value);
+}
+
+Object* RegExpMatchInfo::LastInput() {
+ DCHECK_GE(length(), kLastMatchOverhead);
+ return get(kLastInputIndex);
+}
+
+void RegExpMatchInfo::SetLastInput(Object* value) {
+ DCHECK_GE(length(), kLastMatchOverhead);
+ set(kLastInputIndex, value);
+}
+
+int RegExpMatchInfo::Capture(int i) {
+ DCHECK_LT(i, NumberOfCaptureRegisters());
+ Object* obj = get(kFirstCaptureIndex + i);
+ return Smi::cast(obj)->value();
+}
+
+void RegExpMatchInfo::SetCapture(int i, int value) {
+ DCHECK_LT(i, NumberOfCaptureRegisters());
+ set(kFirstCaptureIndex + i, Smi::FromInt(value));
+}
WriteBarrierMode HeapObject::GetWriteBarrierMode(
const DisallowHeapAllocation& promise) {
@@ -3314,6 +3358,7 @@ CAST_ACCESSOR(OrderedHashMap)
CAST_ACCESSOR(OrderedHashSet)
CAST_ACCESSOR(PropertyCell)
CAST_ACCESSOR(TemplateList)
+CAST_ACCESSOR(RegExpMatchInfo)
CAST_ACCESSOR(ScopeInfo)
CAST_ACCESSOR(SeededNumberDictionary)
CAST_ACCESSOR(SeqOneByteString)
« no previous file with comments | « src/objects.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698