MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

improve slot lookup function

+3 -15
+1 -1
meson.build
··· 79 79 build_date = run_command('date', '+%Y-%m-%d', check: true).stdout().strip() 80 80 81 81 version_conf = configuration_data() 82 - version_conf.set('ANT_VERSION', '0.2.2.31') 82 + version_conf.set('ANT_VERSION', '0.2.2.32') 83 83 version_conf.set('ANT_GIT_HASH', git_hash) 84 84 version_conf.set('ANT_BUILD_DATE', build_date) 85 85
+2 -14
src/ant.c
··· 2944 2944 goto check; 2945 2945 } 2946 2946 2947 - static jsoff_t lkp_header_slot(struct js *js, jsval_t obj, internal_slot_t slot) { 2948 - jsoff_t off = (jsoff_t) vdata(obj); 2949 - if (off >= js->brk) return 0; 2950 - jsoff_t next = loadoff(js, off) & ~(3U | CONSTMASK | ARRMASK | SLOTMASK); 2951 - if (next == 0 || next >= js->brk) return 0; 2952 - jsoff_t header = loadoff(js, next); 2953 - if ((header & SLOTMASK) == 0) return 0; 2954 - jsoff_t koff = loadoff(js, next + sizeof(jsoff_t)); 2955 - return (koff == (jsoff_t)slot) ? next : 0; 2956 - } 2957 - 2958 2947 static void set_slot(struct js *js, jsval_t obj, internal_slot_t slot, jsval_t val) { 2959 2948 jsoff_t existing = search_slot(js, obj, slot); 2960 2949 if (existing > 0) { ··· 17580 17569 17581 17570 static uint32_t get_promise_id(struct js *js, jsval_t p) { 17582 17571 jsval_t p_obj = mkval(T_OBJ, vdata(p)); 17583 - jsoff_t off = lkp_header_slot(js, p_obj, SLOT_PID); 17584 - if (off == 0) return 0; 17585 - jsval_t pid_val = loadval(js, off + sizeof(jsoff_t) * 2); 17572 + jsval_t pid_val = get_slot(js, p_obj, SLOT_PID); 17573 + if (vtype(pid_val) == T_UNDEF) return 0; 17586 17574 return (uint32_t)tod(pid_val); 17587 17575 } 17588 17576