quickjs-done-nextgen/gen/function_source.c
Ben Noordhuis 37fe427d59
Add resizable ArrayBuffers (#646)
This commit implements resizable ArrayBuffers - RABs for short - and
extends typed arrays (TAs) to support fixed-length and length-tracking
modes.

SharedArrayBuffers (SABs) also support the maxByteLength option now but
I cheated and allocate all memory upfront because atomically resizing
memory allocations is hard and this commit is already big and complex.

The lion's share is updating all the TA prototype methods to deal with
RABs resizing underneath them. Method arguments can be arbitrary objects
with arbitrary .valueOf methods and arbitrary side effects, like...
resizing the RAB we're currently operating on.

Fixes: https://github.com/quickjs-ng/quickjs/issues/477
2024-11-05 21:55:42 +01:00

77 lines
2.8 KiB
C

/* File generated automatically by the QuickJS-ng compiler. */
#include "quickjs-libc.h"
const uint32_t qjsc_function_source_size = 338;
const uint8_t qjsc_function_source[338] = {
0x11, 0x05, 0x01, 0x30, 0x74, 0x65, 0x73, 0x74,
0x73, 0x2f, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x2e, 0x6a, 0x73, 0x01, 0x0c, 0x61, 0x63,
0x74, 0x75, 0x61, 0x6c, 0x01, 0x02, 0x66, 0x01,
0x0c, 0x65, 0x78, 0x70, 0x65, 0x63, 0x74, 0x01,
0x34, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x20, 0x66, 0x28, 0x29, 0x20, 0x7b, 0x20,
0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x34,
0x32, 0x20, 0x7d, 0x0d, 0xbc, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0c, 0x20, 0xfa, 0x01, 0xa2,
0x01, 0x00, 0x05, 0x00, 0x03, 0x02, 0x01, 0x74,
0x05, 0xbe, 0x03, 0x02, 0x00, 0x30, 0xc0, 0x03,
0x04, 0x00, 0x70, 0xbe, 0x03, 0x04, 0x02, 0x70,
0x10, 0x00, 0x01, 0x00, 0xe4, 0x01, 0x00, 0x01,
0x00, 0xc2, 0x03, 0x00, 0x0d, 0xc0, 0x03, 0x01,
0x01, 0x0c, 0x43, 0xfa, 0x01, 0xc0, 0x03, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0xbc,
0x2a, 0x28, 0xbc, 0x03, 0x03, 0x01, 0x04, 0x02,
0x1e, 0x0c, 0x0e, 0x1a, 0x66, 0x75, 0x6e, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x28, 0x29,
0x20, 0x7b, 0x20, 0x72, 0x65, 0x74, 0x75, 0x72,
0x6e, 0x20, 0x34, 0x32, 0x20, 0x7d, 0x0c, 0x03,
0xc2, 0x04, 0x08, 0xcc, 0x08, 0xea, 0x05, 0xbf,
0x00, 0xe2, 0x29, 0x04, 0xe2, 0x00, 0x00, 0x00,
0xe1, 0x61, 0x00, 0x00, 0xde, 0x42, 0x38, 0x00,
0x00, 0x00, 0x24, 0x00, 0x00, 0xc9, 0x62, 0x00,
0x00, 0x65, 0x00, 0x00, 0xaf, 0xea, 0x0b, 0x38,
0x95, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0xef,
0x2f, 0x61, 0x02, 0x00, 0x61, 0x01, 0x00, 0x38,
0x3b, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x04,
0xe0, 0x00, 0x00, 0x00, 0x9d, 0x31, 0x01, 0x00,
0x03, 0x00, 0xca, 0x62, 0x01, 0x00, 0x42, 0x38,
0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0xcb, 0x62,
0x02, 0x00, 0x65, 0x00, 0x00, 0xaf, 0xea, 0x0b,
0x38, 0x95, 0x00, 0x00, 0x00, 0x62, 0x02, 0x00,
0xef, 0x2f, 0x68, 0x02, 0x00, 0x68, 0x01, 0x00,
0x06, 0x2e, 0xbc, 0x03, 0x01, 0x01, 0x22, 0x1f,
0x01, 0x27, 0x1c, 0x1b, 0x04, 0x0a, 0x1d, 0x12,
0x26, 0x35, 0x17, 0x11, 0x18, 0x20, 0x1c, 0x37,
0x41, 0x21, 0x1c, 0x2a, 0x18, 0x1b, 0x04, 0x26,
0x11, 0x3f, 0x17, 0x11, 0x18, 0x20, 0x1c, 0x53,
0x41, 0x00,
};
static JSContext *JS_NewCustomContext(JSRuntime *rt)
{
JSContext *ctx = JS_NewContext(rt);
if (!ctx)
return NULL;
return ctx;
}
int main(int argc, char **argv)
{
JSRuntime *rt;
JSContext *ctx;
rt = JS_NewRuntime();
js_std_set_worker_new_context_func(JS_NewCustomContext);
js_std_init_handlers(rt);
JS_SetModuleLoaderFunc(rt, NULL, js_module_loader, NULL);
ctx = JS_NewCustomContext(rt);
js_std_add_helpers(ctx, argc, argv);
js_std_eval_binary(ctx, qjsc_function_source, qjsc_function_source_size, 0);
js_std_loop(ctx);
JS_FreeContext(ctx);
js_std_free_handlers(rt);
JS_FreeRuntime(rt);
return 0;
}