Merge branch 'gen_dylib'
This commit is contained in:
@@ -1688,6 +1688,34 @@ int ctx_gc (JSContext *ctx, int allow_grow, size_t alloc_size) {
|
||||
scan += obj_size;
|
||||
}
|
||||
|
||||
#ifdef VALIDATE_GC
|
||||
{
|
||||
JSRecord *grec = JS_VALUE_GET_RECORD(ctx->global_obj);
|
||||
uint32_t mask = (uint32_t)objhdr_cap56(grec->mist_hdr);
|
||||
for (uint32_t i = 1; i <= mask; i++) {
|
||||
JSValue k = grec->slots[i].key;
|
||||
if (!rec_key_is_empty(k) && !rec_key_is_tomb(k)) {
|
||||
if (!JS_IsPtr(k)) {
|
||||
fprintf(stderr, "VALIDATE_GC: global slot[%u] key is not a pointer (tag=0x%llx)\n",
|
||||
i, (unsigned long long)k);
|
||||
} else {
|
||||
void *kp = JS_VALUE_GET_PTR(k);
|
||||
if (!ptr_in_range(kp, to_base, to_free) && !is_ct_ptr(ctx, kp)) {
|
||||
fprintf(stderr, "VALIDATE_GC: global slot[%u] key=%p outside valid ranges\n", i, kp);
|
||||
}
|
||||
}
|
||||
JSValue v = grec->slots[i].val;
|
||||
if (JS_IsPtr(v)) {
|
||||
void *vp = JS_VALUE_GET_PTR(v);
|
||||
if (!ptr_in_range(vp, to_base, to_free) && !is_ct_ptr(ctx, vp)) {
|
||||
fprintf(stderr, "VALIDATE_GC: global slot[%u] val=%p outside valid ranges\n", i, vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return old block (in poison mode, just poison it and leak) */
|
||||
heap_block_free (rt, from_base, old_heap_size);
|
||||
|
||||
@@ -1960,6 +1988,7 @@ JSContext *JS_NewContext (JSRuntime *rt) {
|
||||
if (!ctx) return NULL;
|
||||
JS_AddIntrinsicBaseObjects (ctx);
|
||||
JS_AddIntrinsicRegExp (ctx);
|
||||
obj_set_stone (JS_VALUE_GET_RECORD (ctx->global_obj));
|
||||
return ctx;
|
||||
}
|
||||
|
||||
@@ -1967,7 +1996,8 @@ JSContext *JS_NewContextWithHeapSize (JSRuntime *rt, size_t heap_size) {
|
||||
JSContext *ctx = JS_NewContextRawWithHeapSize (rt, heap_size);
|
||||
if (!ctx) return NULL;
|
||||
JS_AddIntrinsicBaseObjects (ctx);
|
||||
JS_AddIntrinsicRegExp (ctx);
|
||||
JS_AddIntrinsicRegExp (ctx);
|
||||
obj_set_stone (JS_VALUE_GET_RECORD (ctx->global_obj));
|
||||
return ctx;
|
||||
}
|
||||
|
||||
@@ -3046,7 +3076,7 @@ JSValue JS_ThrowError2 (JSContext *ctx, JSErrorEnum error_num, const char *fmt,
|
||||
if (add_backtrace) {
|
||||
print_backtrace (ctx, NULL, 0, 0);
|
||||
}
|
||||
return JS_Throw (ctx, JS_NULL);
|
||||
return JS_Throw (ctx, JS_TRUE);
|
||||
}
|
||||
|
||||
static JSValue JS_ThrowError (JSContext *ctx, JSErrorEnum error_num, const char *fmt, va_list ap) {
|
||||
|
||||
Reference in New Issue
Block a user