@react-native-quickjs/quickjs 1.0.0-alpha.2 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +173 -15
- package/README.md +17 -0
- package/ReactNativeQuickJS.podspec +13 -1
- package/android/CMakeLists.txt +6 -0
- package/android/build.gradle +33 -6
- package/bin/qjsc/darwin-arm64/qjsc +0 -0
- package/bin/qjsc/darwin-x64/qjsc +0 -0
- package/bin/qjsc/linux-arm64/qjsc +0 -0
- package/bin/qjsc/linux-x64/qjsc +0 -0
- package/bin/qjsc/win32-x64/qjsc.exe +0 -0
- package/cmake/quickjs.cmake +9 -0
- package/engine/quickjs-rel/MANIFEST.json +118 -13
- package/engine/quickjs-rel/builtin-array-fromasync.h +100 -92
- package/engine/quickjs-rel/builtin-iterator-zip-keyed.h +288 -273
- package/engine/quickjs-rel/builtin-iterator-zip.h +293 -276
- package/engine/quickjs-rel/libregexp-backtrack.c.inc +583 -0
- package/engine/quickjs-rel/libregexp.c +1021 -573
- package/engine/quickjs-rel/libregexp.h +54 -2
- package/engine/quickjs-rel/libunicode-table.h +71 -84
- package/engine/quickjs-rel/libunicode.c +5 -0
- package/engine/quickjs-rel/quickjs-opcode.h +15 -6
- package/engine/quickjs-rel/quickjs.c +6581 -734
- package/engine/quickjs-rel/quickjs.h +43 -9
- package/package.json +14 -2
- package/src/runtime/QuickJSRuntime.cpp +18 -5
|
@@ -42,6 +42,51 @@ extern "C" {
|
|
|
42
42
|
#define LRE_FLAG_INDICES (1 << 6) /* Unused by libregexp, just recorded. */
|
|
43
43
|
#define LRE_FLAG_NAMED_GROUPS (1 << 7) /* named groups are present in the regexp */
|
|
44
44
|
#define LRE_FLAG_UNICODE_SETS (1 << 8)
|
|
45
|
+
#define LRE_FLAG_ATOM (1 << 9) /* internal: raw literal pattern */
|
|
46
|
+
#define LRE_FLAG_HAS_META (1 << 10) /* internal optimization metadata */
|
|
47
|
+
|
|
48
|
+
/* RegExp optimization metadata is serialized little-endian after the opcode
|
|
49
|
+
stream. Source literals borrow their payload from JSRegExp.pattern; all
|
|
50
|
+
other payloads are bounded so untrusted bytecode cannot request an
|
|
51
|
+
unbounded fast-path allocation or comparison. */
|
|
52
|
+
#define LRE_META_VERSION 3
|
|
53
|
+
#define LRE_META_NONE 0
|
|
54
|
+
#define LRE_META_LITERAL 1
|
|
55
|
+
#define LRE_META_PREFIX 2
|
|
56
|
+
#define LRE_META_FIRST_SET 3 /* 256-bit bitmap of the mandatory first char */
|
|
57
|
+
|
|
58
|
+
/* LRE_META_FIRST_SET payload: 1 flag byte (whether the first char may be
|
|
59
|
+
> 0xff) followed by a 32-byte little-endian bitmap covering code points
|
|
60
|
+
0..255. */
|
|
61
|
+
#define LRE_FIRST_SET_BITMAP_LEN 32
|
|
62
|
+
#define LRE_FIRST_SET_PAYLOAD_LEN (1 + LRE_FIRST_SET_BITMAP_LEN)
|
|
63
|
+
|
|
64
|
+
#define LRE_META_FLAG_SOURCE 1 /* literal uses the source pattern; no payload */
|
|
65
|
+
|
|
66
|
+
#define LRE_LITERAL_MAX_LENGTH 4096
|
|
67
|
+
#define LRE_PREFIX_MIN_LENGTH 3
|
|
68
|
+
#define LRE_PREFIX_MAX_LENGTH 32
|
|
69
|
+
|
|
70
|
+
#define LRE_META_VERSION_OFFSET 0
|
|
71
|
+
#define LRE_META_KIND_OFFSET 1
|
|
72
|
+
#define LRE_META_ENCODING_OFFSET 2
|
|
73
|
+
#define LRE_META_FLAGS_OFFSET 3
|
|
74
|
+
#define LRE_META_PAYLOAD_SIZE_OFFSET 4
|
|
75
|
+
#define LRE_META_LENGTH_OFFSET 8
|
|
76
|
+
#define LRE_META_ENTRY_OFFSET 12
|
|
77
|
+
#define LRE_META_HEADER_LEN 16
|
|
78
|
+
|
|
79
|
+
typedef struct LREMetadata {
|
|
80
|
+
const uint8_t *payload;
|
|
81
|
+
const uint8_t *leading_chars;
|
|
82
|
+
uint32_t payload_size;
|
|
83
|
+
uint32_t primary_payload_size;
|
|
84
|
+
uint32_t length;
|
|
85
|
+
uint32_t entry_offset;
|
|
86
|
+
uint8_t kind;
|
|
87
|
+
uint8_t encoding;
|
|
88
|
+
uint8_t flags;
|
|
89
|
+
} LREMetadata;
|
|
45
90
|
|
|
46
91
|
#define LRE_RET_MEMORY_ERROR (-1)
|
|
47
92
|
#define LRE_RET_TIMEOUT (-2)
|
|
@@ -54,13 +99,20 @@ uint8_t *lre_compile(int *plen, char *error_msg, int error_msg_size,
|
|
|
54
99
|
const char *buf, size_t buf_len, int re_flags,
|
|
55
100
|
void *opaque);
|
|
56
101
|
int lre_get_alloc_count(const uint8_t *bc_buf);
|
|
57
|
-
int lre_check_bytecode(const uint8_t *bc_buf, int bc_buf_len);
|
|
102
|
+
int lre_check_bytecode(const uint8_t *bc_buf, int bc_buf_len, void *opaque);
|
|
58
103
|
int lre_get_capture_count(const uint8_t *bc_buf);
|
|
59
104
|
int lre_get_flags(const uint8_t *bc_buf);
|
|
60
|
-
const char *
|
|
105
|
+
int lre_is_raw_atom(const char *buf, size_t len, int re_flags);
|
|
106
|
+
int lre_get_metadata(const uint8_t *bc_buf, size_t bc_buf_len,
|
|
107
|
+
LREMetadata *meta);
|
|
108
|
+
const char *lre_get_groupnames(const uint8_t *bc_buf, size_t bc_buf_len);
|
|
61
109
|
int lre_exec(uint8_t **capture,
|
|
62
110
|
const uint8_t *bc_buf, const uint8_t *cbuf, int cindex, int clen,
|
|
63
111
|
int cbuf_type, void *opaque);
|
|
112
|
+
int lre_exec_at(uint8_t **capture,
|
|
113
|
+
const uint8_t *bc_buf, uint32_t bytecode_offset,
|
|
114
|
+
const uint8_t *cbuf, int cindex, int clen,
|
|
115
|
+
int cbuf_type, void *opaque);
|
|
64
116
|
|
|
65
117
|
int lre_parse_escape(const uint8_t **pp, int allow_utf16);
|
|
66
118
|
/* lre_is_space() is provided as an inline in libunicode.h */
|
|
@@ -4067,6 +4067,76 @@ static const uint8_t unicode_prop_Changes_When_NFKC_Casefolded1_table[449] = {
|
|
|
4067
4067
|
0xff,
|
|
4068
4068
|
};
|
|
4069
4069
|
|
|
4070
|
+
static const uint8_t unicode_prop_Basic_Emoji1_table[144] = {
|
|
4071
|
+
0x60, 0x23, 0x19, 0x81, 0x40, 0xcc, 0x1a, 0x01,
|
|
4072
|
+
0x80, 0x42, 0x08, 0x81, 0x94, 0x81, 0xb1, 0x8b,
|
|
4073
|
+
0xaa, 0x80, 0x92, 0x80, 0x8c, 0x07, 0x81, 0x90,
|
|
4074
|
+
0x0c, 0x0f, 0x04, 0x80, 0x94, 0x06, 0x08, 0x03,
|
|
4075
|
+
0x01, 0x06, 0x03, 0x81, 0x9b, 0x80, 0xa2, 0x00,
|
|
4076
|
+
0x03, 0x10, 0x80, 0xbc, 0x82, 0x97, 0x80, 0x8d,
|
|
4077
|
+
0x80, 0x43, 0x5a, 0x81, 0xb2, 0x03, 0x80, 0x61,
|
|
4078
|
+
0xc4, 0xad, 0x80, 0x40, 0xc9, 0x80, 0x40, 0xbd,
|
|
4079
|
+
0x01, 0x89, 0xe5, 0x80, 0x97, 0x80, 0x93, 0x01,
|
|
4080
|
+
0x20, 0x82, 0x94, 0x81, 0x40, 0xad, 0xa0, 0x8b,
|
|
4081
|
+
0x88, 0x80, 0xc5, 0x80, 0x95, 0x8b, 0xaa, 0x1c,
|
|
4082
|
+
0x8b, 0x90, 0x10, 0x82, 0xc6, 0x00, 0x80, 0x40,
|
|
4083
|
+
0xba, 0x81, 0xbe, 0x8c, 0x18, 0x97, 0x91, 0x80,
|
|
4084
|
+
0x99, 0x81, 0x8c, 0x80, 0xd5, 0xd4, 0xaf, 0xc5,
|
|
4085
|
+
0x28, 0x12, 0x0b, 0x13, 0x8a, 0x0e, 0x88, 0x40,
|
|
4086
|
+
0xe2, 0x8b, 0x18, 0x41, 0x1a, 0xae, 0x80, 0x89,
|
|
4087
|
+
0x80, 0x40, 0xb8, 0xef, 0x8c, 0x82, 0x8a, 0x82,
|
|
4088
|
+
0xb8, 0x00, 0x83, 0x8f, 0x81, 0x8b, 0x83, 0x89,
|
|
4089
|
+
};
|
|
4090
|
+
|
|
4091
|
+
static const uint8_t unicode_prop_Basic_Emoji2_table[183] = {
|
|
4092
|
+
0x40, 0xa8, 0x03, 0x80, 0x5f, 0x8c, 0x80, 0x8b,
|
|
4093
|
+
0x80, 0x40, 0xd7, 0x80, 0x95, 0x80, 0xd9, 0x85,
|
|
4094
|
+
0x8e, 0x81, 0x41, 0x7c, 0x80, 0x40, 0xa5, 0x80,
|
|
4095
|
+
0x9c, 0x10, 0x0c, 0x82, 0x40, 0xc6, 0x80, 0x40,
|
|
4096
|
+
0xe6, 0x81, 0x89, 0x80, 0x88, 0x80, 0xb9, 0x0a,
|
|
4097
|
+
0x84, 0x88, 0x01, 0x05, 0x03, 0x01, 0x00, 0x09,
|
|
4098
|
+
0x02, 0x02, 0x0f, 0x14, 0x00, 0x80, 0x9b, 0x09,
|
|
4099
|
+
0x00, 0x08, 0x80, 0x91, 0x01, 0x80, 0x92, 0x00,
|
|
4100
|
+
0x18, 0x00, 0x0a, 0x05, 0x07, 0x81, 0x95, 0x05,
|
|
4101
|
+
0x00, 0x00, 0x80, 0x94, 0x05, 0x09, 0x01, 0x17,
|
|
4102
|
+
0x04, 0x09, 0x08, 0x01, 0x00, 0x00, 0x05, 0x02,
|
|
4103
|
+
0x80, 0x90, 0x81, 0x8e, 0x01, 0x80, 0x9a, 0x81,
|
|
4104
|
+
0xbb, 0x80, 0x41, 0x91, 0x81, 0x41, 0xce, 0x82,
|
|
4105
|
+
0x45, 0x27, 0x80, 0x8b, 0x80, 0x42, 0x58, 0x00,
|
|
4106
|
+
0x80, 0x61, 0xbe, 0xd5, 0x81, 0x8b, 0x81, 0x40,
|
|
4107
|
+
0x81, 0x80, 0xb3, 0x80, 0x40, 0xe8, 0x01, 0x88,
|
|
4108
|
+
0x88, 0x80, 0xc5, 0x80, 0x97, 0x08, 0x11, 0x81,
|
|
4109
|
+
0xaa, 0x1c, 0x8b, 0x92, 0x00, 0x00, 0x80, 0xc6,
|
|
4110
|
+
0x00, 0x80, 0x40, 0xba, 0x80, 0xca, 0x81, 0xa3,
|
|
4111
|
+
0x09, 0x86, 0x8c, 0x01, 0x19, 0x80, 0x93, 0x01,
|
|
4112
|
+
0x07, 0x81, 0x88, 0x04, 0x82, 0x8b, 0x17, 0x11,
|
|
4113
|
+
0x00, 0x03, 0x05, 0x02, 0x05, 0x80, 0x40, 0xcf,
|
|
4114
|
+
0x00, 0x82, 0x8f, 0x2a, 0x05, 0x01, 0x80,
|
|
4115
|
+
};
|
|
4116
|
+
|
|
4117
|
+
static const uint8_t unicode_prop_RGI_Emoji_Flag_Sequence_table[128] = {
|
|
4118
|
+
0x0c, 0x00, 0x09, 0x00, 0x04, 0x01, 0x02, 0x06,
|
|
4119
|
+
0x03, 0x03, 0x01, 0x02, 0x01, 0x03, 0x07, 0x0d,
|
|
4120
|
+
0x18, 0x00, 0x09, 0x00, 0x00, 0x89, 0x08, 0x00,
|
|
4121
|
+
0x00, 0x81, 0x88, 0x83, 0x8c, 0x10, 0x00, 0x01,
|
|
4122
|
+
0x07, 0x08, 0x29, 0x10, 0x28, 0x00, 0x80, 0x8a,
|
|
4123
|
+
0x00, 0x0a, 0x00, 0x0e, 0x15, 0x18, 0x83, 0x89,
|
|
4124
|
+
0x06, 0x00, 0x81, 0x8d, 0x00, 0x12, 0x08, 0x00,
|
|
4125
|
+
0x03, 0x00, 0x24, 0x00, 0x05, 0x21, 0x00, 0x00,
|
|
4126
|
+
0x29, 0x90, 0x00, 0x02, 0x00, 0x08, 0x09, 0x00,
|
|
4127
|
+
0x08, 0x18, 0x8b, 0x80, 0x8c, 0x02, 0x19, 0x1a,
|
|
4128
|
+
0x11, 0x00, 0x00, 0x80, 0x9c, 0x80, 0x88, 0x02,
|
|
4129
|
+
0x00, 0x00, 0x02, 0x20, 0x88, 0x0a, 0x00, 0x03,
|
|
4130
|
+
0x01, 0x02, 0x05, 0x08, 0x00, 0x01, 0x09, 0x20,
|
|
4131
|
+
0x21, 0x18, 0x22, 0x00, 0x00, 0x00, 0x00, 0x18,
|
|
4132
|
+
0x28, 0x89, 0x80, 0x8b, 0x80, 0x90, 0x80, 0x92,
|
|
4133
|
+
0x80, 0x8d, 0x05, 0x80, 0x8a, 0x80, 0x88, 0x80,
|
|
4134
|
+
};
|
|
4135
|
+
|
|
4136
|
+
static const uint8_t unicode_prop_Emoji_Keycap_Sequence_table[4] = {
|
|
4137
|
+
0xa2, 0x05, 0x04, 0x89,
|
|
4138
|
+
};
|
|
4139
|
+
|
|
4070
4140
|
static const uint8_t unicode_prop_ASCII_Hex_Digit_table[5] = {
|
|
4071
4141
|
0xaf, 0x89, 0x35, 0x99, 0x85,
|
|
4072
4142
|
};
|
|
@@ -4641,89 +4711,6 @@ static const char unicode_prop_name_table[] =
|
|
|
4641
4711
|
"XID_Start,XIDS" "\0"
|
|
4642
4712
|
;
|
|
4643
4713
|
|
|
4644
|
-
/* RGI emoji sequence support */
|
|
4645
|
-
static const uint8_t unicode_prop_Basic_Emoji1_table[144] = {
|
|
4646
|
-
0x60, 0x23, 0x19, 0x81, 0x40, 0xcc, 0x1a, 0x01,
|
|
4647
|
-
0x80, 0x42, 0x08, 0x81, 0x94, 0x81, 0xb1, 0x8b,
|
|
4648
|
-
0xaa, 0x80, 0x92, 0x80, 0x8c, 0x07, 0x81, 0x90,
|
|
4649
|
-
0x0c, 0x0f, 0x04, 0x80, 0x94, 0x06, 0x08, 0x03,
|
|
4650
|
-
0x01, 0x06, 0x03, 0x81, 0x9b, 0x80, 0xa2, 0x00,
|
|
4651
|
-
0x03, 0x10, 0x80, 0xbc, 0x82, 0x97, 0x80, 0x8d,
|
|
4652
|
-
0x80, 0x43, 0x5a, 0x81, 0xb2, 0x03, 0x80, 0x61,
|
|
4653
|
-
0xc4, 0xad, 0x80, 0x40, 0xc9, 0x80, 0x40, 0xbd,
|
|
4654
|
-
0x01, 0x89, 0xe5, 0x80, 0x97, 0x80, 0x93, 0x01,
|
|
4655
|
-
0x20, 0x82, 0x94, 0x81, 0x40, 0xad, 0xa0, 0x8b,
|
|
4656
|
-
0x88, 0x80, 0xc5, 0x80, 0x95, 0x8b, 0xaa, 0x1c,
|
|
4657
|
-
0x8b, 0x90, 0x10, 0x82, 0xc6, 0x00, 0x80, 0x40,
|
|
4658
|
-
0xba, 0x81, 0xbe, 0x8c, 0x18, 0x97, 0x91, 0x80,
|
|
4659
|
-
0x99, 0x81, 0x8c, 0x80, 0xd5, 0xd4, 0xaf, 0xc5,
|
|
4660
|
-
0x28, 0x12, 0x0b, 0x13, 0x8a, 0x0e, 0x88, 0x40,
|
|
4661
|
-
0xe2, 0x8b, 0x18, 0x41, 0x1a, 0xae, 0x80, 0x89,
|
|
4662
|
-
0x80, 0x40, 0xb8, 0xef, 0x8c, 0x82, 0x8a, 0x82,
|
|
4663
|
-
0xb8, 0x00, 0x83, 0x8f, 0x81, 0x8b, 0x83, 0x89,
|
|
4664
|
-
};
|
|
4665
|
-
|
|
4666
|
-
static const uint8_t unicode_prop_Basic_Emoji2_table[183] = {
|
|
4667
|
-
0x40, 0xa8, 0x03, 0x80, 0x5f, 0x8c, 0x80, 0x8b,
|
|
4668
|
-
0x80, 0x40, 0xd7, 0x80, 0x95, 0x80, 0xd9, 0x85,
|
|
4669
|
-
0x8e, 0x81, 0x41, 0x7c, 0x80, 0x40, 0xa5, 0x80,
|
|
4670
|
-
0x9c, 0x10, 0x0c, 0x82, 0x40, 0xc6, 0x80, 0x40,
|
|
4671
|
-
0xe6, 0x81, 0x89, 0x80, 0x88, 0x80, 0xb9, 0x0a,
|
|
4672
|
-
0x84, 0x88, 0x01, 0x05, 0x03, 0x01, 0x00, 0x09,
|
|
4673
|
-
0x02, 0x02, 0x0f, 0x14, 0x00, 0x80, 0x9b, 0x09,
|
|
4674
|
-
0x00, 0x08, 0x80, 0x91, 0x01, 0x80, 0x92, 0x00,
|
|
4675
|
-
0x18, 0x00, 0x0a, 0x05, 0x07, 0x81, 0x95, 0x05,
|
|
4676
|
-
0x00, 0x00, 0x80, 0x94, 0x05, 0x09, 0x01, 0x17,
|
|
4677
|
-
0x04, 0x09, 0x08, 0x01, 0x00, 0x00, 0x05, 0x02,
|
|
4678
|
-
0x80, 0x90, 0x81, 0x8e, 0x01, 0x80, 0x9a, 0x81,
|
|
4679
|
-
0xbb, 0x80, 0x41, 0x91, 0x81, 0x41, 0xce, 0x82,
|
|
4680
|
-
0x45, 0x27, 0x80, 0x8b, 0x80, 0x42, 0x58, 0x00,
|
|
4681
|
-
0x80, 0x61, 0xbe, 0xd5, 0x81, 0x8b, 0x81, 0x40,
|
|
4682
|
-
0x81, 0x80, 0xb3, 0x80, 0x40, 0xe8, 0x01, 0x88,
|
|
4683
|
-
0x88, 0x80, 0xc5, 0x80, 0x97, 0x08, 0x11, 0x81,
|
|
4684
|
-
0xaa, 0x1c, 0x8b, 0x92, 0x00, 0x00, 0x80, 0xc6,
|
|
4685
|
-
0x00, 0x80, 0x40, 0xba, 0x80, 0xca, 0x81, 0xa3,
|
|
4686
|
-
0x09, 0x86, 0x8c, 0x01, 0x19, 0x80, 0x93, 0x01,
|
|
4687
|
-
0x07, 0x81, 0x88, 0x04, 0x82, 0x8b, 0x17, 0x11,
|
|
4688
|
-
0x00, 0x03, 0x05, 0x02, 0x05, 0x80, 0x40, 0xcf,
|
|
4689
|
-
0x00, 0x82, 0x8f, 0x2a, 0x05, 0x01, 0x80,
|
|
4690
|
-
};
|
|
4691
|
-
|
|
4692
|
-
static const uint8_t unicode_prop_RGI_Emoji_Modifier_Sequence_table[72] = {
|
|
4693
|
-
0x60, 0x26, 0x1c, 0x80, 0x40, 0xda, 0x80, 0x8f,
|
|
4694
|
-
0x83, 0x61, 0xcc, 0x76, 0x80, 0xbb, 0x11, 0x01,
|
|
4695
|
-
0x82, 0xf4, 0x09, 0x8a, 0x94, 0x18, 0x8d, 0x10,
|
|
4696
|
-
0x1a, 0x02, 0x30, 0x00, 0x97, 0x80, 0x40, 0xc8,
|
|
4697
|
-
0x0b, 0x80, 0x94, 0x03, 0x81, 0x40, 0xad, 0x12,
|
|
4698
|
-
0x84, 0xd2, 0x80, 0x8f, 0x82, 0x88, 0x80, 0x8a,
|
|
4699
|
-
0x80, 0x42, 0x3e, 0x01, 0x07, 0x3d, 0x80, 0x88,
|
|
4700
|
-
0x89, 0x0a, 0xb7, 0x80, 0xbc, 0x08, 0x08, 0x80,
|
|
4701
|
-
0x90, 0x10, 0x8c, 0x40, 0xe4, 0x82, 0xa9, 0x88,
|
|
4702
|
-
};
|
|
4703
|
-
|
|
4704
|
-
static const uint8_t unicode_prop_RGI_Emoji_Flag_Sequence_table[128] = {
|
|
4705
|
-
0x0c, 0x00, 0x09, 0x00, 0x04, 0x01, 0x02, 0x06,
|
|
4706
|
-
0x03, 0x03, 0x01, 0x02, 0x01, 0x03, 0x07, 0x0d,
|
|
4707
|
-
0x18, 0x00, 0x09, 0x00, 0x00, 0x89, 0x08, 0x00,
|
|
4708
|
-
0x00, 0x81, 0x88, 0x83, 0x8c, 0x10, 0x00, 0x01,
|
|
4709
|
-
0x07, 0x08, 0x29, 0x10, 0x28, 0x00, 0x80, 0x8a,
|
|
4710
|
-
0x00, 0x0a, 0x00, 0x0e, 0x15, 0x18, 0x83, 0x89,
|
|
4711
|
-
0x06, 0x00, 0x81, 0x8d, 0x00, 0x12, 0x08, 0x00,
|
|
4712
|
-
0x03, 0x00, 0x24, 0x00, 0x05, 0x21, 0x00, 0x00,
|
|
4713
|
-
0x29, 0x90, 0x00, 0x02, 0x00, 0x08, 0x09, 0x00,
|
|
4714
|
-
0x08, 0x18, 0x8b, 0x80, 0x8c, 0x02, 0x19, 0x1a,
|
|
4715
|
-
0x11, 0x00, 0x00, 0x80, 0x9c, 0x80, 0x88, 0x02,
|
|
4716
|
-
0x00, 0x00, 0x02, 0x20, 0x88, 0x0a, 0x00, 0x03,
|
|
4717
|
-
0x01, 0x02, 0x05, 0x08, 0x00, 0x01, 0x09, 0x20,
|
|
4718
|
-
0x21, 0x18, 0x22, 0x00, 0x00, 0x00, 0x00, 0x18,
|
|
4719
|
-
0x28, 0x89, 0x80, 0x8b, 0x80, 0x90, 0x80, 0x92,
|
|
4720
|
-
0x80, 0x8d, 0x05, 0x80, 0x8a, 0x80, 0x88, 0x80,
|
|
4721
|
-
};
|
|
4722
|
-
|
|
4723
|
-
static const uint8_t unicode_prop_Emoji_Keycap_Sequence_table[4] = {
|
|
4724
|
-
0xa2, 0x05, 0x04, 0x89,
|
|
4725
|
-
};
|
|
4726
|
-
|
|
4727
4714
|
static const uint8_t * const unicode_prop_table[] = {
|
|
4728
4715
|
unicode_prop_Hyphen_table,
|
|
4729
4716
|
unicode_prop_Other_Math_table,
|
|
@@ -4842,7 +4829,6 @@ static const uint16_t unicode_prop_len_table[] = {
|
|
|
4842
4829
|
countof(unicode_prop_Case_Ignorable_table),
|
|
4843
4830
|
};
|
|
4844
4831
|
|
|
4845
|
-
/* RGI emoji sequence-property tables */
|
|
4846
4832
|
typedef enum {
|
|
4847
4833
|
UNICODE_SEQUENCE_PROP_Basic_Emoji,
|
|
4848
4834
|
UNICODE_SEQUENCE_PROP_Emoji_Keycap_Sequence,
|
|
@@ -5171,3 +5157,4 @@ static const uint8_t unicode_rgi_emoji_zwj_sequence[2392] = {
|
|
|
5171
5157
|
0x86, 0x02, 0x4b, 0x16, 0x40, 0x86, 0x02, 0x26,
|
|
5172
5158
|
0x19, 0x42, 0x86, 0x02, 0xd7, 0x19, 0x40, 0x86,
|
|
5173
5159
|
};
|
|
5160
|
+
|
|
@@ -1053,6 +1053,11 @@ int unicode_normalize(uint32_t **pdst, const uint32_t *src, int src_len,
|
|
|
1053
1053
|
int *buf, buf_len, i, p, starter_pos, cc, last_cc, out_len;
|
|
1054
1054
|
bool is_compat;
|
|
1055
1055
|
DynBuf dbuf_s, *dbuf = &dbuf_s;
|
|
1056
|
+
|
|
1057
|
+
if (src_len == 0) {
|
|
1058
|
+
*pdst = NULL;
|
|
1059
|
+
return 0;
|
|
1060
|
+
}
|
|
1056
1061
|
|
|
1057
1062
|
is_compat = n_type >> 1;
|
|
1058
1063
|
|
|
@@ -63,7 +63,10 @@ FMT(label_u16)
|
|
|
63
63
|
#define def(id, size, n_pop, n_push, f) DEF(id, size, n_pop, n_push, f)
|
|
64
64
|
#endif
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
/* Escape prefix. Subopcode 0/1 are the two debugger trap variants; other
|
|
67
|
+
subopcodes are rejected. Reusing the never-emitted invalid slot keeps the
|
|
68
|
+
primary opcode table within one byte. */
|
|
69
|
+
DEF( esc1, 2, 0, 0, u8)
|
|
67
70
|
|
|
68
71
|
/* push values */
|
|
69
72
|
DEF( push_i32, 5, 0, 1, i32)
|
|
@@ -77,6 +80,7 @@ DEF( push_this, 1, 0, 1, none) /* only used at the start of a function */
|
|
|
77
80
|
DEF( push_false, 1, 0, 1, none)
|
|
78
81
|
DEF( push_true, 1, 0, 1, none)
|
|
79
82
|
DEF( object, 1, 0, 1, none)
|
|
83
|
+
DEF( object_template, 3, 0, 1, u16)
|
|
80
84
|
DEF( special_object, 2, 0, 1, u8) /* only used at the start of a function */
|
|
81
85
|
DEF( rest, 3, 0, 1, u16) /* only used at the start of a function */
|
|
82
86
|
|
|
@@ -141,6 +145,14 @@ DEF( get_field, 5, 1, 1, atom)
|
|
|
141
145
|
DEF( get_field2, 5, 1, 2, atom)
|
|
142
146
|
DEF( put_field, 5, 2, 0, atom)
|
|
143
147
|
|
|
148
|
+
/* Inline-cache variants: atom:u32 followed by a u16 site index. Same stack
|
|
149
|
+
effects as the plain forms.
|
|
150
|
+
Emitted by resolve_labels when JS_ENABLE_IC; always defined and handled so
|
|
151
|
+
precompiled bytecode blobs stay valid regardless of the build flag. */
|
|
152
|
+
DEF( get_field_ic, 7, 1, 1, atom_u16)
|
|
153
|
+
DEF( get_field2_ic, 7, 1, 2, atom_u16)
|
|
154
|
+
DEF( put_field_ic, 7, 2, 0, atom_u16)
|
|
155
|
+
|
|
144
156
|
DEF( get_private_field, 1, 2, 1, none) /* obj prop -> value */
|
|
145
157
|
DEF( put_private_field, 1, 3, 0, none) /* obj value prop -> */
|
|
146
158
|
DEF(define_private_field, 1, 3, 1, none) /* obj prop value -> obj */
|
|
@@ -321,7 +333,8 @@ DEF( get_loc8, 2, 0, 1, loc8)
|
|
|
321
333
|
DEF( put_loc8, 2, 1, 0, loc8)
|
|
322
334
|
DEF( set_loc8, 2, 1, 1, loc8)
|
|
323
335
|
|
|
324
|
-
DEF(
|
|
336
|
+
DEF(get_loc_field_nr, 9, 0, 1, atom_u16)
|
|
337
|
+
|
|
325
338
|
DEF( get_loc0, 1, 0, 1, none_loc)
|
|
326
339
|
DEF( get_loc1, 1, 0, 1, none_loc)
|
|
327
340
|
DEF( get_loc2, 1, 0, 1, none_loc)
|
|
@@ -376,10 +389,6 @@ DEF( is_null, 1, 1, 1, none)
|
|
|
376
389
|
DEF(typeof_is_undefined, 1, 1, 1, none)
|
|
377
390
|
DEF( typeof_is_function, 1, 1, 1, none)
|
|
378
391
|
|
|
379
|
-
/* Debugger trap. The u8 operand carries JS_DEBUG_TRACE_* flags. Defined
|
|
380
|
-
unconditionally so opcode numbering never depends on JS_ENABLE_DEBUGGER. */
|
|
381
|
-
DEF( debug, 2, 0, 0, u8)
|
|
382
|
-
|
|
383
392
|
#undef DEF
|
|
384
393
|
#undef def
|
|
385
394
|
#endif /* DEF */
|