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 5bitfield struct JSRegExpFlags extends uint31 { 6 global: bool: 1 bit; 7 ignore_case: bool: 1 bit; 8 multiline: bool: 1 bit; 9 sticky: bool: 1 bit; 10 unicode: bool: 1 bit; 11 dot_all: bool: 1 bit; 12 linear: bool: 1 bit; 13} 14 15@generateCppClass 16extern class JSRegExp extends JSObject { 17 data: FixedArray|Undefined; 18 source: String|Undefined; 19 flags: SmiTagged<JSRegExpFlags>|Undefined; 20} 21 22// Note: Although a condition for a FastJSRegExp is having a positive smi 23// lastIndex (see RegExpBuiltinsAssembler::BranchIfFastRegExp), it is possible 24// for this to change without transitioning the transient type. As a precaution, 25// validate the lastIndex is positive smi when used in fast paths. 26transient type FastJSRegExp extends JSRegExp; 27 28extern operator '.global' macro 29RegExpBuiltinsAssembler::FastFlagGetterGlobal(FastJSRegExp): bool; 30extern operator '.unicode' macro 31RegExpBuiltinsAssembler::FastFlagGetterUnicode(FastJSRegExp): bool; 32extern operator '.lastIndex' macro 33RegExpBuiltinsAssembler::FastLoadLastIndex(FastJSRegExp): Smi; 34extern operator '.lastIndex=' macro 35RegExpBuiltinsAssembler::FastStoreLastIndex(FastJSRegExp, Smi): void; 36 37extern shape JSRegExpResult extends JSArray { 38 // In-object properties: 39 // The below fields are externally exposed. 40 index: JSAny; 41 input: JSAny; 42 groups: JSAny; 43 44 // The below fields are for internal use only. 45 cached_indices_or_regexp: JSRegExpResultIndices|JSRegExp; 46 names: FixedArray|Undefined; 47 regexp_input: String; 48 regexp_last_index: Smi; 49} 50 51extern shape JSRegExpResultIndices extends JSArray { 52 // In-object properties: 53 // The groups field is externally exposed. 54 groups: JSAny; 55} 56