Documentation
¶
Overview ¶
Package storage holds the values, the objects and the shapes of JavaScript, and the operations on them that run no code.
Index ¶
- Constants
- Variables
- func Add64(x, y int64) (int64, bool)
- func CheckValue(v Value)
- func Clip[S ~string](s S, max int, suffix S) S
- func CompareStrings(a, b Value) int
- func CopyBufferBytes(dst *ArrayBuffer, dstOffset int, src *ArrayBuffer, srcOffset, n int)
- func CopyPolled[T any](p *Poller, dst, src []T) int
- func DisplayString(v Value) string
- func DisposableStackState(v Value, async bool) any
- func ElementBits(t element.Type, v Value) uint64
- func ElementCount(v Value) int
- func ErrorStack(v Value) (wtf8.String, bool)
- func GoError(v Value) error
- func IntlData(v Value) any
- func IsASCII(v Value, s wtf8.String) bool
- func IsCanonicalNumericString(key *Object) bool
- func IsCompatiblePropertyDescriptor(extensible bool, d, cur *PropDesc, hasCur bool) bool
- func IsError(v Value) bool
- func IsStrictlyEqual(a, b Value) bool
- func IteratorState(v Value) any
- func JoinsPair(x wtf8.String, xr bool, y wtf8.String, yr bool) bool
- func NewClosure(p *FuncProto) (*Object, []Upvalue)
- func NewObjectWithStorage(n int) (*Object, []Value)
- func NewTailObjectWithStorage(n int) (*Object, []Value)
- func NonConfigurableCompatible(cur, d *PropDesc) bool
- func NumberIndex(n float64) (uint32, bool)
- func SameValue(a, b Value) bool
- func SameValueZero(a, b Value) bool
- func SetDateValue(v Value, tv float64)
- func SetNumber(r *Value, n float64)
- func SetValueInBuffer(b []byte, t element.Type, v Value, littleEndian bool)
- func ShortStringsJoinPair(a Value, aN int, b Value, bN int) bool
- func StringIndex(s wtf8.String) (uint32, bool)
- func SymbolDescription(sym *Object) (wtf8.String, bool)
- func TailBuilder(o *Object) *strings.Builder
- func TemporalData(v Value) any
- func ThisBooleanValue(v Value) (bool, bool)
- func ThisNumberValue(v Value) (float64, bool)
- func ThisTimeValue(v Value) (float64, bool)
- func ToBoolean(v Value) bool
- func Truncated[T any](s []T, n int) []T
- func TypedArrayFlags(o *Object) uint8
- func TypedArrayHas(o *Object, i uint32) bool
- func TypedArrayImmutable(o *Object) bool
- func TypedArrayLength(o *Object) int
- func WithoutLast[T any](s []T) []T
- func WriteReversed(sb *strings.Builder, s wtf8.String)
- type ArrayBuffer
- func (b *ArrayBuffer) ByteLength() int
- func (b *ArrayBuffer) Bytes() []byte
- func (b *ArrayBuffer) Detach()
- func (b *ArrayBuffer) Grow(n int) bool
- func (b *ArrayBuffer) HasDetachKey() bool
- func (b *ArrayBuffer) IsDetached() bool
- func (b *ArrayBuffer) IsImmutable() bool
- func (b *ArrayBuffer) IsResizable() bool
- func (b *ArrayBuffer) IsShared() bool
- func (b *ArrayBuffer) Lock() []byte
- func (b *ArrayBuffer) MaxByteLength() int
- func (b *ArrayBuffer) Resize(n int)
- func (b *ArrayBuffer) SameDataBlock(c *ArrayBuffer) bool
- func (b *ArrayBuffer) SharedDataBlock() *SharedDataBlock
- func (b *ArrayBuffer) Unlock()
- type AtomicOp
- type BigIntObject
- type BoundFunc
- type CacheEntry
- type ClassElement
- type CmpResult
- type CommonKey
- type ConcatCount
- type DataView
- type Error
- type ErrorData
- type Extremum
- type FieldDecoration
- type FuncProto
- type Function
- type GlobalCache
- type InterruptSignal
- type Intrinsic
- type Kind
- type NamedLookup
- type Native
- type NativeInfo
- type Object
- func NewArray(s *Shape, elems []Value) *Object
- func NewExoticObject(s *Shape, c class, state any) *Object
- func NewFunctionObject(s *Shape, fn *Function) *Object
- func NewGlobalObject(s *Shape, n int) *Object
- func NewInstance(s *Shape) *Object
- func NewMarker(state any) *Object
- func NewNamespaceObject(s *Shape, state any) *Object
- func NewObject(s *Shape) *Object
- func NewObjectWithState(s *Shape, c class, state any) *Object
- func NewPrivateName(desc wtf8.String) *Object
- func NewProxyObject(s *Shape, state *ProxyState, fn *Function) *Object
- func NewRegExpObject(s *Shape, state *RegExpState) *Object
- func ThisSymbolValue(v Value) (*Object, bool)
- func (o *Object) AppendElem(v Value)
- func (o *Object) AppendSlot(v Value)
- func (o *Object) ArrayIndex() (uint32, bool)
- func (o *Object) ClearBuilder()
- func (o *Object) CodePointAt(i int) rune
- func (o *Object) CreationRealm() *RealmPart
- func (o *Object) DelegatesPropertyAccess() bool
- func (o *Object) ElemCount() int
- func (o *Object) ElemRoom() int
- func (o *Object) ElementAt(i uint32) (Value, bool)
- func (o *Object) ElementList() ([]Value, bool)
- func (o *Object) ElemsResizable() bool
- func (o *Object) ElemsStorage() int
- func (o *Object) ExtConcatCount() ConcatCount
- func (o *Object) ExtObject() (*Object, bool)
- func (o *Object) ExtState() any
- func (o *Object) ExtendExclusive(sb *strings.Builder, ascii bool)
- func (o *Object) Flags() uint8
- func (o *Object) FreezeLength()
- func (o *Object) GrowLength(n uint32)
- func (o *Object) HasElement() bool
- func (o *Object) HasElementAt(i uint32) bool
- func (o *Object) HasHole() bool
- func (o *Object) HasOwnMethod(key, method *Object) bool
- func (o *Object) HasProperties() bool
- func (o *Object) HolesAreAbsent() bool
- func (o *Object) HostDefined() any
- func (o *Object) IndicesInElements() bool
- func (o *Object) InheritsMethod(proto, key, method *Object) bool
- func (o *Object) InheritsNoIndex() bool
- func (o *Object) InitBinding(key *Object, v Value)
- func (o *Object) InitElems(storage []Value)
- func (o *Object) InitSlots(storage []Value)
- func (o *Object) IsASCII() bool
- func (o *Object) IsRawJSON() bool
- func (o *Object) IsRegExpObject() bool
- func (o *Object) KnownArrayIndex() (uint32, bool)
- func (o *Object) Length() uint32
- func (o *Object) MakeHTMLDDA()
- func (o *Object) MakeNonExtensible()
- func (o *Object) MakePrivate()
- func (o *Object) MarkExclusive()
- func (o *Object) Meta() *ObjectMeta
- func (o *Object) MoveElemsTo(room int)
- func (o *Object) OwnFunction() *Function
- func (o *Object) PlainElems() ([]Value, bool)
- func (o *Object) PushElement(v Value)
- func (o *Object) Raw() Raw
- func (o *Object) RegExpLegacyFeaturesEnabled() bool
- func (o *Object) RegExpMatcher() *regexp.Regexp
- func (o *Object) RegExpOriginal() (source, flags wtf8.String)
- func (o *Object) RemoveFirstElement() (Value, bool)
- func (o *Object) RemoveLastElement() (Value, bool)
- func (o *Object) RenewRegExp(s *Shape)
- func (o *Object) RenewShape()
- func (o *Object) ReserveElems(n int)
- func (o *Object) ReserveSlots(n int)
- func (o *Object) SetArrayIndex(i uint32)
- func (o *Object) SetElement(i int64, v Value) bool
- func (o *Object) SetExtState(v any)
- func (o *Object) SetText(s wtf8.String)
- func (o *Object) Shape() *Shape
- func (o *Object) Share()
- func (o *Object) SlotCount() int
- func (o *Object) SlotValue(p Prop) Value
- func (f *Object) SourceText() wtf8.String
- func (o *Object) StartMaterialized(s *Shape) *Function
- func (o *Object) StoreData(p Prop, v Value) bool
- func (o *Object) StoreElement(i uint32, v Value)
- func (o *Object) StoreMapped(p Prop, v Value)
- func (o *Object) Str() wtf8.String
- func (o *Object) StringLength() int
- func (o *Object) Substring(start, end int) wtf8.String
- func (dst *Object) TakeDataProperties(from *Object) bool
- func (o *Object) Text() wtf8.String
- func (o *Object) UnitAt(i int) uint16
- func (o *Object) UnitIndexOf(sub wtf8.String, from int, poll func()) int
- func (o *Object) UnitLastIndexOf(sub wtf8.String, from int, poll func()) int
- func (o *Object) Unreverse()
- type ObjectMeta
- type Poller
- type Prop
- type PropCache
- type PropDesc
- func (d *PropDesc) Complete()
- func (d *PropDesc) Configurable() bool
- func (d *PropDesc) Enumerable() bool
- func (d *PropDesc) FieldCount() int
- func (d *PropDesc) Getter() *Object
- func (d *PropDesc) HasFalse(has, flag uint8) bool
- func (d *PropDesc) HasField(has uint8) bool
- func (d *PropDesc) HasTrue(has, flag uint8) bool
- func (d *PropDesc) IsAccessor() bool
- func (d *PropDesc) IsData() bool
- func (d *PropDesc) KeepsData(cur *PropDesc) bool
- func (d *PropDesc) NewAccessorProperty() (Value, uint8)
- func (d *PropDesc) NewData() (Value, uint8)
- func (d *PropDesc) RedefinedData(cur *PropDesc) (Value, uint8)
- func (d *PropDesc) RedefinedProperty(cur *PropDesc) (Value, uint8)
- func (d *PropDesc) SetConfigurable(b bool)
- func (d *PropDesc) SetEnumerable(b bool)
- func (d *PropDesc) SetGetter(f *Object)
- func (d *PropDesc) SetSetter(f *Object)
- func (d *PropDesc) SetValue(v Value)
- func (d *PropDesc) SetWritable(b bool)
- func (d *PropDesc) Setter() *Object
- func (d *PropDesc) Value() Value
- func (d *PropDesc) Writable() bool
- type PropKey
- func AppendElemRun(keys []PropKey, o *Object, start, end int) []PropKey
- func AppendEnumerableNames(keys []PropKey, s *Shape, names []*Object) []PropKey
- func AppendIndexRun(keys []PropKey, i, j int) []PropKey
- func EnumerableKey(key *Object, flags uint8) PropKey
- func IndexKey(i uint32) PropKey
- func NamedKey(key *Object) PropKey
- type PropertyObject
- func (o *PropertyObject) Init() *Object
- func (o *PropertyObject) InitExotic(s *Shape, c class, state any) *Object
- func (o *PropertyObject) InitFunction(s *Shape, fn *Function, state any) *Object
- func (o *PropertyObject) InitMaterializedFunction(s *Shape, fn *Function, room []Value) *Object
- func (o *PropertyObject) InitWithState(s *Shape, c class, state any) *Object
- type ProxyState
- type QueryKey
- type Raw
- func (r Raw) Elem(i int) Value
- func (r Raw) ElemCount() int
- func (r Raw) ElemRoom() int
- func (r Raw) Elems() []Value
- func (r Raw) ElemsShared() bool
- func (r Raw) ExtendElems(n int)
- func (r Raw) ExtendSlots(n int)
- func (r Raw) SetElem(i int, v Value)
- func (r Raw) SetFlags(flags uint8)
- func (r Raw) SetLength(n uint32)
- func (r Raw) SetShape(s *Shape)
- func (r Raw) SetSlot(i int, v Value)
- func (r Raw) Slot(i int) Value
- func (r Raw) SlotCount() int
- func (r Raw) SlotRef(i int) *Value
- func (r Raw) SlotRoom() int
- type RealmPart
- func (r *RealmPart) AddIndex(o *Object, i uint32, val Value, flags uint8) bool
- func (r *RealmPart) AddMappedElement(o *Object, i uint32)
- func (r *RealmPart) AppendElements(o *Object, vals []Value) (uint32, bool)
- func (r *RealmPart) AppendElementsOf(dst *Object, n int64, src *Object) bool
- func (r *RealmPart) ArrayCreate(length uint32, proto *Object) *Object
- func (r *RealmPart) ArrayCtorPlain(o *Object) bool
- func (r *RealmPart) ArrayIterationPlain(o *Object) bool
- func (r *RealmPart) ArrayProtoPlain() bool
- func (r *RealmPart) AssignDataProperties(to, from *Object) bool
- func (r *RealmPart) CheckNoIteratorReturn()
- func (r *RealmPart) CodePointsToString(points []rune) Value
- func (r *RealmPart) CopyElementRange(o *Object, start, end int64) (*Object, bool)
- func (r *RealmPart) CreateIterResultObject(v Value, done bool) Value
- func (r *RealmPart) Define(o *Object, key *Object, val Value, flags uint8)
- func (r *RealmPart) DefineAccessor(o *Object, key *Object, getter, setter *Object, flags uint8)
- func (r *RealmPart) DefineMatchResultProperties(a *Object, index, input, groups Value)
- func (r *RealmPart) DefineMatchResultPropertiesWithIndices(a *Object, index, input, groups, indices Value)
- func (r *RealmPart) FillElements(o *Object, n, start, end int64, v Value) bool
- func (r *RealmPart) FunctionShapeFor(proto *Object) *Shape
- func (r *RealmPart) GetVWithoutCall(v Value, key *Object, c *PropCache) (val Value, ok bool)
- func (r *RealmPart) HasOwnPropertyPlain(o *Object, k Value) (has, ok bool)
- func (r *RealmPart) IndexName(i uint32) *Object
- func (r *RealmPart) InheritsHasInstance(c *Object) bool
- func (r *RealmPart) InitShortStrings()
- func (r *RealmPart) Intern(s wtf8.String) *Object
- func (r *RealmPart) Intrinsic(id Intrinsic) *Object
- func (r *RealmPart) JoinStrings(o *Object, length int64, sep wtf8.String) (Value, bool)
- func (r *RealmPart) KeyOfString(s wtf8.String) PropKey
- func (r *RealmPart) Lookup(o *Object, key *Object) NamedLookup
- func (r *RealmPart) LookupDataSlot(o, key *Object) dataSlot
- func (r *RealmPart) Materialize(o *Object)
- func (r *RealmPart) NewArgumentsObject(args, extra []Value) *Object
- func (r *RealmPart) NewArray(elems []Value) *Object
- func (r *RealmPart) NewArrayBufferFromBytes(proto *Object, b []byte, maxByteLength int) *Object
- func (r *RealmPart) NewArrayCopy(elems []Value) *Object
- func (r *RealmPart) NewArrayOfConstants(run []Value) *Object
- func (r *RealmPart) NewArrayPair(a, b Value) *Object
- func (r *RealmPart) NewArrayWithRoom(length, n int) *Object
- func (r *RealmPart) NewBufferedString(s wtf8.String, flags uint8, builder any, meta *ObjectMeta) Value
- func (r *RealmPart) NewConcatenatedString(s wtf8.String, count ConcatCount) Value
- func (r *RealmPart) NewDataViewObject(proto *Object, buffer *Object, byteOffset, byteLength int) *Object
- func (r *RealmPart) NewElementsPlain(o *Object) bool
- func (r *RealmPart) NewEmptyArrayWithRoom(n int) *Object
- func (r *RealmPart) NewEmptyObjectWithRoom(n int) *Object
- func (r *RealmPart) NewHostArrayBufferObject(proto *Object, b []byte) *Object
- func (r *RealmPart) NewImmutableArrayBufferFromBytes(proto *Object, b []byte) *Object
- func (r *RealmPart) NewObject(proto *Object) *Object
- func (r *RealmPart) NewObjectFromProperties(keys []PropKey, vals []Value) *Object
- func (r *RealmPart) NewSharedArrayBufferObject(proto *Object, blk *SharedDataBlock) *Object
- func (r *RealmPart) NewString(s wtf8.String) Value
- func (r *RealmPart) NewTemplateArray(vals []Value) *Object
- func (r *RealmPart) NewTypedArrayObject(proto *Object, t element.Type, buffer *Object, byteOffset, length int) *Object
- func (r *RealmPart) NumberToString(n float64) Value
- func (r *RealmPart) OwnFunctionPrototypeSlot(ctor *Object, site *PropCache) *Value
- func (r *RealmPart) PollAtIndex(i int64)
- func (r *RealmPart) PrependElements(o *Object, vals []Value) (uint32, bool)
- func (r *RealmPart) RecordRegExpOriginals(protoKeys, ctorKeys []*Object)
- func (r *RealmPart) RegExpLastIndex(o *Object) (Value, bool)
- func (r *RealmPart) RegExpShape() *Shape
- func (r *RealmPart) ReplaceOwn(o *Object, k PropKey, val Value, flags uint8)
- func (r *RealmPart) ReverseElements(o *Object) bool
- func (r *RealmPart) SearchElements(o *Object, i, end int64, target Value, sameValueZero bool) (found, next int64)
- func (r *RealmPart) SetIntrinsic(id Intrinsic, o *Object)
- func (r *RealmPart) SetRegExpLastIndex(o *Object, v Value) bool
- func (r *RealmPart) ShapeFor(proto *Object) *Shape
- func (r *RealmPart) SharedString(s wtf8.String) Value
- func (r *RealmPart) ShortString(s wtf8.String) Value
- func (r *RealmPart) SkipHoles(o *Object, i, end int64) int64
- func (r *RealmPart) SkipHolesBackward(o *Object, i, end int64) int64
- func (r *RealmPart) SpliceElements(o *Object, length, start, del int64, items []Value) (*Object, bool)
- func (r *RealmPart) StringFromCodeUnits(units []uint16) Value
- func (r *RealmPart) Substring(s Value, start, end int) Value
- func (r *RealmPart) UnitString(u uint16) Value
- func (r *RealmPart) UnmodifiedRegExpMatcher(o *Object) *regexp.Regexp
- type RegExpSite
- type RegExpState
- type ReversedBuilder
- type Shape
- type ShapeEntry
- type ShapeKey
- type SharedDataBlock
- type Space
- func (sp *Space) Add(o *Object, key *Object, val Value, flags uint8)
- func (sp *Space) AddToKeptObjects(o *Object)
- func (sp *Space) ArrayIterationUnmodified(r *RealmPart) bool
- func (sp *Space) CanBeHeldWeakly(v Value) bool
- func (sp *Space) ClearKeptObjects()
- func (sp *Space) EndLazy(o *Object)
- func (sp *Space) ErrorOf(v Value) *Error
- func (sp *Space) FinishBuiltins()
- func (sp *Space) HostDefined() any
- func (sp *Space) IndexKey(i uint32) *Object
- func (sp *Space) InitMissHolder(s *Shape)
- func (sp *Space) IsLazyKey(key *Object) bool
- func (sp *Space) Key(k CommonKey) *Object
- func (sp *Space) KeyForSymbol(sym *Object) (wtf8.String, bool)
- func (sp *Space) NewShape(proto *Object, r *RealmPart, family shapeFamily) *Shape
- func (sp *Space) NewSymbol(desc wtf8.String, hasDesc bool) *Object
- func (sp *Space) NoArrayIteratorReturn(proto *Object) bool
- func (sp *Space) Owns(o *Object) bool
- func (sp *Space) PairDestructuringPlain(r *RealmPart) bool
- func (sp *Space) QueryStringKey(o *Object) QueryKey
- func (sp *Space) ReadNamedSlot(start, holder *Object, p Prop, c *PropCache) (val Value, getter *Object)
- func (sp *Space) RegisteredSymbol(key wtf8.String) *Object
- func (sp *Space) Remove(o, key *Object)
- func (sp *Space) RootShape(proto *Object, r *RealmPart, family shapeFamily) *Shape
- func (sp *Space) SetProto(o *Object, proto *Object)
- func (sp *Space) ShapeForRealm(proto *Object, r *RealmPart) *Shape
- func (sp *Space) ShortQueryKey(v Value) QueryKey
- func (sp *Space) StartBuiltins()
- func (sp *Space) TouchProto(o *Object)
- func (sp *Space) TypeofValue(v Value) Value
- func (sp *Space) WeakRefDeref(v Value) (Value, bool)
- func (sp *Space) WellKnownSymbol(s WellKnownSymbol) *Object
- type StackCall
- type TemplateSite
- type TypedArray
- func (t *TypedArray) ArrayBuffer() *ArrayBuffer
- func (t *TypedArray) AtomicLoad(i int) uint64
- func (t *TypedArray) AtomicReadModifyWrite(i int, op AtomicOp, v, replacement uint64) uint64
- func (t *TypedArray) AtomicStore(i int, x uint64)
- func (t *TypedArray) Buffer() *Object
- func (t *TypedArray) ByteOffset() int
- func (t *TypedArray) ElementBytes(i uint32) ([]byte, bool)
- func (t *TypedArray) ElementType() element.Type
- func (t *TypedArray) IsLengthTracking() bool
- func (t *TypedArray) IsTypedArrayFixedLength() bool
- func (t *TypedArray) Length() (int, bool)
- func (t *TypedArray) LoadElement(i int) (uint64, bool)
- func (t *TypedArray) Lock() []byte
- func (t *TypedArray) StoreElement(i int, x uint64)
- func (t *TypedArray) Unlock()
- type Upvalue
- type Value
- func ArithBigInt64(op bytecode.Opcode, x, y int64) (Value, bool)
- func BigIntFromInt64(i int64) Value
- func Bool(b bool) Value
- func DiagnosticDataProperty(o, key *Object) (Value, bool)
- func Element(o *Object, i int64) (Value, bool)
- func ElementFromBits(t element.Type, x uint64) Value
- func ElementFromBytes(t element.Type, b []byte) Value
- func GetValueFromBuffer(b []byte, t element.Type, littleEndian bool) Value
- func NewAccessor(getter, setter *Object) Value
- func NewBigInt(i *big.Int) Value
- func Number(n float64) Value
- func ObjectValue(o *Object) Value
- func ThisBigIntValue(v Value) (Value, bool)
- func ThisStringValue(v Value) (Value, bool)
- func TypedArrayGet(o *Object, i uint32) Value
- func (v Value) Accessor() *accessorPair
- func (v Value) AppendStringBytes(dst []byte) []byte
- func (v Value) BigInt() *big.Int
- func (v Value) BigInt64() (int64, bool)
- func (v Value) CodePointAt(i int) rune
- func (s Value) IsASCII() bool
- func (v Value) IsBigInt() bool
- func (v Value) IsBool() bool
- func (v Value) IsCallable() bool
- func (v Value) IsHTMLDDA() bool
- func (v Value) IsHole() bool
- func (v Value) IsNull() bool
- func (v Value) IsNullish() bool
- func (v Value) IsNumber() bool
- func (v Value) IsObject() bool
- func (v Value) IsShortString() bool
- func (v Value) IsString() bool
- func (v Value) IsSymbol() bool
- func (v Value) IsUndefined() bool
- func (v Value) IsWellFormed() bool
- func (v Value) Number() float64
- func (v Value) Object() *Object
- func (v Value) RawString() wtf8.String
- func (v Value) ShortText() wtf8.String
- func (v Value) Str() wtf8.String
- func (v Value) StringByteLength() int
- func (v Value) StringLength() int
- func (v Value) StringObject() *Object
- func (v Value) Substring(start, end int) wtf8.String
- func (v Value) SubstringEquals(start, end int, other Value) bool
- func (v Value) UnitAt(i int) uint16
- func (v Value) UnitIndexOf(sub Value, from int, poll func()) int
- func (v Value) UnitLastIndexOf(sub Value, from int, poll func()) int
- func (v Value) WriteShortString(b *strings.Builder)
- func (v Value) WriteStringTo(b *wtf8.Buffer)
- type WeakTable
- type WellKnownSymbol
Constants ¶
const ( // BufferAfter is the number of concatenations in a row after which the next one makes its // result the tail or the head of a builder. BufferAfter ConcatCount = 3 // MinBufferedLength is the smallest length in bytes of a string that is the tail or the head // of a builder. MinBufferedLength = 32 // MaxStackConcatBytes bounds scratch space for multi-part concatenation. MaxStackConcatBytes = 64 PrependShift = 2 )
const ( CacheNone uint8 = iota // CacheOwn: the property is in Slot of the receiver. CacheOwn // CacheProto: Ref points to an inherited data slot or the undefined slot for a cached miss. CacheProto // CacheGetter and CacheSetter: Holder is the function to call. CacheGetter CacheSetter // CacheOwnGetter: the property is an accessor in Slot of the receiver, whose getter is called. CacheOwnGetter // CacheAdd: a store adds the property and moves the receiver to the shape Next. CacheAdd )
Kinds of inline cache entries.
const ( // ObjInterned marks a string that is the unique representative of its contents, // so that it can serve as a property key compared by identity. ObjInterned uint8 = 1 << iota // ObjASCIIKnown says that ObjASCII is valid. ObjASCIIKnown ObjASCII // ObjNotExtensible marks an object that refuses new properties. ObjNotExtensible // ObjIsProto marks an object that is the prototype of some shape. Changing the properties // of such an object invalidates the inline caches that looked through it. ObjIsProto // ObjFrozenLength marks an array whose length is not writable. ObjFrozenLength // ObjSparse marks an object that has properties with array index keys outside elems: // they are in the shape under their canonical string keys. elems only ever holds // data properties that are writable, enumerable and configurable. ObjSparse // ObjExotic marks an object whose named properties cannot be found by looking at its shape alone. ObjExotic )
Object flags.
const ( // PinnedSlots and PinnedElems mark slots and elements that may be in the object's allocation. PinnedSlots uint8 = 1 << iota PinnedElems // PinnedGlobalSlots marks the slots of a global object or of the global lexical bindings, // which the inline caches of global variables point into. PinnedGlobalSlots )
Object pinned bits, which mark storage that stays reachable after the slots or the elements of the object move out of it.
const ( ClassObject class = iota ClassArray ClassFunction ClassError ClassBoolean ClassNumber ClassString ClassSymbol ClassBigInt ClassArguments ClassDate ClassRegExp ClassMap ClassSet ClassWeakMap ClassWeakSet ClassWeakRef ClassFinalizationRegistry ClassArrayBuffer ClassTypedArray ClassDataView ClassPromise ClassGenerator ClassProxy ClassGlobalProxyHandler ClassIterator ClassForIn ClassPrivateName ClassModuleNamespace ClassRawJSON ClassDisposableStack ClassAsyncDisposableStack ClassTemporal ClassIntl ClassShadowRealm ClassModuleSource // ClassLazy is an ordinary object whose properties are not defined yet. ClassLazy // ClassEvalScope is the scope of OpEvalScope, whose properties are the variables that // direct evals declare in a function. ClassEvalScope )
const ( HasValue uint8 = 1 << iota HasWritable HasGet HasSet HasEnumerable HasConfigurable )
Fields of a property descriptor that are present.
const ( FlagEnumerable uint8 = 1 << iota FlagWritable FlagConfigurable FlagAccessor FlagsData = FlagEnumerable | FlagWritable | FlagConfigurable FlagsHidden = FlagWritable | FlagConfigurable )
Property attributes.
const ( LookupAbsent namedLookupKind = iota // The chain ended. A miss or property addition can be cached. LookupSlot // A slot supplies the value or accessor. LookupLength // The implicit length of an array or string has no slot. LookupNumericMiss // A typed array answers undefined on reads and handles stores itself. LookupDelegate // The holder must perform each operation. )
const ( OrdinaryRoot shapeFamily = iota ArrayRoot TypedArrayRoot LazyFunctionRoot // These families start a separate tree for each request. DelegatedRoot PrimitiveStringRoot )
const ( TypeofUndefined = iota TypeofNumber TypeofBoolean TypeofString TypeofSymbol TypeofBigInt TypeofFunction TypeofObject TypeofCount )
The results of the typeof operator.
const KindFirstObject = KindHTMLDDA
Every kind from KindFirstObject on is an object in the JavaScript sense.
const MaxArrayIndex = 1<<32 - 2
MaxArrayIndex is the largest array index, 2**32 - 2.
const MaxInlineObjectValues = 16
const MaxPresizedElems = 1024
MaxPresizedElems is the largest length for which ArrayCreate allocates the storage of the elements upfront.
const MaxStringLength = 1<<(27+3*(strconv.IntSize/64)) - 1
MaxStringLength is the largest length a string may have, in bytes. It is smaller where an int has 32 bits.
const MinElems = 4
MinElems is the number of elements that the storage of an array has room for when it is first allocated to add an element.
const MissingKey = 1
MissingKey is the Idx of a query key whose Key has the contents of no property key.
const ObjExclusive = ObjSparse
ObjExclusive marks a string that is the tail of its builder and that nothing refers to but the register of the variable whose append made it, so that the next append to the variable can extend it in place. Its bit is that of ObjSparse, which only objects use.
const ObjReversed = ObjFrozenLength
ObjReversed marks a string whose Text holds its contents with the bytes in reverse order. Its bit is that of ObjFrozenLength, which only arrays and private names use. The byte length, the ASCII-ness and the UTF-16 length of Text are those of the contents, so only a read of the contents themselves needs Object.Str.
const PollChunk = 1 << 20
PollChunk is the number of elements that a bulk copy moves between two checks for an interruption.
const PollInterval = 1 << 16
PollInterval is the number of steps of a loop that runs no JavaScript, such as reading, comparing or storing an element, between two checks for an interruption.
const PrivateShapeThreshold = 128
PrivateShapeThreshold is the number of properties above which an object stops sharing its shape.
SharedElems is the bit of Object.Pinned that marks elements which are the constants of an array literal, shared by the arrays that it made. They have no holes and no room for more elements.
const ValidateExec = false
ValidateExec says whether the interpreter checks the code that it runs, as validate_on.go describes.
Variables ¶
var BigInt64Object = &Object{Kind: KindBigInt, objectTail: &zeroTail}
BigInt64Object is the O of every BigInt that fits in an int64. Every other BigInt is an object of its own holding a *big.Int, so each BigInt has exactly one representation.
var False = Value{O: FalseObject}
False is the value false.
var FalseObject = &Object{Kind: KindFalse, objectTail: &zeroTail}
var Hole = Value{O: HoleObject}
var HoleObject = &Object{Kind: KindHole, objectTail: &zeroTail}
var Null = Value{O: NullObject}
Null is the value null.
var NullObject = &Object{Kind: KindNull, objectTail: &zeroTail}
var NumberObject = &Object{Kind: KindNumber, objectTail: &zeroTail}
var True = Value{O: TrueObject}
True is the value true.
var TrueObject = &Object{Kind: KindTrue, objectTail: &zeroTail}
Functions ¶
func CheckValue ¶
func CheckValue(v Value)
func Clip ¶
Clip returns s, or its longest prefix that ends at a character boundary and leaves room for the suffix within max bytes, followed by the suffix.
func CompareStrings ¶
CompareStrings orders a and b by UTF-16 code units and returns -1, 0, or 1. Both values must be strings.
func CopyBufferBytes ¶
func CopyBufferBytes(dst *ArrayBuffer, dstOffset int, src *ArrayBuffer, srcOffset, n int)
CopyBufferBytes copies n bytes from src at srcOffset to dst at dstOffset, as copy does when the two have the same data block. Both ranges must be within the buffers, which are not detached.
func CopyPolled ¶
CopyPolled is copy for slices that do not overlap, checking for an interruption while it copies many elements.
func DisposableStackState ¶
DisposableStackState returns the state of v when it is a DisposableStack object, or an AsyncDisposableStack object when async is set, and nil otherwise.
func ElementBits ¶
ElementBits returns the encoding of the numeric value v as an element of the type t. v must be a BigInt for a BigInt type and a number otherwise.
func ElementCount ¶
ElementCount returns how many elements the array v holds in memory, holes included, or 0 when v is not an array.
func ErrorStack ¶
ErrorStack returns the stack trace that agent.RecordStack recorded for the error object v. It reports false when v has no [ErrorData] internal slot or no recorded stack trace.
func GoError ¶
GoError returns the Go error that v was made from by ExecutionContext.NewGoError, or nil when it was not.
func IsASCII ¶
IsASCII reports whether s, which is the Value.RawString of v when v is a string, consists of ASCII characters only.
func IsCanonicalNumericString ¶
IsCanonicalNumericString reports whether CanonicalNumericIndexString returns a number for the string key. The array indices are not named keys, so they are not considered.
func IsCompatiblePropertyDescriptor ¶
IsCompatiblePropertyDescriptor implements IsCompatiblePropertyDescriptor. hasCur reports whether the property described by cur exists.
func IsStrictlyEqual ¶
IsStrictlyEqual implements IsStrictlyEqual.
func IteratorState ¶
IteratorState returns the state of the built-in iterator object v, or nil when v is not such an object.
func JoinsPair ¶
JoinsPair reports whether the contents of two strings form a surrogate pair where they meet, so that their bytes do not simply concatenate. x and y are the Value.RawString of the strings, and xr and yr report whether they are reversed.
func NewClosure ¶
NewClosure returns an object with the function state of a new closure of p, whose upvalues are nil, and the storage for its copied upvalues. The object is zero otherwise.
func NewObjectWithStorage ¶
NewObjectWithStorage returns an object without a tail of its own and storage for n values. The object is zero but for its pinned bits. For a small n, both are a single allocation, and the storage may have room for more values.
func NewTailObjectWithStorage ¶ added in v0.2.0
NewTailObjectWithStorage is NewObjectWithStorage for an object with a tail of its own, such as an array.
func NonConfigurableCompatible ¶
NonConfigurableCompatible reports whether ValidateAndApplyPropertyDescriptor accepts d for the existing property described by cur, which is not configurable.
func NumberIndex ¶
NumberIndex returns the array index that the number n stands for as a property key.
func SetDateValue ¶
SetDateValue sets the [[DateValue]] of the Date object v to tv.
func SetValueInBuffer ¶
SetValueInBuffer implements SetValueInBuffer for the bytes b, which hold at least one element of the type t. v must be a BigInt for a BigInt type and a number otherwise.
func ShortStringsJoinPair ¶
ShortStringsJoinPair reports whether the unreversed strings form a surrogate pair at their join.
func StringIndex ¶
StringIndex returns the array index whose canonical string form is s.
func SymbolDescription ¶
SymbolDescription returns the description of the symbol sym and whether it has one.
func TailBuilder ¶
TailBuilder returns the builder whose tail the string o is, or nil.
func TemporalData ¶
TemporalData returns the internal slots of the Temporal object v, or nil when v is not one.
func ThisBooleanValue ¶
ThisBooleanValue implements ThisBooleanValue. It reports false when the specification throws.
func ThisNumberValue ¶
ThisNumberValue implements ThisNumberValue. It reports false when the specification throws.
func ThisTimeValue ¶
ThisTimeValue implements thisTimeValue. It reports false when the specification throws.
func TypedArrayFlags ¶
TypedArrayFlags returns the attributes of the elements of the typed array o.
func TypedArrayHas ¶
TypedArrayHas implements IsValidIntegerIndex for an array index.
func TypedArrayImmutable ¶
TypedArrayImmutable reports whether the buffer of the typed array o is immutable.
func TypedArrayLength ¶
TypedArrayLength returns the length of o, or 0 when o is out of bounds.
func WithoutLast ¶
func WithoutLast[T any](s []T) []T
WithoutLast returns s without its last value, which it clears.
Types ¶
type ArrayBuffer ¶
type ArrayBuffer struct {
// Data is the data block of a buffer that is not shared, and nil for a shared buffer.
Data []byte
Immutable bool
// contains filtered or unexported fields
}
ArrayBuffer is the data block of an ArrayBuffer or SharedArrayBuffer object.
func ArrayBufferData ¶
func ArrayBufferData(v Value) *ArrayBuffer
ArrayBufferData returns the [ArrayBufferData] of v, or nil when v is neither an ArrayBuffer nor a SharedArrayBuffer object.
func (*ArrayBuffer) ByteLength ¶
func (b *ArrayBuffer) ByteLength() int
ByteLength returns the length of b in bytes, which is 0 when b is detached.
func (*ArrayBuffer) Bytes ¶
func (b *ArrayBuffer) Bytes() []byte
Bytes returns the contents of b, or nil when b is shared or detached. The slice stays valid until b is resized or detached, and must not be modified when b is immutable. The bytes of a shared buffer are reached with ArrayBuffer.Lock.
func (*ArrayBuffer) Detach ¶
func (b *ArrayBuffer) Detach()
Detach implements the steps of DetachArrayBuffer that follow its checks: b has no data block afterwards. b must be neither shared nor immutable. Detaching a detached b does nothing.
func (*ArrayBuffer) Grow ¶
func (b *ArrayBuffer) Grow(n int) bool
Grow implements the growing of the growable SharedArrayBuffer b to n bytes, which must not exceed ArrayBuffer.MaxByteLength. It reports false, without changing b, when n is smaller than the length, which another agent may have grown.
func (*ArrayBuffer) HasDetachKey ¶
func (b *ArrayBuffer) HasDetachKey() bool
HasDetachKey reports whether [[ArrayBufferDetachKey]] of b is not empty.
func (*ArrayBuffer) IsDetached ¶
func (b *ArrayBuffer) IsDetached() bool
IsDetached implements IsDetachedBuffer.
func (*ArrayBuffer) IsImmutable ¶
func (b *ArrayBuffer) IsImmutable() bool
IsImmutable implements IsImmutableBuffer.
func (*ArrayBuffer) IsResizable ¶
func (b *ArrayBuffer) IsResizable() bool
IsResizable reports whether b is a resizable ArrayBuffer or a growable SharedArrayBuffer.
func (*ArrayBuffer) IsShared ¶
func (b *ArrayBuffer) IsShared() bool
IsShared implements IsSharedArrayBuffer.
func (*ArrayBuffer) Lock ¶
func (b *ArrayBuffer) Lock() []byte
Lock returns the contents of b. For a shared b, it also keeps the other agents from accessing the data block until ArrayBuffer.Unlock is called. No JavaScript may run and no other shared data block may be locked in between. The slice is valid until then.
func (*ArrayBuffer) MaxByteLength ¶
func (b *ArrayBuffer) MaxByteLength() int
MaxByteLength returns [[ArrayBufferMaxByteLength]] of a resizable or growable b, and its length otherwise.
func (*ArrayBuffer) Resize ¶
func (b *ArrayBuffer) Resize(n int)
Resize changes the length of the resizable b, which is not shared, to n, which must not exceed ArrayBuffer.MaxByteLength. New bytes are zero.
func (*ArrayBuffer) SameDataBlock ¶
func (b *ArrayBuffer) SameDataBlock(c *ArrayBuffer) bool
SameDataBlock reports whether b and c have the same data block.
func (*ArrayBuffer) SharedDataBlock ¶
func (b *ArrayBuffer) SharedDataBlock() *SharedDataBlock
SharedDataBlock returns the data block of the shared buffer b, or nil when b is not shared. Another agent, which may run on another goroutine, creates a SharedArrayBuffer over the block with RealmPart.NewSharedArrayBufferObject.
func (*ArrayBuffer) Unlock ¶
func (b *ArrayBuffer) Unlock()
Unlock ends the access of ArrayBuffer.Lock.
type BigIntObject ¶
type BigIntObject struct {
PropertyObject
Integer big.Int
}
BigIntObject holds a BigInt and its integer header in one allocation.
func (*BigIntObject) InitBigInt ¶ added in v0.2.0
func (o *BigIntObject) InitBigInt(i *big.Int) Value
InitBigInt makes o, which must be zero, the BigInt i, which must not fit in an int64.
type CacheEntry ¶
type CacheEntry struct {
// Shape is the shape of the receiver the entry is valid for.
Shape *Shape
Kind uint8
Slot int32
Holder *Object
// Epoch is the value of [Space.ProtoEpoch] the entry was filled at.
Epoch uint32
Next *Shape
Ref *Value
}
CacheEntry is what an inline cache remembers about one receiver shape.
func (*CacheEntry) AddTo ¶
func (e *CacheEntry) AddTo(o *Object, v Value)
AddTo adds the property that e, an entry that adds one, remembers to o, whose shape is that of e, with the value v.
func (*CacheEntry) OwnValue ¶
func (e *CacheEntry) OwnValue(o *Object) Value
OwnValue returns the value or the accessors that e, an entry for an own property, remembers of o, whose shape is that of e.
func (*CacheEntry) SetInherited ¶
func (e *CacheEntry) SetInherited(s *Shape, kind uint8, epoch uint32)
SetInherited records a lookup that depends on the receiver having no own property of that name.
type ClassElement ¶
type ClassElement struct {
Kind int
Key Value
Val *Object
// Init is the initial value of a field without an initializer function.
Init Value
// Dec is what the decorators of a field add to it, or nil.
Dec *FieldDecoration
// Cache is the shape transition that defining a public field takes.
Cache PropCache
}
ClassElement is an element that the constructor of a class adds to every instance.
type CmpResult ¶
type CmpResult uint8
func CompareInt64Number ¶
CompareInt64Number compares the integer x with the number f.
func CompareInt64s ¶
func CompareNumbers ¶
type CommonKey ¶
type CommonKey uint8
CommonKey identifies a string property key that the engine provides.
const ( KeyLength CommonKey = iota KeyPrototype KeyConstructor KeyName KeyMessage KeyStack KeyCause KeyErrors KeyError KeySuppressed KeyToString KeyValueOf KeyToJSON KeyCall KeyApply KeyBind KeyGet KeySet KeyValue KeyWritable KeyEnumerable KeyConfigurable KeyNext KeyDone KeyReturn KeyThrow KeyThen KeyCallee KeyCaller KeyArguments KeyIndex KeyInput KeyGroups KeyLastIndex KeyRaw KeySource KeyFlags KeyDefault KeyGetPrototypeOf KeySetPrototypeOf KeyIsExtensible KeyPreventExtensions KeyGetOwnPropertyDescriptor KeyDefineProperty KeyHas KeyDeleteProperty KeyOwnKeys KeyConstruct KeyAdd KeyKeys KeySize KeyStatus KeyReason KeyMode KeyPadding KeyToLocaleString KeyToISOString KeyHasIndices KeyGlobal KeyIgnoreCase KeyMultiline KeyDotAll KeyUnicode KeyUnicodeSets KeySticky KeyExec CommonKeyCount )
type ConcatCount ¶
type ConcatCount uint8
ConcatCount counts the concatenations in a row that made a string, each up to BufferAfter: in its low bits those whose left operand was the result of the one before, and from PrependShift on those whose right operand was.
func NextCount ¶
func NextCount(ca, cb ConcatCount) ConcatCount
NextCount returns the ConcatCount of the result of a concatenation without a builder whose left and right operands have the counts ca and cb.
func (ConcatCount) Appends ¶
func (c ConcatCount) Appends() ConcatCount
Appends returns the number of concatenations in a row each onto the result of the one before as its left operand.
func (ConcatCount) Prepends ¶
func (c ConcatCount) Prepends() ConcatCount
Prepends returns the number of concatenations in a row each onto the result of the one before as its right operand.
type DataView ¶
type DataView struct {
// contains filtered or unexported fields
}
DataView is the state of a DataView object.
func DataViewData ¶
DataViewData returns the state of the DataView v, or nil when v is not a DataView.
func (*DataView) ByteLength ¶
ByteLength implements GetViewByteLength. It reports false when the view is out of bounds, which includes a detached buffer.
func (*DataView) ByteOffset ¶
ByteOffset returns [[ByteOffset]] of d.
func (*DataView) Lock ¶
Lock locks the buffer as ArrayBuffer.Lock does and returns the bytes that d views. It reports false when the buffer is detached or d is out of bounds. Always pair Lock with DataView.Unlock. The slice must not be modified when the buffer is immutable.
type Error ¶
type Error struct {
// Value is the thrown value.
Value Value
// contains filtered or unexported fields
}
Error is a JavaScript exception that reached Go.
type ErrorData ¶
type ErrorData struct {
// Pending is set until stack is formatted from Name, Msg and Calls.
Pending bool
// Name in WTF-8 and Msg in UTF-8 begin the stack trace, and Calls are its lines.
Name wtf8.String
Msg string
Calls []StackCall
// GoErr is the Go error that the error object was made from, or nil.
GoErr error
// contains filtered or unexported fields
}
ErrorData is the internal state of an error object that has a recorded stack trace.
type FieldDecoration ¶
type FieldDecoration struct {
// Initializers are the initializers that the decorators returned, in the order they were applied.
Initializers []*Object
// Extra are the initializers that the decorators added with addInitializer.
Extra []*Object
}
FieldDecoration is what the decorators of a field or an auto-accessor add to it.
type FuncProto ¶
type FuncProto struct {
*bytecode.Func
Name wtf8.String
Code []bytecode.Instr
Consts []Value
Keys []*Object
// Caches holds the inline caches, and is nil until a frame of the function is pushed.
Caches []PropCache
Protos []*FuncProto
Templates []TemplateSite
RegExps []RegExpSite
// Ncopied is the number of the upvalues that are copies of the variables, by
// [bytecode.UpvalDesc.ByValue].
Ncopied int
Length int
Nparams int
Nclear int
Nregs int
// ClearFrom is the first register from Nparams on that a new frame clears. The first
// instructions write the registers between Nparams and ClearFrom before anything reads them.
ClearFrom int
Strict bool
IsGenerator bool
IsAsync bool
IsConstructor bool
IsClassConstructor bool
IsDerived bool
NeedsExtra bool
// LegacyCallerArguments says whether the functions have the own properties caller and arguments
// that implementations add to non-strict ordinary functions.
LegacyCallerArguments bool
// Script is the [[ScriptOrModule]] of the functions. Only scriptOrModuleOf reads it.
Script any
// Realm is the [[Realm]] of the functions. Each frame enters the context of the realm of its
// linked code, including a replacement tail frame.
Realm *RealmPart
// ThisReg is the register that the first instruction loads this into, or -1 when the
// first instruction does not load this. ThisSloppy says whether it converts this the way
// a non-strict function sees it.
ThisReg int32
ThisSloppy bool
// HeapRegs says whether the frames of the functions keep their registers in their
// generator instead of on the stack.
HeapRegs bool
// InlineFrames says whether the fast paths of the interpreter loop may push frames of the
// functions: the inline caches exist, and the functions are neither generators, async
// functions nor class constructors.
InlineFrames bool
// ReturnedProperty is the cache for x when the function starts with return this.x.
ReturnedProperty *PropCache
// Globals holds the inline caches of global variables, which Prepare allocates with
// Caches. It comes after the fields that calls read.
Globals []GlobalCache
// contains filtered or unexported fields
}
FuncProto is the compiled code of a function in the form the interpreter runs, shared by all closures made from it.
func (*FuncProto) ClosurePrototype ¶
ClosurePrototype returns the prototype of the closures of p, which is a generator or async function.
func (*FuncProto) FirstCleared ¶
FirstCleared returns the first register that a new frame of p for argc arguments clears.
type Function ¶
type Function struct {
// Code is the compiled code of a function written in JavaScript.
Code *FuncProto
// Upvals are the variables of enclosing functions that Code refers to.
Upvals []*Upvalue
// Info describes a native function. It is nil for any other function.
Info *NativeInfo
Bound *BoundFunc
// Home is the object that super property accesses in a method start from.
Home *Object
// Fields are the elements that a class constructor adds to every instance, or nil when
// there are none.
Fields *[]ClassElement
// Materialized is set once the initial properties, such as length and name, exist as slots.
Materialized bool
// Constructor says whether the function can be called with new.
Constructor bool
// Derived marks the constructor of a class with an extends clause.
Derived bool
// ClassConstructor marks a function that throws when called without new.
ClassConstructor bool
// Scopes points to the dynamic scopes that were open where the function was created,
// innermost last, or is nil when none were.
Scopes *[]*Object
// contains filtered or unexported fields
}
Function is the state of a callable object.
func (*Function) CapturedScopes ¶
CapturedScopes returns the dynamic scopes that were open where f was created, innermost last.
func (*Function) ChangeableInfo ¶
func (f *Function) ChangeableInfo() *NativeInfo
ChangeableInfo returns the description of the native function f, which must not be a proxy, for changing it.
func (*Function) Frameless ¶
Frameless reports whether f, which may be nil, is a native function whose calls show no frame.
func (*Function) NativeName ¶
NativeName returns the initial value of the property name of the native function f.
type GlobalCache ¶
GlobalCache is the inline cache of an instruction that accesses a global variable. Holder is the global object of the realm, or nil. While its shape matches, the binding exists. A resolution caches existence alone. Reads and writes also cache the initialized slot in Ref, and writes only cache writable bindings.
Declaring a global lexical binding or invalidating a cached global slot changes the global object's shape.
func (*GlobalCache) Remember ¶
func (c *GlobalCache) Remember(global, holder *Object, p Prop)
Remember records that a binding of the realm with the global object global is p of holder, which is global or the global lexical bindings.
type InterruptSignal ¶
type InterruptSignal struct {
// Cause is the cause of the interruption.
Cause error
}
InterruptSignal is what an interruption unwinds Go frames with. No JavaScript code can catch it.
type Intrinsic ¶
type Intrinsic uint8
Intrinsic identifies an intrinsic object.
const ( IntrinsicObjectPrototype Intrinsic = iota IntrinsicFunctionPrototype IntrinsicArrayPrototype IntrinsicStringPrototype IntrinsicNumberPrototype IntrinsicBooleanPrototype IntrinsicSymbolPrototype IntrinsicBigIntPrototype IntrinsicIteratorPrototype IntrinsicAsyncIteratorPrototype IntrinsicArrayIteratorPrototype IntrinsicStringIteratorPrototype IntrinsicMapIteratorPrototype IntrinsicSetIteratorPrototype IntrinsicRegExpStringIteratorPrototype IntrinsicIteratorHelperPrototype IntrinsicWrapForValidIteratorPrototype IntrinsicGeneratorPrototype IntrinsicAsyncGeneratorPrototype IntrinsicGeneratorFunctionPrototype IntrinsicAsyncFunctionPrototype IntrinsicAsyncGeneratorFunctionPrototype IntrinsicRegExpPrototype IntrinsicPromisePrototype IntrinsicMapPrototype IntrinsicSetPrototype IntrinsicDatePrototype IntrinsicArrayBufferPrototype IntrinsicDataViewPrototype IntrinsicWeakMapPrototype IntrinsicWeakSetPrototype IntrinsicWeakRefPrototype IntrinsicFinalizationRegistryPrototype IntrinsicDisposableStackPrototype IntrinsicAsyncDisposableStackPrototype IntrinsicShadowRealmPrototype IntrinsicAbstractModuleSourcePrototype IntrinsicPromise IntrinsicArray IntrinsicObject IntrinsicFunction IntrinsicRegExp IntrinsicIterator IntrinsicArrayBuffer IntrinsicAbstractModuleSource IntrinsicTemporal IntrinsicIntl IntrinsicIntlDateTimeFormat IntrinsicIntlNumberFormat IntrinsicIntlSegmentsPrototype IntrinsicIntlSegmentIteratorPrototype // The Temporal namespace initializes this range of prototypes. IntrinsicTemporalInstantPrototype IntrinsicTemporalDurationPrototype IntrinsicTemporalPlainDatePrototype IntrinsicTemporalPlainTimePrototype IntrinsicTemporalPlainDateTimePrototype IntrinsicTemporalPlainYearMonthPrototype IntrinsicTemporalPlainMonthDayPrototype IntrinsicTemporalZonedDateTimePrototype // The Intl namespace initializes this range of prototypes. IntrinsicIntlCollatorPrototype IntrinsicIntlDateTimeFormatPrototype IntrinsicIntlDisplayNamesPrototype IntrinsicIntlDurationFormatPrototype IntrinsicIntlListFormatPrototype IntrinsicIntlLocalePrototype IntrinsicIntlNumberFormatPrototype IntrinsicIntlPluralRulesPrototype IntrinsicIntlRelativeTimeFormatPrototype IntrinsicIntlSegmenterPrototype // The prototypes of the native error types are in the order of engine.ErrorKind. IntrinsicErrorPrototype IntrinsicTypeErrorPrototype IntrinsicRangeErrorPrototype IntrinsicReferenceErrorPrototype IntrinsicSyntaxErrorPrototype IntrinsicEvalErrorPrototype IntrinsicURIErrorPrototype IntrinsicAggregateErrorPrototype IntrinsicSuppressedErrorPrototype IntrinsicThrowTypeError // The getters of the caller and arguments properties of non-strict ordinary functions. IntrinsicFunctionCallerGetter IntrinsicFunctionArgumentsGetter // The typed array constructors are in the order of [element.Type]. IntrinsicInt8Array IntrinsicUint8Array IntrinsicUint8ClampedArray IntrinsicInt16Array IntrinsicUint16Array IntrinsicInt32Array IntrinsicUint32Array IntrinsicFloat16Array IntrinsicFloat32Array IntrinsicFloat64Array IntrinsicBigInt64Array IntrinsicBigUint64Array // The prototypes of the typed array constructors are in the order of [element.Type]. IntrinsicInt8ArrayPrototype IntrinsicUint8ArrayPrototype IntrinsicUint8ClampedArrayPrototype IntrinsicInt16ArrayPrototype IntrinsicUint16ArrayPrototype IntrinsicInt32ArrayPrototype IntrinsicUint32ArrayPrototype IntrinsicFloat16ArrayPrototype IntrinsicFloat32ArrayPrototype IntrinsicFloat64ArrayPrototype IntrinsicBigInt64ArrayPrototype IntrinsicBigUint64ArrayPrototype // The initial values of these functions are what the engine treats specially. IntrinsicFunctionPrototypeCall IntrinsicFunctionPrototypeApply IntrinsicEval IntrinsicFunctionPrototypeHasInstance IntrinsicArrayPrototypeValues IntrinsicArrayIteratorPrototypeNext IntrinsicArraySpeciesGetter IntrinsicTypedArrayPrototypeLengthGetter IntrinsicGeneratorPrototypeNext // The initial values of these functions are what the built-ins treat specially. IntrinsicRegExpPrototypeExec IntrinsicMapPrototypeSet IntrinsicMapPrototypeEntries IntrinsicMapIteratorPrototypeNext IntrinsicSetPrototypeAdd IntrinsicSetPrototypeHas IntrinsicSetPrototypeValues IntrinsicSetIteratorPrototypeNext IntrinsicWeakMapPrototypeSet IntrinsicWeakSetPrototypeAdd // The functions that the engine calls. IntrinsicJSONParse )
type Kind ¶
type Kind uint8
const ( KindUndefined Kind = iota KindNumber KindNull KindFalse KindTrue KindString KindSymbol KindBigInt // KindHole is the content of an array element that does not exist. It never reaches JavaScript. KindHole // KindAccessor is the content of the slot of an accessor property. It never reaches JavaScript. KindAccessor // KindHTMLDDA is an object with the [[IsHTMLDDA]] internal slot (B.3.6). // It comes before KindObject, so that a check for KindObject or above excludes it. KindHTMLDDA KindObject KindArray KindFunction )
type NamedLookup ¶
func (NamedLookup) Length ¶
func (r NamedLookup) Length(receiver Value) Value
type Native ¶
type Native struct {
Index uint16
// FastIndex is the index of what callers use instead of calling the function, or 0.
FastIndex uint8
}
Native identifies a registered native function. The zero value identifies none.
type NativeInfo ¶
type NativeInfo struct {
// Native is the native function.
Native Native
// Name and Length are the initial values of the properties name and length.
Name wtf8.String
Length int32
// Extremum says that the function is Math.min or Math.max, which the interpreter computes
// for two numbers.
Extremum Extremum
// Frameless says that calls of the function show no frame, as agent.SetFrameless describes.
Frameless bool
// Prototype is the intrinsic of Realm that the property prototype of the function holds,
// when FixedPrototype is set. The property can then be neither changed nor deleted.
Prototype Intrinsic
FixedPrototype bool
// Realm is the [[Realm]] of the function, or nil for a proxy.
Realm *RealmPart
}
NativeInfo is the description of a native function.
var ProxyInfo NativeInfo
ProxyInfo describes every callable proxy. It must not be modified.
type Object ¶
type Object struct {
Kind Kind
Class class
// Pinned holds the pinned bits of the storage of slots and elems, and [SharedElems]. A string,
// which has neither, holds its [ConcatCount] there instead.
Pinned uint8
// contains filtered or unexported fields
}
Object is every heap value: plain objects, arrays, functions, strings, symbols, and the singletons.
func NewArray ¶
NewArray returns a new array with the shape s and the given elements, which it keeps.
func NewExoticObject ¶
NewExoticObject is NewObjectWithState for an object whose named properties cannot be found by looking at its shape alone.
func NewFunctionObject ¶
NewFunctionObject returns a new function object with the shape s and the function state fn, whose initial properties are implicit (see RealmPart.FunctionShapeFor).
func NewGlobalObject ¶
NewGlobalObject returns a new object for global bindings with the shape s and room for n properties. The inline caches of global variables point into its slots.
func NewInstance ¶
NewInstance returns a new empty ordinary object with the shape s, with room for the properties that the objects with s have been given one after another so far, and for some more when they went on with different properties.
func NewMarker ¶
NewMarker returns a new value with the internal state state that never reaches JavaScript.
func NewNamespaceObject ¶
NewNamespaceObject is NewExoticObject for a module namespace object, which is not extensible.
func NewObjectWithState ¶
NewObjectWithState returns a new object with the shape s, the class c and the internal state state, and no properties.
func NewPrivateName ¶
NewPrivateName returns a new private name whose description is desc.
func NewProxyObject ¶
func NewProxyObject(s *Shape, state *ProxyState, fn *Function) *Object
NewProxyObject is NewExoticObject for a proxy, whose [[Call]] and [[Construct]] are fn. fn is nil for a proxy that is not callable.
func NewRegExpObject ¶
func NewRegExpObject(s *Shape, state *RegExpState) *Object
NewRegExpObject returns a new RegExp object with the shape s, whose only property is lastIndex, and the internal state state.
func ThisSymbolValue ¶
ThisSymbolValue implements ThisSymbolValue. It reports false when the specification throws.
func (*Object) AppendElem ¶
AppendElem appends v to the elements of o.
func (*Object) AppendSlot ¶
AppendSlot appends v to the slots of o.
func (*Object) ArrayIndex ¶
ArrayIndex returns the array index whose canonical string form is the string o.
func (*Object) ClearBuilder ¶ added in v0.2.0
func (o *Object) ClearBuilder()
ClearBuilder records that the string o is no longer the tail or the head of a builder.
func (*Object) CodePointAt ¶
CodePointAt returns the code point starting at UTF-16 index i. i must be in range.
func (*Object) CreationRealm ¶
func (*Object) DelegatesPropertyAccess ¶
DelegatesPropertyAccess reports whether a lookup must use the object's property operations even when its storage has no matching key.
func (*Object) ElemRoom ¶
ElemRoom returns how many elements the storage of the elements of o has room for.
func (*Object) ElementList ¶
ElementList returns a copy of the elements of the array o when reading them cannot run any JavaScript.
func (*Object) ElemsResizable ¶
ElemsResizable is elemsComplete and elemsChangeable.
func (*Object) ElemsStorage ¶
ElemsStorage returns the number of values that the storage of the elements of o has room for, counting those before the elements that removing the first elements left unused.
func (*Object) ExtConcatCount ¶
func (o *Object) ExtConcatCount() ConcatCount
ExtConcatCount returns the concatenation count of the string o, or 0.
func (*Object) ExtObject ¶
ExtObject returns the object in the internal state of o, and reports whether there is one.
func (*Object) ExtendExclusive ¶ added in v0.2.0
ExtendExclusive makes the string o, which is marked ObjExclusive and was the tail of sb, hold the contents of sb after strings were appended to them. ascii reports whether the appended strings are ASCII.
func (*Object) FreezeLength ¶
func (o *Object) FreezeLength()
FreezeLength makes the length of the array o read-only.
func (*Object) GrowLength ¶
GrowLength makes the length of the array o n, which is greater.
func (*Object) HasElement ¶
HasElement reports whether o holds an element, checking for an interruption while it looks at many.
func (*Object) HasElementAt ¶
HasElementAt reports whether o, which must have property storage, holds the element i.
func (*Object) HasOwnMethod ¶
HasOwnMethod is quiet.Context.HasOwnMethod.
func (*Object) HasProperties ¶
HasProperties reports whether o has property storage, which primitive values lack.
func (*Object) HolesAreAbsent ¶
HolesAreAbsent reports whether o is an array, and an array index that it does not store is absent from it and its prototypes, and finding that out runs no JavaScript. An array marked ObjSparse stores some indices in its shape.
func (*Object) HostDefined ¶
HostDefined returns the host-defined value of the agent that owns o, or nil for shared values.
func (*Object) IndicesInElements ¶
IndicesInElements reports whether elems accounts for all own indexed properties.
func (*Object) InheritsMethod ¶
InheritsMethod is quiet.Context.InheritsMethod.
func (*Object) InheritsNoIndex ¶
InheritsNoIndex reports whether no prototype of o has a property with an array index, and looking for one runs no JavaScript. It says nothing about o itself.
func (*Object) InitBinding ¶
InitBinding sets the value of the binding key of the global lexical bindings o.
func (*Object) IsRegExpObject ¶
IsRegExpObject reports whether o is a RegExp object.
func (*Object) KnownArrayIndex ¶
KnownArrayIndex returns the array index that the string o stands for, if it is known already. It reports false otherwise, even when o is an array index.
func (*Object) MakeHTMLDDA ¶
func (o *Object) MakeHTMLDDA()
MakeHTMLDDA gives the function object o the internal slot [[IsHTMLDDA]].
func (*Object) MakeNonExtensible ¶
func (o *Object) MakeNonExtensible()
MakeNonExtensible makes o refuse new properties.
func (*Object) MakePrivate ¶
func (o *Object) MakePrivate()
MakePrivate gives o a shape of its own, so that no inline cache filled for another object applies to it.
func (*Object) MarkExclusive ¶ added in v0.2.0
func (o *Object) MarkExclusive()
MarkExclusive marks the string o, a new tail that only the register of a variable refers to, ObjExclusive.
func (*Object) Meta ¶
func (o *Object) Meta() *ObjectMeta
Meta returns the side data of o, or nil when it has none.
func (*Object) MoveElemsTo ¶
MoveElemsTo moves the elements of o to new storage with room for room elements in all.
func (*Object) OwnFunction ¶
OwnFunction gives o its own function state before an instance-specific change.
func (*Object) PlainElems ¶
PlainElems returns the elements of o, which the caller must not modify, when o is an array whose elements can be read without running any JavaScript. o may be nil.
func (*Object) PushElement ¶
PushElement appends v to the elements of the array o and sets its length.
func (*Object) RegExpLegacyFeaturesEnabled ¶
RegExpLegacyFeaturesEnabled implements the [[LegacyFeaturesEnabled]] slot of the RegExp object o: whether o was created for the RegExp constructor itself.
func (*Object) RegExpMatcher ¶
RegExpMatcher returns the compiled pattern of the RegExp object o, or nil when o is not a RegExp object.
func (*Object) RegExpOriginal ¶
RegExpOriginal returns the original source and flags of the RegExp object o.
func (*Object) RemoveFirstElement ¶
RemoveFirstElement removes the first element of the array o and returns it. It reports false and does nothing when o is empty or needs the generic algorithm.
func (*Object) RemoveLastElement ¶
RemoveLastElement removes the last element of the array o and returns it. It reports false and does nothing when o is empty or needs the generic algorithm.
func (*Object) RenewRegExp ¶
RenewRegExp makes the RegExp object o like a new one whose shape is s.
func (*Object) RenewShape ¶
func (o *Object) RenewShape()
RenewShape gives o a private shape with the properties of its shape, which no inline cache has seen.
func (*Object) ReserveElems ¶
ReserveElems gives the elements of o room for n more elements.
func (*Object) ReserveSlots ¶
ReserveSlots gives the slots of o room for n more values.
func (*Object) SetArrayIndex ¶
SetArrayIndex records that the string o stands for the array index i.
func (*Object) SetElement ¶
SetElement stores v as the own property of o with the integer index i when Element returns that property, o is not a typed array and its elements are not shared (see SharedElems), and reports whether it did.
func (*Object) SetExtState ¶
SetExtState sets the internal state of o to v.
func (*Object) Shape ¶
Shape returns the layout of the slots of o, or nil for the singletons and internal values.
func (*Object) Share ¶ added in v0.2.0
func (o *Object) Share()
Share clears ObjExclusive of the string o.
func (*Object) SourceText ¶
SourceText returns the result of Function.prototype.toString for the function f.
func (*Object) StartMaterialized ¶
StartMaterialized makes the function o, which has no properties, one with the shape s and no implicit properties, and returns its state.
func (*Object) StoreData ¶
StoreData stores v in p, an own property of o, and reports whether p is a writable data property.
func (*Object) StoreElement ¶
StoreElement stores v, which can be a hole, as the element i of o. HasElementAt must report true for i.
func (*Object) StoreMapped ¶
StoreMapped stores v in p, an index property of the arguments object o that maps to a parameter.
func (*Object) StringLength ¶
StringLength returns the length of the string o in UTF-16 code units.
func (*Object) Substring ¶
Substring returns the code units from start up to end of the string o. The indices must be in range and in order.
func (*Object) TakeDataProperties ¶
TakeDataProperties gives the empty ordinary object dst the properties of from and reports true when creating them on dst one by one would give dst the shape and the elements of from. Otherwise it does nothing and reports false.
func (*Object) Text ¶
Text returns the content of a string or the description of a symbol. A string marked ObjReversed holds its bytes in reverse order. Packed-string sentinels use zero bytes to carry only the byte length. Text is empty for the other primitive values, and o must not be an object.
func (*Object) UnitIndexOf ¶
UnitIndexOf returns the index in code units of the first occurrence of sub in the string o at or after from, or -1. poll, which may be nil, is called now and then during a long search.
func (*Object) UnitLastIndexOf ¶
UnitLastIndexOf returns the index in code units of the last occurrence of sub in the string o that starts at or before from, or -1. poll is as for Object.UnitIndexOf.
type ObjectMeta ¶
type ObjectMeta struct {
// Length and Cursor are the cached UTF-16 view of a string that is not ASCII:
// its length, or 0 before it is known, and the position of the most recent access.
// Only a string of at most MaxStringLength bytes has them, so they fit in 32 bits.
Length int32
Cursor stringPos
// Ext is the internal state of the object that has this side data.
Ext any
// contains filtered or unexported fields
}
ObjectMeta is the side data that few objects need: what indexing a non-ASCII string needs, the entries in weak collections of an object or a symbol, the empty shapes of the objects whose prototype is this object, and the room that removing the first elements of an array left.
type Poller ¶
type Poller struct {
InterruptFlag interruptFlag
// InterruptCause is the cause of the pending interruption.
InterruptCause atomic.Pointer[error]
// Raised is the interruption that is unwinding to the outermost call from Go.
Raised *InterruptSignal
}
Poller is what a long operation needs to stop at an interruption.
func (*Poller) CopyDenseElements ¶
CopyDenseElements returns a copy of the elements of the array o when none of them is missing.
func (*Poller) Poll ¶
func (p *Poller) Poll()
Poll is agent.Poll without taking notifications. It leaves the flag set, so that the next Poll of the agent takes them.
func (*Poller) PollYield ¶
func (p *Poller) PollYield()
PollYield does nothing, as the other goroutines run without waiting for a yield.
func (*Poller) Raise ¶
func (p *Poller) Raise()
Raise panics with the pending interruption, if there is one.
func (*Poller) ResumeInterruption ¶
func (p *Poller) ResumeInterruption()
ResumeInterruption panics again with an interruption that a host callback recovered before the interruption reached the outermost call from Go.
func (*Poller) TruncateElements ¶
TruncateElements removes the elements of the array o from n on and sets its length to n.
type PropCache ¶
type PropCache struct {
CacheEntry
Second CacheEntry
Reads *namedReads
}
PropCache holds two inline entries for a property access site and records additional receiver shapes for named reads.
func (*PropCache) Entry ¶
func (c *PropCache) Entry(s *Shape) *CacheEntry
Entry returns the inline entry for s, or nil on a miss.
func (*PropCache) Keep ¶
Keep saves the current entry before c is filled for shape. It reports whether this displaces an entry for a third distinct shape.
func (*PropCache) RememberAbsent ¶
RememberAbsent records that a receiver with the shape s has no property of the name.
type PropDesc ¶
type PropDesc struct {
// contains filtered or unexported fields
}
PropDesc is a property descriptor.
func AccessorDesc ¶
AccessorDesc returns the descriptor of an accessor property with the content a of its slot and the attributes flags, which include FlagAccessor.
func (*PropDesc) Complete ¶
func (d *PropDesc) Complete()
Complete implements CompletePropertyDescriptor. It also marks an accessor descriptor with FlagAccessor, as the descriptors of existing properties are.
func (*PropDesc) Configurable ¶
Configurable reports the [[Configurable]] field of d, which is false when absent.
func (*PropDesc) Enumerable ¶
Enumerable reports the [[Enumerable]] field of d, which is false when absent.
func (*PropDesc) FieldCount ¶
FieldCount returns the number of fields of d that are present.
func (*PropDesc) Getter ¶
Getter returns the [[Get]] field of the accessor descriptor d, or nil when it is undefined.
func (*PropDesc) HasFalse ¶
HasFalse reports whether the field has of d, for the attribute flag, is present and false.
func (*PropDesc) HasTrue ¶
HasTrue reports whether the field has of d, for the attribute flag, is present and true.
func (*PropDesc) IsAccessor ¶
IsAccessor implements IsAccessorDescriptor.
func (*PropDesc) KeepsData ¶
KeepsData reports whether d redefines the existing data property described by cur as a data property.
func (*PropDesc) NewAccessorProperty ¶
NewAccessorProperty returns the content of the slot and the attributes of the new accessor property that d, which is an accessor descriptor, defines.
func (*PropDesc) NewData ¶
NewData returns the value and the attributes of the new data property that d, which is no accessor descriptor, defines.
func (*PropDesc) RedefinedData ¶
RedefinedData returns the value and the attributes that the existing data property described by cur has once d, for which KeepsData holds, redefined it.
func (*PropDesc) RedefinedProperty ¶
RedefinedProperty returns the content of the slot and the attributes that the existing property described by cur has once d, for which KeepsData does not hold, redefined it.
func (*PropDesc) SetConfigurable ¶
SetConfigurable sets the [[Configurable]] field of d to b.
func (*PropDesc) SetEnumerable ¶
SetEnumerable sets the [[Enumerable]] field of d to b.
func (*PropDesc) SetGetter ¶
SetGetter sets the [[Get]] field of d to f, where nil stands for undefined.
func (*PropDesc) SetSetter ¶
SetSetter sets the [[Set]] field of d to f, where nil stands for undefined.
func (*PropDesc) SetWritable ¶
SetWritable sets the [[Writable]] field of d to b.
func (*PropDesc) Setter ¶
Setter returns the [[Set]] field of the accessor descriptor d, or nil when it is undefined.
type PropKey ¶
PropKey is a property key: an array index when Key is nil, otherwise an interned string or a symbol.
func AppendElemRun ¶
AppendElemRun appends the keys of the elements of o from start to end to keys.
func AppendEnumerableNames ¶
AppendEnumerableNames appends the enumerable string keys among names, which are keys of the private shape s, to keys.
func AppendIndexRun ¶
AppendIndexRun appends the keys of the indices from i up to j to keys.
func EnumerableKey ¶
EnumerableKey returns key as a property key when it is a string and flags make it enumerable, and the zero PropKey otherwise.
type PropertyObject ¶
type PropertyObject struct {
Object
// contains filtered or unexported fields
}
PropertyObject keeps an object's header and its tail in one allocation, for the objects that have elements, function state or internal state.
func (*PropertyObject) Init ¶
func (o *PropertyObject) Init() *Object
func (*PropertyObject) InitExotic ¶
func (o *PropertyObject) InitExotic(s *Shape, c class, state any) *Object
InitExotic makes o, which must be zero, what NewExoticObject returns.
func (*PropertyObject) InitFunction ¶
func (o *PropertyObject) InitFunction(s *Shape, fn *Function, state any) *Object
InitFunction makes o, which must be zero, what NewFunctionObject returns, with the internal state state.
func (*PropertyObject) InitMaterializedFunction ¶
func (o *PropertyObject) InitMaterializedFunction(s *Shape, fn *Function, room []Value) *Object
InitMaterializedFunction makes o, which must be zero, a function object with the shape s and the function state fn, none of whose properties are implicit. room, which is in the allocation of o, is the storage of its properties.
func (*PropertyObject) InitWithState ¶
func (o *PropertyObject) InitWithState(s *Shape, c class, state any) *Object
InitWithState makes o, which must be zero, what NewObjectWithState returns.
type ProxyState ¶
ProxyState holds the internal slots of a proxy object. A detached global proxy has a nil target. A revoked proxy has both slots nil.
func (*ProxyState) AllowsGlobalAccess ¶
func (s *ProxyState) AllowsGlobalAccess(group *Object) bool
func (*ProxyState) IsGlobal ¶
func (s *ProxyState) IsGlobal() bool
type QueryKey ¶
type QueryKey struct {
// Key and Idx are as in [PropKey], except that Key is not interned when Idx is MissingKey.
Key *Object
Idx uint32
}
QueryKey is a property key for an operation that only reads properties. It may be a string that no property key has.
type Raw ¶
type Raw struct {
// contains filtered or unexported fields
}
Raw gives access to the property storage of an object without the checks of the property operations. Only the interpreter loop uses it.
func (Raw) ElemsShared ¶ added in v0.2.0
ElemsShared reports whether the elements are shared with other arrays, so that storing one needs the property operations.
func (Raw) ExtendElems ¶
ExtendElems makes the first n values of the storage of the elements the elements. The storage must have room for them, and the caller must store each new element before reading it.
func (Raw) ExtendSlots ¶
ExtendSlots makes the first n values of the storage of the slots the slots. The storage must have room for them.
type RealmPart ¶
type RealmPart struct {
Intrinsics [intrinsicCount]*Object
Shapes shapeTable
ArrayIter arrayIterCache
Global *Object
// GlobalThis is the global this value, which a host can set to a global proxy.
GlobalThis *Object
// GlobalLex holds the top-level let, const and class declarations.
GlobalLex *Object
// ObjectTagStrings are results of Object.prototype.toString, by tag.
ObjectTagStrings map[wtf8.String]Value
// StrictCallee is the callee property of unmapped arguments objects, or the zero value
// until it is needed.
StrictCallee Value
// RegExpFlagStrings holds the value of the flags getter for each set of the 8 flags, once
// computed. It is nil until it is needed.
RegExpFlagStrings *[1 << 8]Value
// AsyncFromSyncProto is %AsyncFromSyncIteratorPrototype%, or nil until it is needed.
AsyncFromSyncProto *Object
LegacyRegExp legacyRegExpStatics
// Space is the space of the agent of the realm.
*Space
// Owner is the execution context of the realm. Only executionContextOf and the
// interpreter loop read it.
Owner any
// contains filtered or unexported fields
}
RealmPart is the storage state of a realm, which the realm embeds.
func (*RealmPart) AddIndex ¶
AddIndex creates the data property with the array index i on o, which has no such own property. It reports false when o does not allow it.
func (*RealmPart) AddMappedElement ¶
AddMappedElement adds the element i of the arguments object o, which it holds, as an index property that maps to a parameter.
func (*RealmPart) AppendElements ¶
AppendElements is quiet.Context.AppendElements.
func (*RealmPart) AppendElementsOf ¶
AppendElementsOf is quiet.Context.AppendElementsOf.
func (*RealmPart) ArrayCreate ¶
ArrayCreate implements ArrayCreate.
func (*RealmPart) ArrayCtorPlain ¶
ArrayCtorPlain reports whether creating the result of a method for the array o makes a plain array, because o has the original constructor.
func (*RealmPart) ArrayIterationPlain ¶
ArrayIterationPlain reports whether o uses the original array values and next methods. Reading an element can still invoke a getter.
func (*RealmPart) ArrayProtoPlain ¶
ArrayProtoPlain is Object.InheritsNoIndex for the objects whose prototype is %Array.prototype%, except that it also reports false when %Object.prototype% does not follow in the prototype chain.
%Array.prototype% is an array and %Object.prototype% an ordinary object from the start, neither of which can become exotic later.
func (*RealmPart) AssignDataProperties ¶
AssignDataProperties is quiet.Context.AssignDataProperties.
func (*RealmPart) CheckNoIteratorReturn ¶
func (r *RealmPart) CheckNoIteratorReturn()
func (*RealmPart) CodePointsToString ¶
CodePointsToString returns the string value of points, code points that may be surrogates.
func (*RealmPart) CopyElementRange ¶
CopyElementRange is quiet.Context.CopyElementRange.
func (*RealmPart) CreateIterResultObject ¶
CreateIterResultObject creates an iterator result in the realm r.
func (*RealmPart) Define ¶
Define creates or replaces the own named property key of o with the given attributes, without any of the checks of the JavaScript operations. An object of ExecutionContext.NewLazyObject must be initialized already.
func (*RealmPart) DefineAccessor ¶
DefineAccessor creates or replaces the own accessor property key of o with the given attributes. getter and setter may be nil.
func (*RealmPart) DefineMatchResultProperties ¶
DefineMatchResultProperties creates the data properties index, input and groups of a match result on a, in that order, as CreateDataPropertyOrThrow does. a must be an array from RealmPart.NewArrayWithRoom that has no named properties.
func (*RealmPart) DefineMatchResultPropertiesWithIndices ¶
func (r *RealmPart) DefineMatchResultPropertiesWithIndices(a *Object, index, input, groups, indices Value)
DefineMatchResultPropertiesWithIndices is like RealmPart.DefineMatchResultProperties and creates the data property indices after groups.
func (*RealmPart) FillElements ¶
FillElements is quiet.Context.FillElements.
func (*RealmPart) FunctionShapeFor ¶
FunctionShapeFor returns the root for functions whose initial named properties are still implicit.
func (*RealmPart) GetVWithoutCall ¶
GetVWithoutCall is quiet.Context.GetVWithoutCall. It fills c, which may be nil, when the lookup can be repeated from the cache.
func (*RealmPart) HasOwnPropertyPlain ¶
HasOwnPropertyPlain is HasOwnProperty of o and the key k when finding out neither throws nor runs code, and takes a short time. It reports false as ok otherwise.
func (*RealmPart) IndexName ¶
IndexName returns the key under which the array index i is stored in a shape.
func (*RealmPart) InheritsHasInstance ¶
InheritsHasInstance reports whether the @@hasInstance property of c is the one that it inherits from %Function.prototype% of r. A false result does not mean the opposite.
func (*RealmPart) InitShortStrings ¶
func (r *RealmPart) InitShortStrings()
InitShortStrings creates the sentinels of short strings with the shape of strings.
func (*RealmPart) Intrinsic ¶
Intrinsic returns the intrinsic object id of r, or nil before it is set.
func (*RealmPart) JoinStrings ¶
JoinStrings is quiet.Context.JoinStrings.
func (*RealmPart) KeyOfString ¶
KeyOfString returns the property key for the string s. It does not keep s.
func (*RealmPart) Lookup ¶
func (r *RealmPart) Lookup(o *Object, key *Object) NamedLookup
Lookup finds the named property key on o and its prototype chain.
func (*RealmPart) LookupDataSlot ¶
LookupDataSlot returns the named data slot on o or its prototypes, or a zero slot if the lookup cannot establish one without running code.
func (*RealmPart) Materialize ¶
Materialize creates the properties that a function has from the start but that are only stored once something looks at them.
func (*RealmPart) NewArgumentsObject ¶
NewArgumentsObject returns an arguments object of args followed by extra, without its callee.
func (*RealmPart) NewArrayBufferFromBytes ¶
NewArrayBufferFromBytes returns an ArrayBuffer with the prototype proto whose data is b, which it keeps. maxByteLength is -1 for a buffer whose length is fixed and must not be smaller than len(b) otherwise.
func (*RealmPart) NewArrayCopy ¶
NewArrayCopy returns a new array with a copy of elems as its elements.
func (*RealmPart) NewArrayOfConstants ¶ added in v0.2.0
NewArrayOfConstants returns a new array of the constants in run, the linked constants of an array literal, which no other code uses. The first call stores an array of them in run[0] and clears the rest of run. The returned arrays share its elements until their own change.
func (*RealmPart) NewArrayPair ¶
NewArrayPair returns a new array with the elements a and b.
func (*RealmPart) NewArrayWithRoom ¶
NewArrayWithRoom returns an array of length undefined elements with room for n named properties.
func (*RealmPart) NewBufferedString ¶
func (r *RealmPart) NewBufferedString(s wtf8.String, flags uint8, builder any, meta *ObjectMeta) Value
NewBufferedString returns a string with its builder, a *strings.Builder or, for a string marked ObjReversed, a *ReversedBuilder, and optional UTF-16 metadata.
func (*RealmPart) NewConcatenatedString ¶
func (r *RealmPart) NewConcatenatedString(s wtf8.String, count ConcatCount) Value
NewConcatenatedString returns the string s, which is longer than a short string, with the concatenation count count.
func (*RealmPart) NewDataViewObject ¶
func (r *RealmPart) NewDataViewObject(proto *Object, buffer *Object, byteOffset, byteLength int) *Object
NewDataViewObject returns a DataView with the prototype proto on the buffer object buffer from byteOffset on. byteLength is -1 for a view whose length tracks the length of the buffer.
func (*RealmPart) NewElementsPlain ¶
NewElementsPlain reports whether storing a new element in the array o defines it as an own data property without consulting a prototype, when o accepts it.
func (*RealmPart) NewEmptyArrayWithRoom ¶
NewEmptyArrayWithRoom returns a new empty array with room for n elements.
func (*RealmPart) NewEmptyObjectWithRoom ¶
NewEmptyObjectWithRoom returns a new empty ordinary object whose prototype is %Object.prototype%, with room for n properties.
func (*RealmPart) NewHostArrayBufferObject ¶
NewHostArrayBufferObject returns an ArrayBuffer of fixed length with the prototype proto whose data block is b, which it keeps. Its [[ArrayBufferDetachKey]] is set, so that only the host detaches it. len(b) must not exceed the largest length of a buffer.
func (*RealmPart) NewImmutableArrayBufferFromBytes ¶
NewImmutableArrayBufferFromBytes returns an immutable ArrayBuffer with the prototype proto whose data is b, which it keeps. b must not be modified afterwards.
func (*RealmPart) NewObject ¶
NewObject returns a new empty object with the prototype proto, which may be nil.
func (*RealmPart) NewObjectFromProperties ¶
NewObjectFromProperties returns a new ordinary object whose prototype is Object.prototype, with the data properties keys[i]: vals[i] created in order as CreateDataProperty creates them. A repeated key keeps its first position and takes the last value. It does not keep the slices.
func (*RealmPart) NewSharedArrayBufferObject ¶
func (r *RealmPart) NewSharedArrayBufferObject(proto *Object, blk *SharedDataBlock) *Object
NewSharedArrayBufferObject returns a SharedArrayBuffer with the prototype proto over the data block blk, which may come from another agent.
func (*RealmPart) NewTemplateArray ¶
NewTemplateArray returns a new frozen array with the elements vals, which still can be given named properties by Space.Add.
func (*RealmPart) NewTypedArrayObject ¶
func (r *RealmPart) NewTypedArrayObject(proto *Object, t element.Type, buffer *Object, byteOffset, length int) *Object
NewTypedArrayObject returns a typed array with the prototype proto whose elements of the type t are stored in the buffer object buffer from byteOffset on. length is the number of elements, or -1 for a typed array whose length tracks the length of the buffer.
func (*RealmPart) NumberToString ¶
NumberToString is quiet.Context.NumberToString.
func (*RealmPart) OwnFunctionPrototypeSlot ¶
OwnFunctionPrototypeSlot returns the own prototype slot of an ordinary function, or nil.
func (*RealmPart) PollAtIndex ¶
PollAtIndex is agent.PollAt with Poller.Poll.
func (*RealmPart) PrependElements ¶
PrependElements is quiet.Context.PrependElements.
func (*RealmPart) RecordRegExpOriginals ¶
RecordRegExpOriginals records the current own properties protoKeys of %RegExp.prototype% and ctorKeys of %RegExp%, which quiet.Context.UnmodifiedRegExpMatcher requires to stay unchanged. Every key must name an existing property whose value, if it is a data property, is an object.
func (*RealmPart) RegExpLastIndex ¶
RegExpLastIndex is quiet.Context.RegExpLastIndex.
func (*RealmPart) RegExpShape ¶
RegExpShape returns the shape of a new RegExp object whose prototype is %RegExp.prototype%.
func (*RealmPart) ReplaceOwn ¶
ReplaceOwn stores the value and attributes of the existing own property k of o.
func (*RealmPart) ReverseElements ¶
ReverseElements is quiet.Context.ReverseElements.
func (*RealmPart) SearchElements ¶
func (r *RealmPart) SearchElements(o *Object, i, end int64, target Value, sameValueZero bool) (found, next int64)
SearchElements is quiet.Context.SearchElements.
func (*RealmPart) SetIntrinsic ¶
SetIntrinsic makes o the intrinsic object id.
func (*RealmPart) SetRegExpLastIndex ¶
SetRegExpLastIndex is quiet.Context.SetRegExpLastIndex.
func (*RealmPart) ShapeFor ¶
ShapeFor returns the ordinary root shape in r for prototype proto, which may be nil.
func (*RealmPart) SharedString ¶
SharedString returns the string s as a value that may be the same object as a property key with the same contents.
func (*RealmPart) SkipHolesBackward ¶
SkipHolesBackward is quiet.Context.SkipHolesBackward.
func (*RealmPart) SpliceElements ¶
func (r *RealmPart) SpliceElements(o *Object, length, start, del int64, items []Value) (*Object, bool)
SpliceElements is quiet.Context.SpliceElements.
func (*RealmPart) StringFromCodeUnits ¶
StringFromCodeUnits returns the string value whose code units are units.
func (*RealmPart) Substring ¶
Substring returns the code units of s from start up to end, which must be in range and in order.
func (*RealmPart) UnitString ¶
UnitString returns the string that consists of the code unit u.
type RegExpSite ¶
type RegExpSite struct {
Literal bytecode.RegExp
// State is the internal state that the RegExp objects of the literal share, once the
// pattern is compiled.
State *RegExpState
// Lent is the RegExp object that ExecutionContext.LendRegExpLiterals lends for the literal, once made.
Lent *Object
}
RegExpSite is a regular expression literal of a function.
type RegExpState ¶
type RegExpState struct {
Matcher *regexp.Regexp
Source wtf8.String
Flags wtf8.String
Legacy bool
// Lent marks the state of a RegExp object that ExecutionContext.LendRegExpLiterals lends.
Lent bool
// Realm is the [[Realm]] of the object.
Realm *RealmPart
}
RegExpState holds the internal slots of a RegExp object. It does not change once it is set, so objects can share it.
type ReversedBuilder ¶
ReversedBuilder holds the reversed contents of the reversed strings made from it.
func HeadBuilder ¶
func HeadBuilder(o *Object) *ReversedBuilder
HeadBuilder returns the builder whose head the string o is, or nil.
type Shape ¶
type Shape struct {
// Space and Realm identify where the objects with this shape were created.
Space *Space
Realm *RealmPart
Proto *Object
Parent *Shape
// Key is the property this shape adds to Parent, stored in slot Count-1.
// It is an interned string or a symbol.
Key *Object
Flags uint8
Family shapeFamily
Count int32
// Table maps every property of the shape to its slot. A private shape always has one.
// A shared shape with more than smallShapeSize properties builds it on first lookup,
// or takes it over from its parent.
Table map[*Object]Prop
// Transitions maps a property to the shared shape that adds it to this one.
Transitions transitionTable
// Small lists the properties of a shared shape with at most smallShapeSize properties,
// by slot. It is nil for any other shape.
Small []ShapeEntry
Private bool
// ReadID identifies this shape in its agent's megamorphic read caches. Zero is unassigned.
ReadID uint32
// Order lists the keys of a private shape in insertion order, at the indices of their
// slots. A deleted key leaves nil behind until the shape is compacted, so Count is the number
// of keys and len(Order) the number of slots.
Order []*Object
// contains filtered or unexported fields
}
Shape describes the layout of an object: which property lives in which slot, and the prototype.
The root fixes the creation realm, prototype, and behavior of named properties. Objects built from that root by adding the same properties in the same order share a shape, until one gets a private shape, which is changed in place.
A shared shape never changes, so an inline cache that remembers one stays valid for as long as the prototypes it looked through keep their properties.
func (*Shape) HasEnumerableString ¶
HasEnumerableString reports whether s has an enumerable property whose key is a string, checking for an interruption while it looks at many.
func (*Shape) Keys ¶
Keys returns the property keys in insertion order. The result must not be modified.
func (*Shape) StringKeys ¶
StringKeys returns the property keys of s that are strings, in insertion order.
type ShapeEntry ¶
ShapeEntry is a property of a shape and where it is.
type SharedDataBlock ¶
type SharedDataBlock struct {
// to the engine. Only its waiterListsOf and compareAndAdd use the field, between Lock and
// Unlock.
WaiterLists any
// contains filtered or unexported fields
}
SharedDataBlock is a Shared Data Block: the bytes of a SharedArrayBuffer, which the agents of an agent cluster share. Its methods may be called from any goroutine.
func NewSharedDataBlock ¶
func NewSharedDataBlock(byteLength, maxByteLength int64) *SharedDataBlock
NewSharedDataBlock returns a block of byteLength zero bytes. maxByteLength is -1 for a block whose length is fixed.
func (*SharedDataBlock) Lock ¶
func (blk *SharedDataBlock) Lock() []byte
Lock returns the bytes of blk and keeps the other agents from accessing them and the waiter lists until SharedDataBlock.Unlock is called.
func (*SharedDataBlock) Unlock ¶
func (blk *SharedDataBlock) Unlock()
Unlock ends the access of SharedDataBlock.Lock.
type Space ¶
type Space struct {
// Poller comes first, as the interpreter loop reads its flag often.
Poller
Keys keys
Strings stringTable
// MissHolder holds undefined in its one slot, where the cache entries of properties that
// were not found point.
MissHolder *Object
// ProtoEpoch changes whenever the properties or the prototype of a prototype object change,
// or its slots move.
ProtoEpoch uint32
// IndexStrings holds the strings of the smallest array indices that were made, by index,
// and nil for the others.
IndexStrings []*Object
// SymbolShape is the shape of the symbols of the agent. It records the space that they belong
// to, and no lookup starts from it.
SymbolShape *Shape
// Typeofs are the interned results of the typeof operator, indexed by the typeof constants.
Typeofs [TypeofCount]Value
Builtins builtinLayout
// MaxBigIntResultBits is the bit limit for checked BigInt arithmetic results.
// Tests lower it to exercise overflow with small operands.
MaxBigIntResultBits int64
// SymbolRegistry is the GlobalSymbolRegistry List, by key.
SymbolRegistry map[wtf8.String]*Object
// HasHostClock is set if a host function gives the current time.
HasHostClock bool
// RegExpMatcher matches regular expressions. Nothing that a match runs starts another one.
RegExpMatcher regexp.Matcher
// HostDefinedValue is the value that [Space.HostDefined] returns.
HostDefinedValue any
// contains filtered or unexported fields
}
Space is the state of an agent that its objects and values need: the property keys and the strings, the symbols, the shapes that belong to no realm, the epoch and the IDs that the inline caches rely on, and the objects that WeakRefs keep alive. The objects of an agent lead to its space through their shapes. It also holds what operations on them need besides: the state of polling, whether there is a host clock, and the RegExp matcher.
It must not refer to the agent, a realm, a frame or an execution context, except that a shape records its realm. HostDefinedValue belongs to the host and is opaque to the engine.
func (*Space) Add ¶
Add gives o the new own property key. The caller has checked that o has no such property.
func (*Space) AddToKeptObjects ¶
AddToKeptObjects implements AddToKeptObjects: o stays alive until the current job ends.
func (*Space) ArrayIterationUnmodified ¶
ArrayIterationUnmodified reports whether %Array.prototype%[@@iterator] and %ArrayIteratorPrototype%.next are the original functions.
func (*Space) CanBeHeldWeakly ¶
CanBeHeldWeakly implements CanBeHeldWeakly.
func (*Space) ClearKeptObjects ¶
func (sp *Space) ClearKeptObjects()
ClearKeptObjects implements ClearKeptObjects. It must be called when a job ends: after each promise job, and when the outermost call into the engine returns.
func (*Space) FinishBuiltins ¶
func (sp *Space) FinishBuiltins()
FinishBuiltins ends the creation of the built-in objects.
func (*Space) HostDefined ¶
HostDefined returns the host-defined value of the agent.
func (*Space) IndexKey ¶
IndexKey returns the interned key for the index i, or nil when the key is not interned, in which case no object has a property with that key.
func (*Space) InitMissHolder ¶
InitMissHolder creates the object that MissHolder describes, with the shape s.
func (*Space) IsLazyKey ¶
IsLazyKey reports whether key names a property that RealmPart.Materialize creates.
func (*Space) KeyForSymbol ¶
KeyForSymbol implements KeyForSymbol: it returns the key of the symbol sym in the GlobalSymbolRegistry List, and reports whether sym is in it.
func (*Space) NewShape ¶
NewShape returns a new empty shared shape for objects whose prototype is proto.
func (*Space) NewSymbol ¶
NewSymbol returns a new symbol. desc is its description when hasDesc is set.
func (*Space) NoArrayIteratorReturn ¶
NoArrayIteratorReturn reports whether array iterators have no return method, which closing one calls. The prototypes that it looks at count as prototypes from then on, so that adding a property to one moves ProtoEpoch.
func (*Space) PairDestructuringPlain ¶
PairDestructuringPlain reports whether destructuring a new array of two elements into two bindings runs nothing that JavaScript could observe.
func (*Space) QueryStringKey ¶
QueryStringKey returns the query key for the string o.
func (*Space) ReadNamedSlot ¶
func (sp *Space) ReadNamedSlot(start, holder *Object, p Prop, c *PropCache) (val Value, getter *Object)
ReadNamedSlot reads p and returns its getter separately for the caller to invoke.
func (*Space) RegisteredSymbol ¶
RegisteredSymbol returns the symbol of the GlobalSymbolRegistry List with the key key, which it adds when there is none.
func (*Space) RootShape ¶
RootShape selects the tree of layouts shared by receivers of this family, prototype and realm.
func (*Space) SetProto ¶
SetProto changes the prototype of o. It stays out of line to keep ArrayCreate small.
func (*Space) ShapeForRealm ¶
ShapeForRealm returns the ordinary root shape in r for prototype proto, which may be nil.
func (*Space) ShortQueryKey ¶
ShortQueryKey returns the query key for the short string v, which is not interned.
func (*Space) StartBuiltins ¶
func (sp *Space) StartBuiltins()
StartBuiltins starts the creation of the built-in objects, which Space.FinishBuiltins ends. In between, objects should only get their initial properties.
func (*Space) TouchProto ¶
TouchProto records that the named properties of o changed, if o is a prototype: one was added, removed or defined, or its attributes changed. Whatever moves the slots of a prototype calls it too, because CacheProto entries point into them.
A change of elements, of the length of an array or of the value of a data property does not need it. The caches of property lookups and the records of original built-in properties hold named properties in slots only. The operations in array.go that depend on the elements of prototypes read them each time.
func (*Space) TypeofValue ¶
func (*Space) WeakRefDeref ¶
WeakRefDeref implements WeakRefDeref for the WeakRef object v. It reports false when v is not a WeakRef object.
func (*Space) WellKnownSymbol ¶
func (sp *Space) WellKnownSymbol(s WellKnownSymbol) *Object
WellKnownSymbol returns the well-known symbol s.
type StackCall ¶
type StackCall struct {
// Fp is the function that runs, or nil for a native function.
Fp *FuncProto
// Name is the name of the function.
Name wtf8.String
// Recv is the type name of the receiver of a method call, or empty.
Recv wtf8.String
// Pc is past the instruction of Fp that is running.
Pc int
IsNew bool
}
StackCall is a line of a stack trace.
type TemplateSite ¶
type TypedArray ¶
type TypedArray struct {
Data *ArrayBuffer
Offset int
// FixedLength is [[ArrayLength]] in elements, unless Tracking is set: then the length follows
// the buffer.
FixedLength int
Tracking bool
Type element.Type
// NumberStore reports whether the elements are numbers and the buffer is mutable and not
// shared, so that a number is stored without a conversion.
NumberStore bool
// contains filtered or unexported fields
}
TypedArray is the state of a typed array object.
func TypedArrayData ¶
func TypedArrayData(v Value) *TypedArray
TypedArrayData returns the state of the typed array v, or nil when v is not a typed array.
func (*TypedArray) ArrayBuffer ¶
func (t *TypedArray) ArrayBuffer() *ArrayBuffer
ArrayBuffer returns the data block of [[ViewedArrayBuffer]] of t.
func (*TypedArray) AtomicLoad ¶
func (t *TypedArray) AtomicLoad(i int) uint64
AtomicLoad returns the encoding of the element i of t, which must be a valid integer index, as a sequentially consistent read.
func (*TypedArray) AtomicReadModifyWrite ¶
func (t *TypedArray) AtomicReadModifyWrite(i int, op AtomicOp, v, replacement uint64) uint64
AtomicReadModifyWrite implements the steps of AtomicReadModifyWrite and Atomics.compareExchange that follow RevalidateAtomicAccess: it applies op with the encoding v to the element i of t, which must be a valid integer index, and returns the encoding that the element had. replacement is the encoding that AtomicCompareExchange stores.
func (*TypedArray) AtomicStore ¶
func (t *TypedArray) AtomicStore(i int, x uint64)
AtomicStore stores the encoding x as the element i of t, which must be a valid integer index, as a sequentially consistent write.
func (*TypedArray) Buffer ¶
func (t *TypedArray) Buffer() *Object
Buffer returns [[ViewedArrayBuffer]] of t.
func (*TypedArray) ByteOffset ¶
func (t *TypedArray) ByteOffset() int
ByteOffset returns [[ByteOffset]] of t.
func (*TypedArray) ElementBytes ¶
func (t *TypedArray) ElementBytes(i uint32) ([]byte, bool)
ElementBytes returns the bytes of the element i of t. It reports false when i is not a valid integer index or the buffer is shared.
func (*TypedArray) ElementType ¶
func (t *TypedArray) ElementType() element.Type
ElementType returns [[TypedArrayName]] of t as an element type.
func (*TypedArray) IsLengthTracking ¶
func (t *TypedArray) IsLengthTracking() bool
IsLengthTracking reports whether [[ArrayLength]] of t is auto.
func (*TypedArray) IsTypedArrayFixedLength ¶
func (t *TypedArray) IsTypedArrayFixedLength() bool
IsTypedArrayFixedLength implements IsTypedArrayFixedLength.
func (*TypedArray) Length ¶
func (t *TypedArray) Length() (int, bool)
Length implements TypedArrayLength. It reports false when the typed array is out of bounds, which includes a detached buffer.
func (*TypedArray) LoadElement ¶
func (t *TypedArray) LoadElement(i int) (uint64, bool)
LoadElement returns the encoding of the element i of t, or reports false when i is not a valid integer index.
func (*TypedArray) Lock ¶
func (t *TypedArray) Lock() []byte
Lock returns the bytes of the elements of t, or nil when t is out of bounds, as ArrayBuffer.Lock does for the buffer. It must be paired with TypedArray.Unlock. The slice must not be modified when the buffer is immutable.
func (*TypedArray) StoreElement ¶
func (t *TypedArray) StoreElement(i int, x uint64)
StoreElement stores the encoding x as the element i of t, which is mutable, when i is a valid integer index.
func (*TypedArray) Unlock ¶
func (t *TypedArray) Unlock()
Unlock ends the access of TypedArray.Lock.
type Upvalue ¶
type Upvalue struct {
P *Value
// Index is the stack index or, for a generator, the register that P points to while the upvalue is open.
Index int
Val Value
}
Upvalue is a variable of an enclosing function. P points to the variable: into the registers of that function while it is running, and to Val afterwards.
type Value ¶
type Value struct {
N float64
// O is nil for undefined, NumberObject for the number N, BigInt64Object for the BigInt
// whose two's complement bits N holds, and the object for anything else.
// Every string of at most shortstrings.MaxBytes bytes holds its bytes in N.
// Its object carries the byte length and realm, and may also be an interned key.
O *Object
// contains filtered or unexported fields
}
Value is a JavaScript value. The zero value is undefined. Values cannot be compared with ==; use IsStrictlyEqual, SameValue, or SameValueZero.
var Undefined Value
Undefined is the value undefined.
func ArithBigInt64 ¶
ArithBigInt64 is ExecutionContext.arith for two BigInts that fit in an int64. It reports false when the result does not fit in an int64 or the operation throws.
func DiagnosticDataProperty ¶
DiagnosticDataProperty reads stored properties for stack traces and exception descriptions. It skips the property operations of exotic objects.
func Element ¶
Element returns the own property of o with the integer index i when reading it cannot run any JavaScript. It reports false when that is not known.
func ElementFromBits ¶
ElementFromBits returns the value that the encoding x of an element of the type t stands for.
func ElementFromBytes ¶
ElementFromBytes returns the element of the type t at the start of b.
func GetValueFromBuffer ¶
GetValueFromBuffer implements GetValueFromBuffer for the bytes b, which hold at least one element of the type t.
func NewAccessor ¶
NewAccessor returns the content of the slot of an accessor property with the given getter and setter.
func ThisBigIntValue ¶
ThisBigIntValue implements ThisBigIntValue. It reports false when the specification throws.
func ThisStringValue ¶
ThisStringValue implements ThisStringValue. It reports false when the specification throws.
func TypedArrayGet ¶
TypedArrayGet implements TypedArrayGetElement. It returns undefined when i is not a valid integer index.
func (Value) AppendStringBytes ¶
AppendStringBytes appends the string value's canonical WTF-8 bytes to dst.
func (Value) BigInt64 ¶
BigInt64 returns the BigInt v as an int64, and reports whether v is a BigInt that fits in one.
func (Value) CodePointAt ¶
CodePointAt returns the code point starting at UTF-16 index i. i must be in range.
func (Value) IsASCII ¶
IsASCII reports whether s contains only ASCII code units. s must be a string.
func (Value) IsObject ¶
IsObject reports whether v is an object, which includes functions and arrays.
func (Value) IsShortString ¶
func (Value) IsUndefined ¶
IsUndefined reports whether v is undefined.
func (Value) IsWellFormed ¶
IsWellFormed reports whether the string value contains no lone surrogates.
func (Value) Object ¶
Object returns the object, string, symbol or BigInt that v is. It returns nil for a number or undefined, and one shared object for null, for each boolean, and for every BigInt that fits in an int64. For primitive strings, the returned object's identity is not guaranteed.
func (Value) StringByteLength ¶
StringByteLength returns the byte length of the string's canonical WTF-8 encoding.
func (Value) StringLength ¶
StringLength returns the number of UTF-16 code units in the string value.
func (Value) StringObject ¶
func (Value) Substring ¶
Substring returns the string's code units from start up to end, which must be in range and in order.
func (Value) SubstringEquals ¶
SubstringEquals reports whether the substring from start up to end equals other. Both values must be strings, and the UTF-16 indices must be in range and in order.
func (Value) UnitIndexOf ¶
UnitIndexOf returns the first UTF-16 index of sub at or after from, or -1. Both values must be strings, and from must be nonnegative. poll, which may be nil, is called now and then during a long search.
func (Value) UnitLastIndexOf ¶
UnitLastIndexOf returns the last UTF-16 index of sub at or before from, or -1. Both values must be strings, and from must be nonnegative. poll is as for Value.UnitIndexOf.
func (Value) WriteShortString ¶
func (Value) WriteStringTo ¶
WriteStringTo appends the string value to b.
type WeakTable ¶
type WeakTable struct {
// contains filtered or unexported fields
}
WeakTable is the [[WeakMapData]] of a WeakMap or the [[WeakSetData]] of a WeakSet. Every key must be a value for which CanBeHeldWeakly holds.
func NewWeakTable ¶
func NewWeakTable() *WeakTable
func (*WeakTable) Delete ¶
Delete deletes the entry with the key k and reports whether there was one.
type WellKnownSymbol ¶
type WellKnownSymbol uint8
WellKnownSymbol identifies a well-known symbol.
const ( SymbolIterator WellKnownSymbol = iota SymbolAsyncIterator SymbolHasInstance SymbolToPrimitive SymbolToStringTag SymbolSpecies SymbolIsConcatSpreadable SymbolUnscopables SymbolMatch SymbolMatchAll SymbolReplace SymbolSearch SymbolSplit SymbolDispose SymbolAsyncDispose SymbolMetadata WellKnownSymbolCount )
Source Files
¶
- array.go
- arraybuffer.go
- arrayiteration.go
- atomics.go
- bigint.go
- bufferelement.go
- builtinobject.go
- class.go
- compare.go
- concat.go
- dataview.go
- display.go
- error.go
- funcproto.go
- function.go
- functionobject.go
- inlinecache.go
- internalslots.go
- interrupt_notjs.go
- intrinsic.go
- keys.go
- native.go
- object.go
- poll.go
- propdesc.go
- property.go
- propkey.go
- proxy.go
- raw.go
- realmpart.go
- regexpobject.go
- regexpstate.go
- shape.go
- shareddatablock.go
- space.go
- sparseindex.go
- string.go
- stringtable.go
- stringvalue.go
- sweep.go
- symbol.go
- typedarray.go
- validate_off.go
- value.go
- valuestorage.go
- weakref.go
- weaktable.go