compiles
This commit is contained in:
@@ -178,7 +178,7 @@ static void nota_encode_value(NotaEncodeContext *enc, JSValueConst val, JSValueC
|
||||
break;
|
||||
}
|
||||
|
||||
if (JS_IsArray(ctx, replaced)) {
|
||||
if (JS_IsArray(replaced)) {
|
||||
if (nota_stack_has(enc, replaced)) {
|
||||
enc->cycle = 1;
|
||||
break;
|
||||
|
||||
@@ -150,7 +150,7 @@ static void encode_js_value(json_encoder *enc, JSContext *js, JSValue val) {
|
||||
const char *str = JS_ToCStringLen(js, &len, val);
|
||||
enc->writeString(enc, str, len);
|
||||
JS_FreeCString(js, str);
|
||||
} else if (JS_IsArray(js, val)) {
|
||||
} else if (JS_IsArray(val)) {
|
||||
encode_js_array(enc, js, val);
|
||||
} else if (JS_IsObject(val)) {
|
||||
encode_js_object(enc, js, val);
|
||||
|
||||
@@ -171,7 +171,7 @@ static void wota_encode_value(WotaEncodeContext *enc, JSValueConst val, JSValueC
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (JS_IsArray(ctx, replaced)) {
|
||||
if (JS_IsArray(replaced)) {
|
||||
if (wota_stack_has(enc, replaced)) {
|
||||
enc->cycle = 1;
|
||||
break;
|
||||
|
||||
819
source/quickjs.c
819
source/quickjs.c
File diff suppressed because it is too large
Load Diff
@@ -148,8 +148,14 @@ enum {
|
||||
JS_TAG_UNINITIALIZED = 0x17, /* 10111 */
|
||||
JS_TAG_STRING_IMM = 0x1B, /* 11011 - immediate ASCII (up to 7 chars) */
|
||||
JS_TAG_CATCH_OFFSET = 0x1F, /* 11111 */
|
||||
JS_TAG_FORWARD = 0x13, /* 10011 - forwarding pointer (GC internal use) */
|
||||
};
|
||||
|
||||
/* Compatibility tag aliases for external code */
|
||||
#define JS_TAG_STRING JS_TAG_STRING_IMM /* Alias: text/string type */
|
||||
#define JS_TAG_OBJECT JS_TAG_PTR /* Alias: use JS_IsRecord/JS_IsArray instead */
|
||||
#define JS_TAG_FLOAT64 JS_TAG_SHORT_FLOAT /* Alias: floats use short float encoding */
|
||||
|
||||
#define JS_EMPTY_TEXT ((JSValue)JS_TAG_STRING_IMM)
|
||||
|
||||
/* JSGCRef - for rooting values during GC */
|
||||
@@ -454,6 +460,18 @@ int JS_IsRegisteredClass (JSRuntime *rt, JSClassID class_id);
|
||||
|
||||
extern JSClassID js_class_id_alloc;
|
||||
|
||||
/* ============================================================
|
||||
Copying GC - No Reference Counting Needed
|
||||
============================================================
|
||||
With a copying GC, reference counting is not needed since all live
|
||||
objects are discovered by tracing from roots. These macros make
|
||||
existing DupValue/FreeValue calls into no-ops.
|
||||
============================================================ */
|
||||
#define JS_DupValue(ctx, v) (v)
|
||||
#define JS_FreeValue(ctx, v) ((void)0)
|
||||
#define JS_DupValueRT(rt, v) (v)
|
||||
#define JS_FreeValueRT(rt, v) ((void)0)
|
||||
|
||||
/* value handling */
|
||||
|
||||
static inline JSValue
|
||||
@@ -991,6 +1009,26 @@ JSValue js_debugger_fn_info (JSContext *ctx, JSValue fn);
|
||||
JSValue js_debugger_fn_bytecode (JSContext *js, JSValue fn);
|
||||
void *js_debugger_val_address (JSContext *js, JSValue val);
|
||||
|
||||
/* Memory allocation functions (bump allocator) */
|
||||
void *js_malloc (JSContext *ctx, size_t size);
|
||||
void *js_mallocz (JSContext *ctx, size_t size);
|
||||
void *js_realloc (JSContext *ctx, void *ptr, size_t size);
|
||||
void js_free (JSContext *ctx, void *ptr);
|
||||
char *js_strdup (JSContext *ctx, const char *str);
|
||||
|
||||
/* Runtime-level memory functions */
|
||||
void *js_malloc_rt (JSRuntime *rt, size_t size);
|
||||
void *js_mallocz_rt (JSRuntime *rt, size_t size);
|
||||
void js_free_rt (JSRuntime *rt, void *ptr);
|
||||
size_t js_malloc_usable_size_rt (JSRuntime *rt, const void *ptr);
|
||||
|
||||
/* Intrinsic setup functions */
|
||||
void JS_AddIntrinsicBaseObjects (JSContext *ctx);
|
||||
void JS_AddIntrinsicBasicObjects (JSContext *ctx);
|
||||
void JS_AddIntrinsicEval (JSContext *ctx);
|
||||
void JS_AddIntrinsicRegExp (JSContext *ctx);
|
||||
void JS_AddIntrinsicJSON (JSContext *ctx);
|
||||
|
||||
#undef js_unlikely
|
||||
#undef inline
|
||||
|
||||
|
||||
Reference in New Issue
Block a user