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.

migrate to slots for Object Builtin

+21 -10
+6
include/config.h
··· 47 47 SLOT_SET, 48 48 SLOT_PRIMITIVE, 49 49 SLOT_PROXY_REF, 50 + SLOT_BUILTIN, 50 51 SLOT_MAX = 255 51 52 } internal_slot_t; 53 + 54 + typedef enum { 55 + BUILTIN_NONE = 0, 56 + BUILTIN_OBJECT = 1 57 + } builtin_fn_id_t; 52 58 53 59 #endif
+6
include/config.h.in
··· 39 39 SLOT_SET, 40 40 SLOT_PRIMITIVE, 41 41 SLOT_PROXY_REF, 42 + SLOT_BUILTIN, 42 43 SLOT_MAX = 255 43 44 } internal_slot_t; 45 + 46 + typedef enum { 47 + BUILTIN_NONE = 0, 48 + BUILTIN_OBJECT = 1 49 + } builtin_fn_id_t; 44 50 45 51 #endif
+1 -1
meson.build
··· 96 96 build_date = run_command('date', '+%Y-%m-%d', check: true).stdout().strip() 97 97 98 98 version_conf = configuration_data() 99 - version_conf.set('ANT_VERSION', '0.3.2.33') 99 + version_conf.set('ANT_VERSION', '0.3.2.34') 100 100 version_conf.set('ANT_GIT_HASH', git_hash) 101 101 version_conf.set('ANT_BUILD_DATE', build_date) 102 102
+8 -9
src/ant.c
··· 2066 2066 } 2067 2067 } 2068 2068 2069 + jsval_t builtin_slot = get_slot(js, func_obj, SLOT_BUILTIN); 2070 + if (vtype(builtin_slot) == T_NUM) { 2071 + return cpy(buf, len, "[Function (native)]", 19); 2072 + } 2073 + 2069 2074 if (vtype(code_slot) != T_STR) { 2070 2075 jsval_t cfunc_slot = get_slot(js, func_obj, SLOT_CFUNC); 2071 2076 if (vtype(cfunc_slot) == T_CFUNC) return cpy(buf, len, "[Function (native)]", 19); ··· 2087 2092 return n; 2088 2093 } 2089 2094 return cpy(buf, len, "[Function (anonymous)]", 22); 2090 - } 2091 - 2092 - jsoff_t sn, off = vstr(js, code_val, &sn); 2093 - if (sn >= 9 && memcmp(&js->mem[off], "__builtin", 9) == 0) { 2094 - return cpy(buf, len, "[Function (native)]", 19); 2095 2095 } 2096 2096 2097 2097 if (name && name_len > 0) { ··· 6320 6320 } 6321 6321 } 6322 6322 6323 - if (fnlen == 16 && memcmp(code_str, "__builtin_Object", 16) == 0) { 6324 - res = call_c(js, builtin_Object); 6325 - } else { 6323 + jsval_t builtin_slot = get_slot(js, func_obj, SLOT_BUILTIN); 6324 + if (vtype(builtin_slot) == T_NUM && tod(builtin_slot) == BUILTIN_OBJECT) res = call_c(js, builtin_Object); else { 6326 6325 static char full_func_name[256]; 6327 6326 const char *func_name = NULL; 6328 6327 const char *this_name = NULL; ··· 20803 20802 20804 20803 jsval_t obj_func_obj = mkobj(js, 0); 20805 20804 set_proto(js, obj_func_obj, function_proto); 20806 - set_slot(js, obj_func_obj, SLOT_CODE, js_mkstr(js, "__builtin_Object", 16)); 20805 + set_slot(js, obj_func_obj, SLOT_BUILTIN, tov(BUILTIN_OBJECT)); 20807 20806 setprop(js, obj_func_obj, js_mkstr(js, "keys", 4), js_mkfun(builtin_object_keys)); 20808 20807 setprop(js, obj_func_obj, js_mkstr(js, "values", 6), js_mkfun(builtin_object_values)); 20809 20808 setprop(js, obj_func_obj, js_mkstr(js, "entries", 7), js_mkfun(builtin_object_entries));