Skip to content

Commit

Permalink
fix: fix windows compile.
Browse files Browse the repository at this point in the history
  • Loading branch information
andycall authored and ErosZy committed Jan 5, 2024
1 parent e12b525 commit a65a17d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
17 changes: 14 additions & 3 deletions bridge/third_party/quickjs/src/core/ic.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,14 @@ int free_ic(InlineCache *ic) {
return 0;
}

#if _MSC_VER
uint32_t add_ic_slot(InlineCache *ic, JSAtom atom, JSObject *object,
uint32_t prop_offset, JSObject* prototype)
#else
force_inline uint32_t add_ic_slot(InlineCache *ic, JSAtom atom, JSObject *object,
uint32_t prop_offset, JSObject* prototype) {
uint32_t prop_offset, JSObject* prototype)
#endif
{
int32_t i;
uint32_t h;
InlineCacheHashSlot *ch;
Expand Down Expand Up @@ -185,7 +191,7 @@ force_inline uint32_t add_ic_slot(InlineCache *ic, JSAtom atom, JSObject *object
// the atom and prototype SHOULE BE freed by watchpoint_remove/clear_callback
JS_DupValue(ic->ctx, JS_MKPTR(JS_TAG_OBJECT, prototype));
ci->proto = prototype;
ci->watchpoint_ref = js_shape_create_watchpoint(rt, ci->shape, (intptr_t)ci,
ci->watchpoint_ref = js_shape_create_watchpoint(rt, ci->shape, (intptr_t)ci,
JS_DupAtom(ic->ctx, atom),
ic_watchpoint_delete_handler,
ic_watchpoint_free_handler);
Expand All @@ -194,7 +200,12 @@ force_inline uint32_t add_ic_slot(InlineCache *ic, JSAtom atom, JSObject *object
return ch->index;
}

uint32_t add_ic_slot1(InlineCache *ic, JSAtom atom) {
#if _MSC_VER
uint32_t add_ic_slot1(InlineCache *ic, JSAtom atom)
#else
force_inline uint32_t add_ic_slot1(InlineCache *ic, JSAtom atom)
#endif
{
uint32_t h;
InlineCacheHashSlot *ch;
if (ic->count + 1 >= ic->capacity && resize_ic_hash(ic))
Expand Down
19 changes: 15 additions & 4 deletions bridge/third_party/quickjs/src/core/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,17 @@ JSValue JS_GetPropertyInternal(JSContext *ctx, JSValueConst obj,
}
}

#if _MSC_VER
JSValue JS_GetPropertyInternalWithIC(JSContext *ctx, JSValueConst obj,
JSAtom prop, JSValueConst this_obj,
InlineCache *ic, int32_t offset,
BOOL throw_ref_error)
#else
force_inline JSValue JS_GetPropertyInternalWithIC(JSContext *ctx, JSValueConst obj,
JSAtom prop, JSValueConst this_obj,
InlineCache *ic, int32_t offset,
BOOL throw_ref_error)
JSAtom prop, JSValueConst this_obj,
InlineCache *ic, int32_t offset,
BOOL throw_ref_error)
#endif
{
uint32_t tag;
JSObject *p, *proto;
Expand All @@ -557,7 +564,7 @@ force_inline JSValue JS_GetPropertyInternalWithIC(JSContext *ctx, JSValueConst o
return JS_DupValue(ctx, p->prop[offset].u.value);
}
slow_path:
return JS_GetPropertyInternal(ctx, obj, prop, this_obj, ic, throw_ref_error);
return JS_GetPropertyInternal(ctx, obj, prop, this_obj, ic, throw_ref_error);
}

JSValue JS_GetOwnPropertyNames2(JSContext* ctx, JSValueConst obj1, int flags, int kind) {
Expand Down Expand Up @@ -1980,7 +1987,11 @@ int JS_SetPropertyInternal(JSContext* ctx, JSValueConst this_obj, JSAtom prop, J
return TRUE;
}

#if _MSC_VER
int JS_SetPropertyInternalWithIC(JSContext* ctx, JSValueConst this_obj, JSAtom prop, JSValue val, int flags, InlineCache *ic, int32_t offset) {
#else
force_inline int JS_SetPropertyInternalWithIC(JSContext* ctx, JSValueConst this_obj, JSAtom prop, JSValue val, int flags, InlineCache *ic, int32_t offset) {
#endif
uint32_t tag;
JSObject *p, *proto;
tag = JS_VALUE_GET_TAG(this_obj);
Expand Down

0 comments on commit a65a17d

Please sign in to comment.