blob: b8d9714b3600c2d1dd46d6613a09ea56e8562293 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@abstract
@generateCppClass
@reserveBitsInInstanceType(6)
extern class String extends Name {
const length: int32;
}
@generateCppClass
extern class ConsString extends String {
first: String;
second: String;
}
@abstract
extern class ExternalString extends String {
resource: RawPtr;
resource_data: RawPtr;
}
extern class ExternalOneByteString extends ExternalString {}
extern class ExternalTwoByteString extends ExternalString {}
@generateCppClass
extern class InternalizedString extends String {
}
// TODO(v8:8983): Add declaration for variable-sized region.
@abstract
@generateCppClass
extern class SeqString extends String {
}
@generateCppClass
extern class SeqOneByteString extends SeqString {
chars[length]: char8;
}
@generateCppClass
extern class SeqTwoByteString extends SeqString {
chars[length]: char16;
}
@generateCppClass
extern class SlicedString extends String {
parent: String;
offset: Smi;
}
@generateCppClass
extern class ThinString extends String {
actual: String;
}
// A direct string can be accessed directly through CSA without going into the
// C++ runtime. See also: ToDirectStringAssembler.
type DirectString extends String;
@export
macro AllocateSeqOneByteString(length: uint32): String {
assert(length <= kStringMaxLength);
if (length == 0) return kEmptyString;
return new SeqOneByteString{
map: kOneByteStringMap,
hash_field: kNameEmptyHashField,
length: Signed(length),
chars: ...UninitializedIterator {}
};
}
@export
macro AllocateSeqTwoByteString(length: uint32): String {
assert(length <= kStringMaxLength);
if (length == 0) return kEmptyString;
return new SeqTwoByteString{
map: kStringMap,
hash_field: kNameEmptyHashField,
length: Signed(length),
chars: ...UninitializedIterator {}
};
}
|