1// Copyright 2019 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5@hasSameInstanceTypeAsParent 6@doNotGenerateCast 7extern class RegExpMatchInfo extends FixedArray { 8 macro GetStartOfCapture(implicit context: Context)(captureIndex: 9 constexpr int31): Smi { 10 const index: constexpr int31 = GetStartOfCaptureIndex(captureIndex); 11 return UnsafeCast<Smi>(this.objects[index]); 12 } 13 macro GetEndOfCapture(implicit context: Context)(captureIndex: 14 constexpr int31): Smi { 15 const index: constexpr int31 = GetStartOfCaptureIndex(captureIndex) + 1; 16 return UnsafeCast<Smi>(this.objects[index]); 17 } 18 macro NumberOfCaptures(implicit context: Context)(): Smi { 19 return UnsafeCast<Smi>(this.objects[kRegExpMatchInfoNumberOfCapturesIndex]); 20 } 21} 22 23const kRegExpMatchInfoFirstCaptureIndex: 24 constexpr int31 generates 'RegExpMatchInfo::kFirstCaptureIndex'; 25const kRegExpMatchInfoNumberOfCapturesIndex: 26 constexpr int31 generates 'RegExpMatchInfo::kNumberOfCapturesIndex'; 27 28macro GetStartOfCaptureIndex(captureIndex: constexpr int31): constexpr int31 { 29 return kRegExpMatchInfoFirstCaptureIndex + (captureIndex * 2); 30} 31