function stringlengths 2 46 | definition stringlengths 102 1.91k | relative_line_number int64 1 48 |
|---|---|---|
free_object | static void free_object(JSRuntime *rt, JSObject *p)
{
int i;
JSClassFinalizer *finalizer;
JSShape *sh;
JSShapeProperty *pr;
p->free_mark = 1; /* used to tell the object is invalid when
freeing cycles */
/* free all the fields */
sh = p->shape;
pr = get_shape_pro... | 30 |
js_bigint_from_float64 | static JSBigInt *js_bigint_from_float64(JSContext *ctx, int *pres, double a1)
{
uint64_t a = float64_as_uint64(a1);
int sgn, e, shift;
uint64_t mant;
JSBigIntBuf buf;
JSBigInt *r;
sgn = a >> 63;
e = (a >> 52) & ((1 << 11) - 1);
mant = a & (((uint64_t)1 << 52) - 1);
if (e == 2047) {
... | 31 |
unicode_compose_pair | /* return 0 if no pair found */
static int unicode_compose_pair(uint32_t c0, uint32_t c1)
{
uint32_t code, len, type, v, idx1, d_idx, d_offset, ch;
int idx_min, idx_max, idx, d;
uint32_t pair[2];
idx_min = 0;
idx_max = countof(unicode_comp_table) - 1; // <-- You need to hit this breakpoint
whil... | 8 |
optimize_scope_make_ref | static int optimize_scope_make_ref(JSContext *ctx, JSFunctionDef *s,
DynBuf *bc, uint8_t *bc_buf,
LabelSlot *ls, int pos_next,
int get_op, int var_idx)
{
int label_pos, end_pos, pos;
/* XXX: should optimize... | 17 |
mark_weak_map_value | static void mark_weak_map_value(JSRuntime *rt, JSWeakRefRecord *first_weak_ref, JS_MarkFunc *mark_func) {
JSWeakRefRecord *wr;
JSMapRecord *mr;
JSMapState *s;
for (wr = first_weak_ref; wr != NULL; wr = wr->next_weak_ref) {
if (wr->kind == JS_WEAK_REF_KIND_MAP) {
mr = wr->u.map_recor... | 11 |
js_map_forEach | static JSValue js_map_forEach(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv, int magic)
{
JSMapState *s = JS_GetOpaque2(ctx, this_val, JS_CLASS_MAP + magic);
JSValueConst func, this_arg;
JSValue ret, args[3];
struct list_head *el;
JSMapRecord *mr; ... | 7 |
JS_ReadTypedArray | static JSValue JS_ReadTypedArray(BCReaderState *s)
{
JSContext *ctx = s->ctx;
JSValue obj = JS_UNDEFINED, array_buffer = JS_UNDEFINED;
uint8_t array_tag;
JSValueConst args[3];
uint32_t offset, len, idx;
if (bc_get_u8(s, &array_tag))
return JS_EXCEPTION;
if (array_tag >= JS_TYPED_ARR... | 10 |
js_dataview_get_byteLength | static JSValue js_dataview_get_byteLength(JSContext *ctx, JSValueConst this_val)
{
JSArrayBuffer *abuf;
JSTypedArray *ta;
JSObject *p;
p = get_dataview(ctx, this_val); // <-- You need to hit this breakpoint
if (!p)
return JS_EXCEPTION;
if (dataview_is_oob(p))
return JS_ThrowType... | 6 |
JS_AddBrand | static int JS_AddBrand(JSContext *ctx, JSValueConst obj, JSValueConst home_obj)
{
JSObject *p, *p1;
JSShapeProperty *prs;
JSProperty *pr;
JSValue brand;
JSAtom brand_atom;
if (unlikely(JS_VALUE_GET_TAG(home_obj) != JS_TAG_OBJECT)) {
JS_ThrowTypeErrorNotAnObject(ctx);
return -1;
... | 26 |
max_int | static inline int max_int(int a, int b)
{
if (a > b)
return a;
else // <-- You need to hit this breakpoint
return b;
} | 4 |
is_standalone | static bool is_standalone(const char *exe)
{
FILE *exe_f = fopen(exe, "rb");
if (!exe_f)
return false;
if (fseek(exe_f, -trailer_size, SEEK_END) < 0)
goto fail;
uint8_t buf[TRAILER_SIZE];
if (fread(buf, 1, trailer_size, exe_f) != trailer_size)
goto fail;
fclose(exe_f);
... | 14 |
JS_NewSymbolInternal | /* 'p' is freed */
static JSValue JS_NewSymbolInternal(JSContext *ctx, JSString *p, int atom_type)
{
JSRuntime *rt = ctx->rt;
JSAtom atom; // <-- You need to hit this breakpoint
atom = __JS_NewAtom(rt, p, atom_type);
if (atom == JS_ATOM_NULL)
return JS_ThrowOutOfMemory(ctx);
return JS_MKPTR(... | 4 |
js_string_charCodeAt | static JSValue js_string_charCodeAt(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
JSValue val, ret;
JSString *p;
int idx, c;
val = JS_ToStringCheckObject(ctx, this_val);
if (JS_IsException(val))
return val;
p = JS_VALUE_GET_S... | 18 |
js_std_file_readAs | /* XXX: could use less memory and go faster */
static JSValue js_std_file_readAs(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv, int magic)
{
FILE *f = js_std_file_get(ctx, this_val);
int c;
DynBuf dbuf;
JSValue obj;
uint64_t max_size64;
siz... | 19 |
async_func_resume | static JSValue async_func_resume(JSContext *ctx, JSAsyncFunctionState *s)
{
JSValue func_obj;
if (js_check_stack_overflow(ctx->rt, 0))
return JS_ThrowStackOverflow(ctx); // <-- You need to hit this breakpoint
/* the tag does not matter provided it is not an object */
func_obj = JS_MKPTR(JS_TAG... | 5 |
js_reflect_setPrototypeOf | static JSValue js_reflect_setPrototypeOf(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
int ret;
ret = JS_SetPrototypeInternal(ctx, argv[0], argv[1], false);
if (ret < 0)
return JS_EXCEPTION;
else // <-- You need to hit this breakp... | 7 |
get_line | char *get_line(char *buf, int buf_size, FILE *f)
{
int len;
if (!fgets(buf, buf_size, f))
return NULL;
len = strlen(buf);
if (len > 0 && buf[len - 1] == '\n')
buf[len - 1] = '\0'; // <-- You need to hit this breakpoint
return buf;
} | 7 |
js_os_readdir | /* return [array, errorcode] */
static JSValue js_os_readdir(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
const char *path;
DIR *f;
struct dirent *d;
JSValue obj;
int err;
uint32_t len;
path = JS_ToCString(ctx, argv[0]); // <-- You need... | 11 |
js_object_isPrototypeOf | static JSValue js_object_isPrototypeOf(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
JSValue obj, v1;
JSValueConst v;
int res;
v = argv[0];
if (!JS_IsObject(v)) // <-- You need to hit this breakpoint
return JS_FALSE;
obj = ... | 8 |
lre_is_in_table | static bool lre_is_in_table(uint32_t c, const uint8_t *table,
const uint8_t *index_table, int index_table_len)
{
uint32_t code, b, bit;
int pos;
const uint8_t *p;
pos = get_index_pos(&code, c, index_table, index_table_len);
if (pos < 0)
return false; /* outside t... | 11 |
namelist_cmp | int namelist_cmp(const char *a, const char *b)
{
/* compare strings in modified lexicographical order */
for (;;) {
int ca = (unsigned char)*a++;
int cb = (unsigned char)*b++; // <-- You need to hit this breakpoint
if (isdigit(ca) && isdigit(cb)) {
int na = ca - '0';
... | 5 |
js_host_resolve_imported_module | /* return NULL in case of exception (e.g. module could not be loaded) */
/* `base_cname` and `cname1` may be pure ASCII or UTF-8 encoded */
static JSModuleDef *js_host_resolve_imported_module(JSContext *ctx,
const char *base_cname,
... | 47 |
raw_context_global_var | // https://github.com/quickjs-ng/quickjs/issues/914
static void raw_context_global_var(void)
{
JSRuntime *rt = JS_NewRuntime(); // <-- You need to hit this breakpoint
JSContext *ctx = JS_NewContextRaw(rt);
JS_AddIntrinsicEval(ctx);
{
static const char code[] = "globalThis";
JSValue ret =... | 3 |
value_buffer_append | static int value_buffer_append(ValueBuffer *b, JSValue val)
{
if (b->error_status)
return -1; // <-- You need to hit this breakpoint
if (b->len >= b->size) {
int new_size = (b->len + (b->len >> 1) + 31) & ~16;
size_t slack;
JSValue *new_arr;
if (b->arr == b->def) {
... | 3 |
js_async_from_sync_iterator_finalizer | static void js_async_from_sync_iterator_finalizer(JSRuntime *rt,
JSValueConst val)
{
JSAsyncFromSyncIteratorData *s =
JS_GetOpaque(val, JS_CLASS_ASYNC_FROM_SYNC_ITERATOR); // <-- You need to hit this breakpoint
if (s) {
JS_FreeValueRT(rt, s->sync... | 4 |
js_std_getenviron | static JSValue js_std_getenviron(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
char **envp;
const char *name, *p, *value;
JSValue obj;
uint32_t idx;
size_t name_len;
JSAtom atom;
int ret;
obj = JS_NewObject(ctx);
if (JS_IsExc... | 12 |
extract_desc | char *extract_desc(const char *buf)
{
const char *p, *desc_start;
char *desc;
int len;
p = buf;
while (*p != '\0') {
if (p[0] == '/' && p[1] == '*' && p[2] == '-' && p[3] != '/') {
p += 3;
desc_start = p;
while (*p != '\0' && (p[0] != '*' || p[1] != '/'))... | 20 |
js_atomics_notify | static JSValue js_atomics_notify(JSContext *ctx,
JSValueConst this_obj,
int argc, JSValueConst *argv)
{
struct list_head *el, *el1, waiter_list;
int32_t count, n;
void *ptr;
JSAtomicsWaiter *waiter;
JSArrayBuffer *abuf;
ptr = js_... | 40 |
js_bigint_shl | static JSBigInt *js_bigint_shl(JSContext *ctx, const JSBigInt *a,
unsigned int shift1)
{
int d, i, shift;
JSBigInt *r;
js_limb_t l; // <-- You need to hit this breakpoint
if (a->len == 1 && a->tab[0] == 0)
return js_bigint_new_si(ctx, 0); /* zero case */
d = s... | 5 |
js_std_getenviron | static JSValue js_std_getenviron(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
char **envp;
const char *name, *p, *value;
JSValue obj;
uint32_t idx;
size_t name_len;
JSAtom atom;
int ret;
obj = JS_NewObject(ctx);
if (JS_IsExc... | 22 |
js_std_getenv | static JSValue js_std_getenv(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
const char *name, *str;
name = JS_ToCString(ctx, argv[0]);
if (!name)
return JS_EXCEPTION;
str = getenv(name);
JS_FreeCString(ctx, name);
if (!str) // <-- You ... | 9 |
js_callsite_mark | static void js_callsite_mark(JSRuntime *rt, JSValueConst val,
JS_MarkFunc *mark_func)
{
JSCallSiteData *csd = JS_GetOpaque(val, JS_CLASS_CALL_SITE); // <-- You need to hit this breakpoint
if (csd) {
JS_MarkValue(rt, csd->filename, mark_func);
JS_MarkValue(rt, csd->fu... | 3 |
string_buffer_putc_slow | static no_inline int string_buffer_putc_slow(StringBuffer *s, uint32_t c)
{
if (unlikely(s->len >= s->size)) {
if (string_buffer_realloc(s, s->len + 1, c))
return -1;
}
if (s->is_wide_char) {
str16(s->str)[s->len++] = c;
} else if (c < 0x100) {
str8(s->str)[s->len++] ... | 13 |
parse_digits | static int parse_digits(const uint8_t **pp, bool allow_overflow)
{
const uint8_t *p;
uint64_t v; // <-- You need to hit this breakpoint
int c;
p = *pp;
v = 0;
for(;;) {
c = *p;
if (c < '0' || c > '9')
break;
v = v * 10 + c - '0';
if (v >= INT32_MAX) {... | 3 |
JS_DefinePropertyDesc | static __exception int JS_DefinePropertyDesc(JSContext *ctx, JSValueConst obj,
JSAtom prop, JSValueConst desc,
int flags)
{
JSPropertyDescriptor d;
int ret;
if (js_obj_to_desc(ctx, &d, desc) < 0)
return -1;
... | 13 |
get_exported_names | static __exception int get_exported_names(JSContext *ctx,
GetExportNamesState *s, // <-- You need to hit this breakpoint
JSModuleDef *m, bool from_star)
{
ExportedNameEntry *en;
int i, j;
/* check circular reference */
... | 1 |
js_async_generator_await | static int js_async_generator_await(JSContext *ctx,
JSAsyncGeneratorData *s,
JSValue value)
{
JSValue promise, resolving_funcs[2], resolving_funcs1[2];
int i, res;
promise = js_promise_resolve(ctx, ctx->promise_ctor,
... | 12 |
js_weakref_constructor | static JSValue js_weakref_constructor(JSContext *ctx, JSValueConst new_target,
int argc, JSValueConst *argv)
{
if (JS_IsUndefined(new_target))
return JS_ThrowTypeError(ctx, "constructor requires 'new'");
JSValueConst arg = argv[0];
if (!is_valid_weakref_target(a... | 10 |
update_stats | void update_stats(JSRuntime *rt, const char *filename) {
JSMemoryUsage stats;
JS_ComputeMemoryUsage(rt, &stats);
js_mutex_lock(&stats_mutex);
if (stats_count++ == 0) {
stats_avg = stats_all = stats_min = stats_max = stats;
free(stats_min_filename);
stats_min_filename = strdup(fil... | 44 |
js_TA_cmp_generic | static int js_TA_cmp_generic(const void *a, const void *b, void *opaque) {
struct TA_sort_context *psc = opaque;
JSContext *ctx = psc->ctx;
uint32_t a_idx, b_idx;
JSValue argv[2];
JSValue res;
JSObject *p;
int cmp;
p = JS_VALUE_GET_OBJ(psc->arr);
if (typed_array_is_oob(p))
r... | 21 |
dbuf_put_u32 | static inline int dbuf_put_u32(DynBuf *s, uint32_t val)
{
return dbuf_put(s, (uint8_t *)&val, 4); // <-- You need to hit this breakpoint
} | 2 |
js_set_module_evaluated | static void js_set_module_evaluated(JSContext *ctx, JSModuleDef *m)
{
m->status = JS_MODULE_STATUS_EVALUATED;
if (!JS_IsUndefined(m->promise)) {
JSValue ret_val;
assert(m->cycle_root == m);
JSValueConst value = JS_UNDEFINED; // <-- You need to hit this breakpoint
ret_val = JS_Cal... | 6 |
re_is_simple_quantifier | static int re_is_simple_quantifier(const uint8_t *bc_buf, int bc_buf_len)
{
int pos, opcode, len, count;
uint32_t val;
count = 0;
pos = 0;
while (pos < bc_buf_len) {
opcode = bc_buf[pos];
len = reopcode_info[opcode].size;
switch(opcode) {
case REOP_range:
... | 29 |
js_parse_expr2 | /* allowed parse_flags: PF_IN_ACCEPTED */
static __exception int js_parse_expr2(JSParseState *s, int parse_flags)
{
bool comma = false;
for(;;) {
if (js_parse_assign_expr2(s, parse_flags))
return -1;
if (comma) {
/* prevent get_lvalue from using the last expression
... | 17 |
js_number | static JSValue js_number(double d)
{
if (double_is_int32(d))
return js_int32((int32_t)d); // <-- You need to hit this breakpoint
else
return js_float64(d);
} | 3 |
js_async_generator_finalizer | static void js_async_generator_finalizer(JSRuntime *rt, JSValueConst obj)
{
JSAsyncGeneratorData *s = JS_GetOpaque(obj, JS_CLASS_ASYNC_GENERATOR); // <-- You need to hit this breakpoint
if (s) {
js_async_generator_free(rt, s);
}
} | 2 |
js_TA_cmp_generic | static int js_TA_cmp_generic(const void *a, const void *b, void *opaque) {
struct TA_sort_context *psc = opaque;
JSContext *ctx = psc->ctx;
uint32_t a_idx, b_idx;
JSValue argv[2];
JSValue res;
JSObject *p;
int cmp;
p = JS_VALUE_GET_OBJ(psc->arr);
if (typed_array_is_oob(p))
r... | 35 |
JS_ReadArrayBuffer | static JSValue JS_ReadArrayBuffer(BCReaderState *s)
{
JSContext *ctx = s->ctx;
uint32_t byte_length, max_byte_length;
uint64_t max_byte_length_u64, *pmax_byte_length = NULL;
JSValue obj;
if (bc_get_leb128(s, &byte_length))
return JS_EXCEPTION;
if (bc_get_leb128(s, &max_byte_length))
... | 14 |
raw_context_global_var | // https://github.com/quickjs-ng/quickjs/issues/914
static void raw_context_global_var(void)
{
JSRuntime *rt = JS_NewRuntime();
JSContext *ctx = JS_NewContextRaw(rt);
JS_AddIntrinsicEval(ctx); // <-- You need to hit this breakpoint
{
static const char code[] = "globalThis";
JSValue ret =... | 5 |
js_os_pipe | /* pipe() -> [read_fd, write_fd] or null if error */
static JSValue js_os_pipe(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
int pipe_fds[2], ret;
JSValue obj;
ret = pipe(pipe_fds);
if (ret < 0)
return JS_NULL;
obj = JS_NewArray(ctx);
i... | 15 |
js_object_getOwnPropertyDescriptors | static JSValue js_object_getOwnPropertyDescriptors(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
//getOwnPropertyDescriptors(obj)
JSValue obj, r;
JSObject *p;
JSPropertyEnum *props;
uint32_t len, i;
r = JS_UNDEFINED;
... | 42 |
js_not_slow | static no_inline int js_not_slow(JSContext *ctx, JSValue *sp)
{
JSValue op1;
op1 = sp[-1];
op1 = JS_ToNumericFree(ctx, op1);
if (JS_IsException(op1))
goto exception;
if (JS_VALUE_GET_TAG(op1) == JS_TAG_SHORT_BIG_INT) {
sp[-1] = __JS_NewShortBigInt(ctx, ~JS_VALUE_GET_SHORT_BIG_INT(op... | 15 |
exchange_int128s | static void exchange_int128s(void *a, void *b, size_t size) {
uint64_t *ap = (uint64_t *)a;
uint64_t *bp = (uint64_t *)b;
for (size /= sizeof(uint64_t) * 2; size-- != 0; ap += 2, bp += 2) {
uint64_t t = ap[0];
uint64_t u = ap[1];
ap[0] = bp[0]; // <-- You need to hit this breakpoint... | 7 |
js_array_buffer_constructor0 | static JSValue js_array_buffer_constructor0(JSContext *ctx, JSValueConst new_target,
int argc, JSValueConst *argv,
JSClassID class_id)
{
uint64_t len, max_len, *pmax_len = NULL;
JSValue obj, val;
int64_t i;
if (JS_T... | 32 |
js_proxy_constructor | static JSValue js_proxy_constructor(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
JSValueConst target, handler;
JSValue obj;
JSProxyData *s;
target = argv[0];
handler = argv[1];
if (JS_VALUE_GET_TAG(target) != JS_TAG_OBJECT ||
... | 16 |
js_async_generator_function_call | static JSValue js_async_generator_function_call(JSContext *ctx,
JSValueConst func_obj,
JSValueConst this_obj,
int argc, JSValueConst *argv,
... | 30 |
update_var_htab | // caveat emptor: the table size must be a power of two in order for
// masking to work, and the load factor constant must be an odd number (5)
//
// f(n)=n+n/t is used to estimate the load factor but changing t to an
// even number introduces gaps in the output of f, sometimes "jumping"
// over the next power of two; ... | 16 |
parse_derived_norm_properties | void parse_derived_norm_properties(const char *filename)
{
FILE *f;
char line[4096], *p, buf[256], *q;
uint32_t c0, c1, c;
f = fopen(filename, "rb");
if (!f) {
perror(filename);
exit(1);
}
for(;;) {
if (!get_line(line, sizeof(line), f))
break;
p ... | 20 |
js_object_getPrototypeOf | static JSValue js_object_getPrototypeOf(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv, int magic)
{
JSValueConst val = argv[0]; // <-- You need to hit this breakpoint
if (JS_VALUE_GET_TAG(val) != JS_TAG_OBJECT) {
/* ES6 feature non compatible... | 3 |
js_realloc_array | static no_inline int js_realloc_array(JSContext *ctx, void **parray,
int elem_size, int *psize, int req_size)
{
int new_size;
size_t slack;
void *new_array;
/* XXX: potential arithmetic overflow */
new_size = max_int(req_size, *psize * 3 / 2); // <-- You need to... | 7 |
js_operator_in | static __exception int js_operator_in(JSContext *ctx, JSValue *sp)
{
JSValue op1, op2;
JSAtom atom; // <-- You need to hit this breakpoint
int ret;
op1 = sp[-2];
op2 = sp[-1];
if (JS_VALUE_GET_TAG(op2) != JS_TAG_OBJECT) {
JS_ThrowTypeError(ctx, "invalid 'in' operand");
return -... | 3 |
JS_DefineObjectNameComputed | static int JS_DefineObjectNameComputed(JSContext *ctx, JSValue obj,
JSValue str, int flags)
{
if (JS_IsObject(obj) &&
!js_object_has_name(ctx, obj)) {
JSAtom prop;
JSValue name_str;
prop = JS_ValueToAtom(ctx, str);
if (prop == JS_ATOM_NU... | 11 |
js_weakref_finalizer | static void js_weakref_finalizer(JSRuntime *rt, JSValueConst val)
{
JSWeakRefData *wrd = JS_GetOpaque(val, JS_CLASS_WEAK_REF);
if (!wrd || wrd == &js_weakref_sentinel)
return;
/* Delete weak ref */
JSWeakRefRecord **pwr, *wr;
pwr = get_first_weak_ref(wrd->target);
for(;;) {
wr ... | 13 |
unicode_compose_pair | /* return 0 if no pair found */
static int unicode_compose_pair(uint32_t c0, uint32_t c1)
{
uint32_t code, len, type, v, idx1, d_idx, d_offset, ch;
int idx_min, idx_max, idx, d;
uint32_t pair[2];
idx_min = 0;
idx_max = countof(unicode_comp_table) - 1;
while (idx_min <= idx_max) {
idx = ... | 26 |
JS_DefineObjectNameComputed | static int JS_DefineObjectNameComputed(JSContext *ctx, JSValue obj,
JSValue str, int flags)
{
if (JS_IsObject(obj) &&
!js_object_has_name(ctx, obj)) {
JSAtom prop;
JSValue name_str;
prop = JS_ValueToAtom(ctx, str);
if (prop == JS_ATOM_NU... | 10 |
js_reflect_setPrototypeOf | static JSValue js_reflect_setPrototypeOf(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
int ret;
ret = JS_SetPrototypeInternal(ctx, argv[0], argv[1], false); // <-- You need to hit this breakpoint
if (ret < 0)
return JS_EXCEPTION;
... | 4 |
js_TA_get_uint32 | static JSValue js_TA_get_uint32(JSContext *ctx, const void *a) {
return js_uint32(*(const uint32_t *)a); // <-- You need to hit this breakpoint
} | 1 |
js_os_run_timers | static int js_os_run_timers(JSRuntime *rt, JSContext *ctx, JSThreadState *ts, int *min_delay)
{
JSValue func;
JSOSTimer *th;
int64_t cur_time, delay;
struct list_head *el;
int r;
if (list_empty(&ts->os_timers)) {
*min_delay = -1;
return 0;
}
cur_time = js__hrtime_ms();
... | 18 |
js_atom_concat_str | /* return a string atom containing name concatenated with str1 */
/* `str1` may be pure ASCII or UTF-8 encoded */
// TODO(chqrlie): use string concatenation instead of UTF-8 conversion
static JSAtom js_atom_concat_str(JSContext *ctx, JSAtom name, const char *str1)
{
JSValue str;
JSAtom atom;
const char *cst... | 29 |
JS_ToIntegerFree | /* same as JS_ToNumber() but return 0 in case of NaN/Undefined */
static __maybe_unused JSValue JS_ToIntegerFree(JSContext *ctx, JSValue val)
{
uint32_t tag;
JSValue ret;
redo:
tag = JS_VALUE_GET_NORM_TAG(val);
switch(tag) {
case JS_TAG_INT:
case JS_TAG_BOOL:
case JS_TAG_NULL:
case JS_... | 33 |
js_bigint_from_float64 | static JSBigInt *js_bigint_from_float64(JSContext *ctx, int *pres, double a1)
{
uint64_t a = float64_as_uint64(a1);
int sgn, e, shift;
uint64_t mant;
JSBigIntBuf buf;
JSBigInt *r;
sgn = a >> 63;
e = (a >> 52) & ((1 << 11) - 1);
mant = a & (((uint64_t)1 << 52) - 1);
if (e == 2047) {
... | 30 |
js_trace_malloc_printf | static void JS_PRINTF_FORMAT_ATTR(2, 3) js_trace_malloc_printf(void *opaque, JS_PRINTF_FORMAT const char *fmt, ...)
{
va_list ap;
int c;
va_start(ap, fmt);
while ((c = *fmt++) != '\0') {
if (c == '%') {
/* only handle %p and %zd */
if (*fmt == 'p') {
uint... | 23 |
mp_shr | static js_limb_t mp_shr(js_limb_t *tab_r, const js_limb_t *tab, int n,
int shift, js_limb_t high)
{
int i;
js_limb_t l, a;
l = high;
for(i = n - 1; i >= 0; i--) {
a = tab[i];
tab_r[i] = (a >> shift) | (l << (JS_LIMB_BITS - shift));
l = a;
}
return... | 12 |
JS_ReadSharedArrayBuffer | static JSValue JS_ReadSharedArrayBuffer(BCReaderState *s)
{
JSContext *ctx = s->ctx;
uint32_t byte_length, max_byte_length;
uint64_t max_byte_length_u64, *pmax_byte_length = NULL; // <-- You need to hit this breakpoint
uint8_t *data_ptr;
JSValue obj;
uint64_t u64;
if (bc_get_leb128(s, &byte... | 4 |
JS_ObjectDefineProperties | static __exception int JS_ObjectDefineProperties(JSContext *ctx,
JSValueConst obj,
JSValueConst properties)
{
JSValue props, desc;
JSObject *p;
JSPropertyEnum *atoms;
uint32_t len, i;
int ret = -1;
... | 38 |
map_delete_record | static void map_delete_record(JSRuntime *rt, JSMapState *s, JSMapRecord *mr)
{
if (mr->empty)
return;
list_del(&mr->hash_link);
if (s->is_weak) {
delete_map_weak_ref(rt, mr);
} else {
JS_FreeValueRT(rt, mr->key);
}
JS_FreeValueRT(rt, mr->value); // <-- You need to hit thi... | 10 |
raw_context_global_var | // https://github.com/quickjs-ng/quickjs/issues/914
static void raw_context_global_var(void)
{
JSRuntime *rt = JS_NewRuntime();
JSContext *ctx = JS_NewContextRaw(rt);
JS_AddIntrinsicEval(ctx);
{
static const char code[] = "globalThis";
JSValue ret = JS_Eval(ctx, code, strlen(code), "*", ... | 9 |
JS_ObjectDefineProperties | static __exception int JS_ObjectDefineProperties(JSContext *ctx,
JSValueConst obj,
JSValueConst properties)
{
JSValue props, desc;
JSObject *p;
JSPropertyEnum *atoms;
uint32_t len, i;
int ret = -1;
... | 30 |
js_string_charAt | static JSValue js_string_charAt(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
JSValue val, ret;
JSString *p;
int idx, c;
val = JS_ToStringCheckObject(ctx, this_val);
if (JS_IsException(val))
return val; // <-- You need to hit this bre... | 9 |
find_tag | static char *find_tag(char *desc, const char *tag, int *state)
{
char *p;
p = strstr(desc, tag);
if (p) {
p += strlen(tag);
*state = 0;
}
return p; // <-- You need to hit this breakpoint
} | 8 |
JS_DumpShape | static __maybe_unused void JS_DumpShape(JSRuntime *rt, int i, JSShape *sh)
{
char atom_buf[ATOM_GET_STR_BUF_SIZE];
int j;
/* XXX: should output readable class prototype */
printf("%5d %3d%c %14p %5d %5d", i, // <-- You need to hit this breakpoint
sh->header.ref_count, " *"[sh->is_hashed],
... | 6 |
js_object_assign | static JSValue js_object_assign(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
// Object.assign(obj, source1)
JSValue obj, s;
int i;
s = JS_UNDEFINED;
obj = JS_ToObject(ctx, argv[0]);
if (JS_IsException(obj))
goto exception;
fo... | 17 |
add_req_module_entry | static int add_req_module_entry(JSContext *ctx, JSModuleDef *m,
JSAtom module_name)
{
JSReqModuleEntry *rme;
int i;
/* no need to add the module request if it is already present */
for(i = 0; i < m->req_module_entries_count; i++) {
rme = &m->req_module_entries[i]... | 9 |
js_new_module_def | /* 'name' is freed */
static JSModuleDef *js_new_module_def(JSContext *ctx, JSAtom name)
{
JSModuleDef *m;
m = js_mallocz(ctx, sizeof(*m));
if (!m) {
JS_FreeAtom(ctx, name);
return NULL;
}
m->header.ref_count = 1; // <-- You need to hit this breakpoint
m->module_name = name;
... | 9 |
JS_LoadModuleInternal | static void JS_LoadModuleInternal(JSContext *ctx, const char *basename,
const char *filename,
JSValueConst *resolving_funcs)
{
JSValue evaluate_promise;
JSModuleDef *m;
JSValue ret, err, func_obj, evaluate_resolving_funcs[2];
JSValueCon... | 19 |
JS_ToBigIntCtorFree | /* BigInt */
static JSValue JS_ToBigIntCtorFree(JSContext *ctx, JSValue val)
{
uint32_t tag;
redo:
tag = JS_VALUE_GET_NORM_TAG(val);
switch(tag) {
case JS_TAG_INT:
case JS_TAG_BOOL:
val = JS_NewBigInt64(ctx, JS_VALUE_GET_INT(val));
break;
case JS_TAG_SHORT_BIG_INT:
case JS_... | 45 |
js_std_file_read_write | static JSValue js_std_file_read_write(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv, int magic)
{
FILE *f = js_std_file_get(ctx, this_val);
uint64_t pos, len;
size_t size, ret;
uint8_t *buf;
if (!f)
return JS_EXCEPTION;
if (JS_... | 16 |
check_regexp_g_flag | static int check_regexp_g_flag(JSContext *ctx, JSValueConst regexp)
{
int ret;
JSValue flags;
ret = js_is_regexp(ctx, regexp);
if (ret < 0)
return -1;
if (ret) {
flags = JS_GetProperty(ctx, regexp, JS_ATOM_flags);
if (JS_IsException(flags))
return -1;
if ... | 20 |
js_symbol_keyFor | static JSValue js_symbol_keyFor(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
JSAtomStruct *p;
if (!JS_IsSymbol(argv[0]))
return JS_ThrowTypeError(ctx, "not a symbol");
p = JS_VALUE_GET_PTR(argv[0]);
if (p->atom_type != JS_ATOM_TYPE_GLOBA... | 9 |
build_flags_tables | void build_flags_tables(FILE *f)
{
build_prop_table(f, PROP_Cased1, true);
build_prop_table(f, PROP_Case_Ignorable, true);
build_prop_table(f, PROP_ID_Start, true); // <-- You need to hit this breakpoint
build_prop_table(f, PROP_ID_Continue1, true);
build_prop_table(f, PROP_White_Space, true);
} | 4 |
get_decomp_pos | static int get_decomp_pos(const DecompEntry *tab_de, int c)
{
int i, v, k; // <-- You need to hit this breakpoint
const DecompEntry *de;
k = 0;
for(i = 0; i <= CHARCODE_MAX; i++) {
de = &tab_de[i];
if (de->len != 0) {
if (c >= de->code && c < de->code + de->len) {
... | 2 |
js_std_file_read_write | static JSValue js_std_file_read_write(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv, int magic)
{
FILE *f = js_std_file_get(ctx, this_val); // <-- You need to hit this breakpoint
uint64_t pos, len;
size_t size, ret;
uint8_t *buf;
if (!f)
... | 3 |
js_symbol_constructor | /* Symbol */
static JSValue js_symbol_constructor(JSContext *ctx, JSValueConst new_target,
int argc, JSValueConst *argv)
{
JSValue str;
JSString *p;
if (!JS_IsUndefined(new_target))
return JS_ThrowTypeError(ctx, "not a constructor");
if (argc == 0 || JS_IsUn... | 10 |
js_string_codePointAt | static JSValue js_string_codePointAt(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv)
{
JSValue val, ret; // <-- You need to hit this breakpoint
JSString *p;
int idx, c;
val = JS_ToStringCheckObject(ctx, this_val);
if (JS_IsException(val))
... | 3 |
js_std_init | static int js_std_init(JSContext *ctx, JSModuleDef *m)
{
JSValue proto;
JSRuntime *rt = JS_GetRuntime(ctx);
JSThreadState *ts = js_get_thread_state(rt);
/* FILE class */
/* the class ID is created once */
JS_NewClassID(rt, &ts->std_file_class_id);
/* the class is created once per runtime */... | 13 |
js_array_includes | static JSValue js_array_includes(JSContext *ctx, JSValueConst this_val,
int argc, JSValueConst *argv) // <-- You need to hit this breakpoint
{
JSValue obj, val;
int64_t len, n;
JSValue *arrp;
uint32_t count;
int res;
obj = JS_ToObject(ctx, this_val);
if (js_... | 1 |
is_let | /* test if the current token is a let keyword. Use simplistic look-ahead scanner */
static int is_let(JSParseState *s, int decl_mask)
{
int res = false;
if (token_is_pseudo_keyword(s, JS_ATOM_let)) {
JSParsePos pos;
js_parse_get_pos(s, &pos);
for (;;) {
if (next_token(s)) {
... | 39 |
js_TA_cmp_float16 | static int js_TA_cmp_float16(const void *a, const void *b, void *opaque) {
return js_cmp_doubles(fromfp16(*(const uint16_t *)a),
fromfp16(*(const uint16_t *)b)); // <-- You need to hit this breakpoint
} | 2 |
JS_WriteArray | static int JS_WriteArray(BCWriterState *s, JSValueConst obj)
{
JSObject *p = JS_VALUE_GET_OBJ(obj);
uint32_t i, len;
JSValue val;
int ret;
bool is_template;
if (s->allow_bytecode && !p->extensible) {
/* not extensible array: we consider it is a
template when we are saving byt... | 14 |
js_typed_array_get_length | static JSValue js_typed_array_get_length(JSContext *ctx, JSValueConst this_val)
{
JSObject *p;
p = get_typed_array(ctx, this_val);
if (!p)
return JS_EXCEPTION; // <-- You need to hit this breakpoint
return js_int32(p->u.array.count);
} | 5 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4