@@ -11802,17 +11802,6 @@ int JS_ToBigInt64(JSContext *ctx, int64_t *pres, JSValueConst val)
11802
11802
return JS_ToBigInt64Free(ctx, pres, js_dup(val));
11803
11803
}
11804
11804
11805
- static JSBigInt *js_new_bf(JSContext *ctx)
11806
- {
11807
- JSBigInt *p;
11808
- p = js_malloc(ctx, sizeof(*p));
11809
- if (!p)
11810
- return NULL;
11811
- p->header.ref_count = 1;
11812
- bf_init(ctx->bf_ctx, &p->num);
11813
- return p;
11814
- }
11815
-
11816
11805
static JSValue JS_NewBigInt(JSContext *ctx)
11817
11806
{
11818
11807
JSBigInt *p;
@@ -33010,33 +32999,25 @@ static int JS_ReadFunctionBytecode(BCReaderState *s, JSFunctionBytecode *b,
33010
32999
return 0;
33011
33000
}
33012
33001
33013
- static JSValue JS_ReadBigInt(BCReaderState *s, int tag )
33002
+ static JSValue JS_ReadBigInt(BCReaderState *s)
33014
33003
{
33015
- JSValue obj = JS_UNDEFINED ;
33004
+ JSValue obj;
33016
33005
uint8_t v8;
33017
33006
int32_t e;
33018
33007
uint32_t len;
33019
33008
limb_t l, i, n;
33020
- JSBigInt *p;
33021
33009
limb_t v;
33022
33010
bf_t *a;
33023
33011
33024
- p = js_new_bf (s->ctx);
33025
- if (!p )
33012
+ obj = JS_NewBigInt (s->ctx);
33013
+ if (JS_IsException(obj) )
33026
33014
goto fail;
33027
- switch(tag) {
33028
- case BC_TAG_BIG_INT:
33029
- obj = JS_MKPTR(JS_TAG_BIG_INT, p);
33030
- break;
33031
- default:
33032
- abort();
33033
- }
33034
33015
33035
33016
/* sign + exponent */
33036
33017
if (bc_get_sleb128(s, &e))
33037
33018
goto fail;
33038
33019
33039
- a = &p->num ;
33020
+ a = JS_GetBigInt(obj) ;
33040
33021
a->sign = e & 1;
33041
33022
e >>= 1;
33042
33023
if (e == 0)
@@ -33775,7 +33756,7 @@ static JSValue JS_ReadObjectRec(BCReaderState *s)
33775
33756
obj = JS_ReadObjectValue(s);
33776
33757
break;
33777
33758
case BC_TAG_BIG_INT:
33778
- obj = JS_ReadBigInt(s, tag );
33759
+ obj = JS_ReadBigInt(s);
33779
33760
break;
33780
33761
case BC_TAG_OBJECT_REFERENCE:
33781
33762
{
0 commit comments