@@ -8847,10 +8847,7 @@ int JS_SetPropertyInternalImpl(LEPUSContext *ctx, LEPUSValueConst this_obj,
8847
8847
p = LEPUS_VALUE_GET_OBJ(this_obj);
8848
8848
8849
8849
#ifdef ENABLE_QUICKJS_DEBUGGER
8850
- if (CheckObjectCtx(ctx, val)) {
8851
- JS_ThrowCtxError(ctx);
8852
- return -1;
8853
- }
8850
+ CheckObjectCtx(ctx, val);
8854
8851
#endif
8855
8852
8856
8853
retry:
@@ -18505,9 +18502,7 @@ QJS_STATIC inline LEPUSValue JS_CallInternalTI(LEPUSContext *caller_ctx,
18505
18502
LEPUSValue new_target, int argc,
18506
18503
LEPUSValue *argv, int flags) {
18507
18504
#ifdef ENABLE_QUICKJS_DEBUGGER
18508
- if (CheckObjectCtx(caller_ctx, func_obj)) {
18509
- return JS_ThrowCtxError(caller_ctx);
18510
- }
18505
+ CheckObjectCtx(caller_ctx, func_obj);
18511
18506
#endif
18512
18507
18513
18508
#ifdef ENABLE_PRIMJS_SNAPSHOT
@@ -56116,31 +56111,44 @@ pid_t get_tid() {
56116
56111
#endif
56117
56112
}
56118
56113
56119
- bool CheckObjectCtx(LEPUSContext *ctx, LEPUSValue obj) {
56114
+ void CheckObjectCtx(LEPUSContext *ctx, LEPUSValue obj) {
56120
56115
if (ctx->object_ctx_check) {
56121
56116
bool inconsistent_ctx =
56122
56117
(LEPUS_VALUE_IS_OBJECT(obj) &&
56123
56118
(LEPUS_VALUE_GET_OBJ(obj)->ctx) != ctx) ||
56124
56119
(LEPUS_VALUE_IS_FUNCTION_BYTECODE(obj) &&
56125
56120
static_cast<LEPUSFunctionBytecode *>(LEPUS_VALUE_GET_PTR(obj))->ctx !=
56126
56121
ctx);
56127
- bool inconsistent_tid = false;
56122
+ if (inconsistent_ctx) {
56123
+ #if defined(ANDROID) || defined(__ANDROID__)
56124
+ __android_log_print(ANDROID_LOG_FATAL, "PRIMJS_GC",
56125
+ "CheckObjectCtx failed because of inconsistent ctx. "
56126
+ "obj: %p, ori_ctx: %p, cur_ctx: %p\n",
56127
+ LEPUS_VALUE_GET_OBJ(obj),
56128
+ LEPUS_VALUE_GET_OBJ(obj)->ctx, ctx);
56129
+ #endif
56130
+ abort();
56131
+ }
56132
+ #if 0
56128
56133
#if defined(ANDROID) || defined(__ANDROID__)
56129
56134
pid_t tid = get_tid();
56130
- inconsistent_tid =
56135
+ bool inconsistent_tid =
56131
56136
(LEPUS_VALUE_IS_OBJECT(obj) &&
56132
56137
(LEPUS_VALUE_GET_OBJ(obj)->tid) != tid) ||
56133
56138
(LEPUS_VALUE_IS_FUNCTION_BYTECODE(obj) &&
56134
56139
static_cast<LEPUSFunctionBytecode *>(LEPUS_VALUE_GET_PTR(obj))->tid !=
56135
56140
tid);
56141
+
56142
+ if (inconsistent_tid) {
56143
+ __android_log_print(ANDROID_LOG_FATAL, "PRIMJS_GC",
56144
+ "CheckObjectCtx failed, inconsistent_tid; obj: %p, "
56145
+ "ori_tid: %d, cur_tid: %d ctx: %p\n",
56146
+ LEPUS_VALUE_GET_OBJ(obj),
56147
+ (int)(LEPUS_VALUE_GET_OBJ(obj)->tid), (int)tid, ctx);
56148
+ abort();
56149
+ }
56150
+ #endif
56136
56151
#endif
56137
- return inconsistent_ctx || inconsistent_tid;
56138
56152
}
56139
- return false;
56140
- }
56141
-
56142
- LEPUSValue JS_ThrowCtxError(LEPUSContext *ctx) {
56143
- return LEPUS_ThrowTypeError(
56144
- ctx, "The property's ctx or tid is inconsistent with this object.");
56145
56153
}
56146
56154
#endif
0 commit comments