@agoric/xsnap 0.14.3-u13.0 → 0.14.3-u16.0
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/README.md +3 -3
- package/api.js +4 -2
- package/build.env +1 -1
- package/moddable/modules/data/base64/base64.js +28 -0
- package/moddable/modules/data/base64/manifest.json +11 -0
- package/moddable/modules/data/base64/modBase64.c +188 -0
- package/moddable/modules/data/binaryMessage/BinaryMessage.js +106 -0
- package/moddable/modules/data/crc/crc.c +205 -0
- package/moddable/modules/data/crc/crc.js +36 -0
- package/moddable/modules/data/crc/manifest.json +8 -0
- package/moddable/modules/data/hex/hex.js +28 -0
- package/moddable/modules/data/hex/manifest.json +11 -0
- package/moddable/modules/data/hex/modHex.c +139 -0
- package/moddable/modules/data/logical/logical.js +32 -0
- package/moddable/modules/data/logical/modLogical.c +98 -0
- package/moddable/modules/data/qrcode/manifest.json +9 -0
- package/moddable/modules/data/qrcode/qrcode.c +93 -0
- package/moddable/modules/data/qrcode/qrcode.js +23 -0
- package/moddable/modules/data/qrcode/qrcodegen.c +1025 -0
- package/moddable/modules/data/qrcode/qrcodegen.h +267 -0
- package/moddable/modules/data/text/decoder/manifest.json +8 -0
- package/moddable/modules/data/text/decoder/textdecoder.c +480 -0
- package/moddable/modules/data/text/decoder/textdecoder.js +27 -0
- package/moddable/modules/data/text/encoder/manifest.json +8 -0
- package/moddable/modules/data/text/encoder/textencoder.c +232 -0
- package/moddable/modules/data/text/encoder/textencoder.js +24 -0
- package/moddable/modules/data/tinyint/tinyint.c +150 -0
- package/moddable/modules/data/tinyint/tinyint.js +53 -0
- package/moddable/modules/data/url/manifest.json +17 -0
- package/moddable/modules/data/url/url.c +1959 -0
- package/moddable/modules/data/url/url.js +210 -0
- package/moddable/modules/data/wavreader/manifest.json +8 -0
- package/moddable/modules/data/wavreader/wavreader.js +128 -0
- package/moddable/modules/data/zlib/deflate.c +161 -0
- package/moddable/modules/data/zlib/deflate.js +63 -0
- package/moddable/modules/data/zlib/inflate.c +145 -0
- package/moddable/modules/data/zlib/inflate.js +66 -0
- package/moddable/modules/data/zlib/manifest_deflate.json +9 -0
- package/moddable/modules/data/zlib/manifest_inflate.json +9 -0
- package/moddable/modules/data/zlib/miniz.c +4924 -0
- package/moddable/xs/includes/xs.d.ts +73 -0
- package/moddable/xs/includes/xs.h +1533 -0
- package/moddable/xs/includes/xsmc.h +206 -0
- package/moddable/xs/makefiles/lin/makefile +33 -0
- package/moddable/xs/makefiles/lin/xsc.mk +118 -0
- package/moddable/xs/makefiles/lin/xsid.mk +90 -0
- package/moddable/xs/makefiles/lin/xsl.mk +168 -0
- package/moddable/xs/makefiles/lin/xst.mk +201 -0
- package/moddable/xs/makefiles/mac/makefile +33 -0
- package/moddable/xs/makefiles/mac/xsc.mk +130 -0
- package/moddable/xs/makefiles/mac/xsid.mk +102 -0
- package/moddable/xs/makefiles/mac/xsl.mk +177 -0
- package/moddable/xs/makefiles/mac/xst.mk +203 -0
- package/moddable/xs/makefiles/mac/xst_no_asan.txt +52 -0
- package/moddable/xs/makefiles/win/build.bat +26 -0
- package/moddable/xs/makefiles/win/xsc.mak +142 -0
- package/moddable/xs/makefiles/win/xsid.mak +113 -0
- package/moddable/xs/makefiles/win/xsl.mak +186 -0
- package/moddable/xs/makefiles/win/xst.mak +195 -0
- package/moddable/xs/platforms/lin_xs.h +99 -0
- package/moddable/xs/platforms/mac_xs.h +97 -0
- package/moddable/xs/platforms/wasm_xs.h +79 -0
- package/moddable/xs/platforms/win_xs.h +104 -0
- package/moddable/xs/platforms/xsHost.h +63 -0
- package/moddable/xs/platforms/xsPlatform.h +618 -0
- package/moddable/xs/sources/xsAPI.c +2555 -0
- package/moddable/xs/sources/xsAll.c +294 -0
- package/moddable/xs/sources/xsAll.h +2741 -0
- package/moddable/xs/sources/xsArguments.c +222 -0
- package/moddable/xs/sources/xsArray.c +2657 -0
- package/moddable/xs/sources/xsAtomics.c +844 -0
- package/moddable/xs/sources/xsBigInt.c +1859 -0
- package/moddable/xs/sources/xsBoolean.c +109 -0
- package/moddable/xs/sources/xsCode.c +4493 -0
- package/moddable/xs/sources/xsCommon.c +1710 -0
- package/moddable/xs/sources/xsCommon.h +1142 -0
- package/moddable/xs/sources/xsDataView.c +2890 -0
- package/moddable/xs/sources/xsDate.c +1541 -0
- package/moddable/xs/sources/xsDebug.c +2710 -0
- package/moddable/xs/sources/xsDefaults.c +134 -0
- package/moddable/xs/sources/xsError.c +353 -0
- package/moddable/xs/sources/xsFunction.c +776 -0
- package/moddable/xs/sources/xsGenerator.c +865 -0
- package/moddable/xs/sources/xsGlobal.c +839 -0
- package/moddable/xs/sources/xsJSON.c +1091 -0
- package/moddable/xs/sources/xsLexical.c +1969 -0
- package/moddable/xs/sources/xsLockdown.c +933 -0
- package/moddable/xs/sources/xsMapSet.c +1649 -0
- package/moddable/xs/sources/xsMarshall.c +1020 -0
- package/moddable/xs/sources/xsMath.c +624 -0
- package/moddable/xs/sources/xsMemory.c +1941 -0
- package/moddable/xs/sources/xsModule.c +3101 -0
- package/moddable/xs/sources/xsNumber.c +560 -0
- package/moddable/xs/sources/xsObject.c +1102 -0
- package/moddable/xs/sources/xsPlatforms.c +480 -0
- package/moddable/xs/sources/xsProfile.c +577 -0
- package/moddable/xs/sources/xsPromise.c +1199 -0
- package/moddable/xs/sources/xsProperty.c +636 -0
- package/moddable/xs/sources/xsProxy.c +1014 -0
- package/moddable/xs/sources/xsRegExp.c +1168 -0
- package/moddable/xs/sources/xsRun.c +4889 -0
- package/moddable/xs/sources/xsScope.c +1293 -0
- package/moddable/xs/sources/xsScript.c +288 -0
- package/moddable/xs/sources/xsScript.h +1186 -0
- package/moddable/xs/sources/xsSnapshot.c +2161 -0
- package/moddable/xs/sources/xsSnapshot.h +51 -0
- package/moddable/xs/sources/xsSourceMap.c +218 -0
- package/moddable/xs/sources/xsString.c +3332 -0
- package/moddable/xs/sources/xsSymbol.c +503 -0
- package/moddable/xs/sources/xsSyntaxical.c +4193 -0
- package/moddable/xs/sources/xsTree.c +1893 -0
- package/moddable/xs/sources/xsType.c +1488 -0
- package/moddable/xs/sources/xsdtoa.c +6672 -0
- package/moddable/xs/sources/xsmc.c +340 -0
- package/moddable/xs/sources/xsre.c +7578 -0
- package/package.json +39 -22
- package/scripts/get_xsnap_version.sh +14 -0
- package/scripts/test-package.sh +21 -0
- package/src/avaAssertXS.js +6 -2
- package/src/avaHandler.cjs +2 -5
- package/src/avaXS.js +7 -8
- package/src/build.js +161 -28
- package/src/replay.js +0 -3
- package/src/xsnap.js +105 -91
- package/src/xsrepl.js +2 -3
- package/xsnap-native/xsnap/makefiles/lin/makefile +10 -0
- package/xsnap-native/xsnap/makefiles/lin/xsnap-worker.mk +156 -0
- package/xsnap-native/xsnap/makefiles/lin/xsnap.mk +144 -0
- package/xsnap-native/xsnap/makefiles/mac/makefile +10 -0
- package/xsnap-native/xsnap/makefiles/mac/xsnap-worker.mk +165 -0
- package/xsnap-native/xsnap/makefiles/mac/xsnap.mk +153 -0
- package/xsnap-native/xsnap/sources/xsnap-worker.c +1008 -0
- package/xsnap-native/xsnap/sources/xsnap.c +717 -0
- package/xsnap-native/xsnap/sources/xsnap.h +142 -0
- package/xsnap-native/xsnap/sources/xsnapPlatform.c +1501 -0
- package/xsnap-native/xsnap/sources/xsnapPlatform.h +105 -0
- package/CHANGELOG.md +0 -646
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-2017 Moddable Tech, Inc.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Moddable SDK Runtime.
|
|
5
|
+
*
|
|
6
|
+
* The Moddable SDK Runtime is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
* (at your option) any later version.
|
|
10
|
+
*
|
|
11
|
+
* The Moddable SDK Runtime is distributed in the hope that it will be useful,
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
* GNU Lesser General Public License for more details.
|
|
15
|
+
*
|
|
16
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
* along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*
|
|
19
|
+
* This file incorporates work covered by the following copyright and
|
|
20
|
+
* permission notice:
|
|
21
|
+
*
|
|
22
|
+
* Copyright (C) 2010-2016 Marvell International Ltd.
|
|
23
|
+
* Copyright (C) 2002-2010 Kinoma, Inc.
|
|
24
|
+
*
|
|
25
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26
|
+
* you may not use this file except in compliance with the License.
|
|
27
|
+
* You may obtain a copy of the License at
|
|
28
|
+
*
|
|
29
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
30
|
+
*
|
|
31
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
32
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
33
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
34
|
+
* See the License for the specific language governing permissions and
|
|
35
|
+
* limitations under the License.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
#include "xsAll.h"
|
|
39
|
+
|
|
40
|
+
static txBoolean fxArgumentsSloppyDefineOwnProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txSlot* descriptor, txFlag mask);
|
|
41
|
+
static txBoolean fxArgumentsSloppyDeleteProperty(txMachine* the, txSlot* instance, txID id, txIndex index);
|
|
42
|
+
static txSlot* fxArgumentsSloppyGetProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txFlag flag);
|
|
43
|
+
static txSlot* fxArgumentsSloppySetProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txFlag flag);
|
|
44
|
+
|
|
45
|
+
const txBehavior ICACHE_FLASH_ATTR gxArgumentsSloppyBehavior = {
|
|
46
|
+
fxArgumentsSloppyGetProperty,
|
|
47
|
+
fxArgumentsSloppySetProperty,
|
|
48
|
+
fxOrdinaryCall,
|
|
49
|
+
fxOrdinaryConstruct,
|
|
50
|
+
fxArgumentsSloppyDefineOwnProperty,
|
|
51
|
+
fxArgumentsSloppyDeleteProperty,
|
|
52
|
+
fxOrdinaryGetOwnProperty,
|
|
53
|
+
fxOrdinaryGetPropertyValue,
|
|
54
|
+
fxOrdinaryGetPrototype,
|
|
55
|
+
fxOrdinaryHasProperty,
|
|
56
|
+
fxOrdinaryIsExtensible,
|
|
57
|
+
fxOrdinaryOwnKeys,
|
|
58
|
+
fxOrdinaryPreventExtensions,
|
|
59
|
+
fxOrdinarySetPropertyValue,
|
|
60
|
+
fxOrdinarySetPrototype,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
void fxBuildArguments(txMachine* the)
|
|
64
|
+
{
|
|
65
|
+
mxPush(mxObjectPrototype);
|
|
66
|
+
mxArgumentsSloppyPrototype = *the->stack;
|
|
67
|
+
mxPop();
|
|
68
|
+
|
|
69
|
+
mxPush(mxObjectPrototype);
|
|
70
|
+
mxArgumentsStrictPrototype = *the->stack;
|
|
71
|
+
mxPop();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
txSlot* fxNewArgumentsSloppyInstance(txMachine* the, txIndex count)
|
|
75
|
+
{
|
|
76
|
+
txSlot* instance;
|
|
77
|
+
txSlot* array;
|
|
78
|
+
txSlot* property;
|
|
79
|
+
txIndex index;
|
|
80
|
+
txSlot* address;
|
|
81
|
+
txIndex length = (txIndex)mxArgc;
|
|
82
|
+
instance = fxNewObjectInstance(the);
|
|
83
|
+
instance->flag |= XS_EXOTIC_FLAG;
|
|
84
|
+
array = instance->next = fxNewSlot(the);
|
|
85
|
+
array->flag = XS_INTERNAL_FLAG;
|
|
86
|
+
array->ID = XS_ARGUMENTS_SLOPPY_BEHAVIOR;
|
|
87
|
+
array->kind = XS_ARRAY_KIND;
|
|
88
|
+
array->value.array.length = 0;
|
|
89
|
+
array->value.array.address = C_NULL;
|
|
90
|
+
property = fxNextNumberProperty(the, array, length, mxID(_length), XS_DONT_ENUM_FLAG);
|
|
91
|
+
property = fxNextSlotProperty(the, property, mxFunction, mxID(_callee), XS_DONT_ENUM_FLAG);
|
|
92
|
+
property = fxNextSlotProperty(the, property, &mxArrayIteratorFunction, mxID(_Symbol_iterator), XS_DONT_ENUM_FLAG);
|
|
93
|
+
fxSetIndexSize(the, array, length, XS_CHUNK);
|
|
94
|
+
index = 0;
|
|
95
|
+
address = array->value.array.address;
|
|
96
|
+
property = the->scope + count;
|
|
97
|
+
while ((index < length) && (index < count)) {
|
|
98
|
+
*((txIndex*)address) = index;
|
|
99
|
+
address->ID = XS_NO_ID;
|
|
100
|
+
if (property->kind == XS_CLOSURE_KIND) {
|
|
101
|
+
address->kind = property->kind;
|
|
102
|
+
address->value = property->value;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
txSlot* argument = mxArgv(index);
|
|
106
|
+
address->kind = argument->kind;
|
|
107
|
+
address->value = argument->value;
|
|
108
|
+
}
|
|
109
|
+
index++;
|
|
110
|
+
address++;
|
|
111
|
+
property--;
|
|
112
|
+
}
|
|
113
|
+
while (index < length) {
|
|
114
|
+
property = mxArgv(index);
|
|
115
|
+
*((txIndex*)address) = index;
|
|
116
|
+
address->ID = XS_NO_ID;
|
|
117
|
+
address->kind = property->kind;
|
|
118
|
+
address->value = property->value;
|
|
119
|
+
index++;
|
|
120
|
+
address++;
|
|
121
|
+
}
|
|
122
|
+
return instance;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
txBoolean fxArgumentsSloppyDefineOwnProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txSlot* descriptor, txFlag mask)
|
|
126
|
+
{
|
|
127
|
+
if (!id) {
|
|
128
|
+
txSlot* property = fxGetIndexProperty(the, instance->next, index);
|
|
129
|
+
if (property && (property->kind == XS_CLOSURE_KIND)) {
|
|
130
|
+
txSlot* closure = property->value.closure;
|
|
131
|
+
if (mask & XS_ACCESSOR_FLAG) {
|
|
132
|
+
property->flag = closure->flag;
|
|
133
|
+
property->kind = closure->kind;
|
|
134
|
+
property->value = closure->value;
|
|
135
|
+
}
|
|
136
|
+
else if ((descriptor->flag & XS_DONT_SET_FLAG) && (mask & XS_DONT_SET_FLAG)) {
|
|
137
|
+
property->flag = closure->flag;
|
|
138
|
+
property->kind = closure->kind;
|
|
139
|
+
property->value = closure->value;
|
|
140
|
+
if (descriptor->kind != XS_UNINITIALIZED_KIND) {
|
|
141
|
+
closure->kind = descriptor->kind;
|
|
142
|
+
closure->value = descriptor->value;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return fxOrdinaryDefineOwnProperty(the, instance, id, index, descriptor, mask);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
txBoolean fxArgumentsSloppyDeleteProperty(txMachine* the, txSlot* instance, txID id, txIndex index)
|
|
151
|
+
{
|
|
152
|
+
if (!id) {
|
|
153
|
+
txSlot* property = fxGetIndexProperty(the, instance->next, index);
|
|
154
|
+
if (property && (property->kind == XS_CLOSURE_KIND)) {
|
|
155
|
+
if (property->value.closure->flag & XS_DONT_DELETE_FLAG)
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return fxOrdinaryDeleteProperty(the, instance, id, index);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
txSlot* fxArgumentsSloppyGetProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txFlag flag)
|
|
163
|
+
{
|
|
164
|
+
txSlot* result = fxOrdinaryGetProperty(the, instance, id, index, flag);
|
|
165
|
+
if (!id && result && result->kind == XS_CLOSURE_KIND)
|
|
166
|
+
result = result->value.closure;
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
txSlot* fxArgumentsSloppySetProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txFlag flag)
|
|
171
|
+
{
|
|
172
|
+
txSlot* result = fxOrdinarySetProperty(the, instance, id, index, flag);
|
|
173
|
+
if (!id && result && result->kind == XS_CLOSURE_KIND)
|
|
174
|
+
result = result->value.closure;
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
txSlot* fxNewArgumentsStrictInstance(txMachine* the, txIndex count)
|
|
179
|
+
{
|
|
180
|
+
txSlot* instance;
|
|
181
|
+
txSlot* array;
|
|
182
|
+
txSlot* property;
|
|
183
|
+
txSlot* function;
|
|
184
|
+
txIndex index;
|
|
185
|
+
txSlot* address;
|
|
186
|
+
txIndex length = (txIndex)mxArgc;
|
|
187
|
+
instance = fxNewObjectInstance(the);
|
|
188
|
+
instance->flag |= XS_EXOTIC_FLAG;
|
|
189
|
+
array = instance->next = fxNewSlot(the);
|
|
190
|
+
array->flag = XS_INTERNAL_FLAG;
|
|
191
|
+
array->ID = XS_ARGUMENTS_STRICT_BEHAVIOR;
|
|
192
|
+
array->kind = XS_ARRAY_KIND;
|
|
193
|
+
array->value.array.length = 0;
|
|
194
|
+
array->value.array.address = C_NULL;
|
|
195
|
+
property = fxNextNumberProperty(the, array, length, mxID(_length), XS_DONT_ENUM_FLAG);
|
|
196
|
+
property = fxNextSlotProperty(the, property, &mxArrayIteratorFunction, mxID(_Symbol_iterator), XS_DONT_ENUM_FLAG);
|
|
197
|
+
function = mxThrowTypeErrorFunction.value.reference;
|
|
198
|
+
property = property->next = fxNewSlot(the);
|
|
199
|
+
property->flag = XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG;
|
|
200
|
+
property->ID = mxID(_callee);
|
|
201
|
+
property->kind = XS_ACCESSOR_KIND;
|
|
202
|
+
property->value.accessor.getter = function;
|
|
203
|
+
property->value.accessor.setter = function;
|
|
204
|
+
fxSetIndexSize(the, array, length, XS_CHUNK);
|
|
205
|
+
index = 0;
|
|
206
|
+
address = array->value.array.address;
|
|
207
|
+
while (index < length) {
|
|
208
|
+
property = mxArgv(index);
|
|
209
|
+
*((txIndex*)address) = index;
|
|
210
|
+
address->ID = XS_NO_ID;
|
|
211
|
+
address->kind = property->kind;
|
|
212
|
+
address->value = property->value;
|
|
213
|
+
index++;
|
|
214
|
+
address++;
|
|
215
|
+
}
|
|
216
|
+
return instance;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
void fxThrowTypeError(txMachine* the)
|
|
220
|
+
{
|
|
221
|
+
mxTypeError("strict mode");
|
|
222
|
+
}
|