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 has_indices: bool: 1 bit; 14} 15 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 37@doNotGenerateCast 38extern class JSRegExpConstructor extends JSFunction 39 generates 'TNode<JSFunction>'; 40 41extern shape JSRegExpResult extends JSArray { 42 // In-object properties: 43 // The below fields are externally exposed. 44 index: JSAny; 45 input: JSAny; 46 groups: JSAny; 47 48 // The below fields are for internal use only. 49 names: FixedArray|Undefined; 50 regexp_input: String; 51 regexp_last_index: Smi; 52} 53 54extern shape JSRegExpResultWithIndices extends JSRegExpResult { 55 indices: JSAny; 56} 57 58extern shape JSRegExpResultIndices extends JSArray { 59 // In-object properties: 60 // The groups field is externally exposed. 61 groups: JSAny; 62} 63