@@ -5154,11 +5154,6 @@ static inline void *get_alloc_from_shape(JSShape *sh)
51545154 return prop_hash_end(sh) - ((intptr_t)sh->prop_hash_mask + 1);
51555155}
51565156
5157- static inline JSShapeProperty *get_shape_prop(JSShape *sh)
5158- {
5159- return sh->prop;
5160- }
5161-
51625157static int init_shape_hash(JSRuntime *rt)
51635158{
51645159 rt->shape_hash_bits = 6; /* 64 shapes */
@@ -5340,7 +5335,7 @@ static JSShape *js_clone_shape(JSContext *ctx, JSShape *sh1)
53405335 if (sh->proto) {
53415336 js_dup(JS_MKPTR(JS_TAG_OBJECT, sh->proto));
53425337 }
5343- for(i = 0, pr = get_shape_prop(sh) ; i < sh->prop_count; i++, pr++) {
5338+ for(i = 0, pr = sh->prop ; i < sh->prop_count; i++, pr++) {
53445339 JS_DupAtom(ctx, pr->atom);
53455340 }
53465341 return sh;
@@ -5363,7 +5358,7 @@ static void js_free_shape0(JSRuntime *rt, JSShape *sh)
53635358 if (sh->proto != NULL) {
53645359 JS_FreeValueRT(rt, JS_MKPTR(JS_TAG_OBJECT, sh->proto));
53655360 }
5366- pr = get_shape_prop(sh) ;
5361+ pr = sh->prop ;
53675362 for(i = 0; i < sh->prop_count; i++) {
53685363 JS_FreeAtomRT(rt, pr->atom);
53695364 pr++;
@@ -5551,7 +5546,7 @@ static int add_shape_property(JSContext *ctx, JSShape **psh,
55515546 }
55525547 /* Initialize the new shape property.
55535548 The object property at p->prop[sh->prop_count] is uninitialized */
5554- prop = get_shape_prop(sh) ;
5549+ prop = sh->prop ;
55555550 pr = &prop[sh->prop_count++];
55565551 pr->atom = JS_DupAtom(ctx, atom);
55575552 pr->flags = prop_flags;
@@ -5690,7 +5685,7 @@ static JSValue JS_NewObjectFromShape(JSContext *ctx, JSShape *sh, JSClassID clas
56905685 js_free(ctx, p);
56915686 fail:
56925687 if (props) {
5693- JSShapeProperty *prs = get_shape_prop(sh) ;
5688+ JSShapeProperty *prs = sh->prop ;
56945689 for(i = 0; i < sh->prop_count; i++) {
56955690 free_property(ctx->rt, &props[i], prs->flags);
56965691 prs++;
@@ -6348,7 +6343,7 @@ static inline JSShapeProperty *find_own_property1(JSObject *p, JSAtom atom)
63486343 sh = p->shape;
63496344 h = (uintptr_t)atom & sh->prop_hash_mask;
63506345 h = prop_hash_end(sh)[-h - 1];
6351- prop = get_shape_prop(sh) ;
6346+ prop = sh->prop ;
63526347 while (h) {
63536348 pr = &prop[h - 1];
63546349 if (likely(pr->atom == atom)) {
@@ -6369,7 +6364,7 @@ static inline JSShapeProperty *find_own_property(JSProperty **ppr,
63696364 sh = p->shape;
63706365 h = (uintptr_t)atom & sh->prop_hash_mask;
63716366 h = prop_hash_end(sh)[-h - 1];
6372- prop = get_shape_prop(sh) ;
6367+ prop = sh->prop ;
63736368 while (h) {
63746369 pr = &prop[h - 1];
63756370 if (likely(pr->atom == atom)) {
@@ -6558,7 +6553,7 @@ static void free_object(JSRuntime *rt, JSObject *p)
65586553 freeing cycles */
65596554 /* free all the fields */
65606555 sh = p->shape;
6561- pr = get_shape_prop(sh) ;
6556+ pr = sh->prop ;
65626557 for(i = 0; i < sh->prop_count; i++) {
65636558 free_property(rt, &p->prop[i], pr->flags);
65646559 pr++;
@@ -6765,7 +6760,7 @@ static void mark_children(JSRuntime *rt, JSGCObjectHeader *gp,
67656760 sh = p->shape;
67666761 mark_func(rt, &sh->header);
67676762 /* mark all the fields */
6768- prs = get_shape_prop(sh) ;
6763+ prs = sh->prop ;
67696764 for(i = 0; i < sh->prop_count; i++) {
67706765 JSProperty *pr = &p->prop[i];
67716766 if (prs->atom != JS_ATOM_NULL) {
@@ -7149,7 +7144,7 @@ void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s)
71497144 s->memory_used_count++;
71507145 s->prop_size += sh->prop_size * sizeof(*p->prop);
71517146 s->prop_count += sh->prop_count;
7152- prs = get_shape_prop(sh) ;
7147+ prs = sh->prop ;
71537148 for(i = 0; i < sh->prop_count; i++) {
71547149 JSProperty *pr = &p->prop[i];
71557150 if (prs->atom != JS_ATOM_NULL && !(prs->flags & JS_PROP_TMASK)) {
@@ -8993,7 +8988,7 @@ static int __exception JS_GetOwnPropertyNamesInternal(JSContext *ctx,
89938988 exotic_count = 0;
89948989 tab_exotic = NULL;
89958990 sh = p->shape;
8996- for(i = 0, prs = get_shape_prop(sh) ; i < sh->prop_count; i++, prs++) {
8991+ for(i = 0, prs = sh->prop ; i < sh->prop_count; i++, prs++) {
89978992 atom = prs->atom;
89988993 if (atom != JS_ATOM_NULL) {
89998994 is_enumerable = ((prs->flags & JS_PROP_ENUMERABLE) != 0);
@@ -9082,7 +9077,7 @@ static int __exception JS_GetOwnPropertyNamesInternal(JSContext *ctx,
90829077
90839078 num_sorted = true;
90849079 sh = p->shape;
9085- for(i = 0, prs = get_shape_prop(sh) ; i < sh->prop_count; i++, prs++) {
9080+ for(i = 0, prs = sh->prop ; i < sh->prop_count; i++, prs++) {
90869081 atom = prs->atom;
90879082 if (atom != JS_ATOM_NULL) {
90889083 is_enumerable = ((prs->flags & JS_PROP_ENUMERABLE) != 0);
@@ -9674,7 +9669,7 @@ static int delete_property(JSContext *ctx, JSObject *p, JSAtom atom)
96749669 sh = p->shape;
96759670 h1 = atom & sh->prop_hash_mask;
96769671 h = prop_hash_end(sh)[-h1 - 1];
9677- prop = get_shape_prop(sh) ;
9672+ prop = sh->prop ;
96789673 lpr = NULL;
96799674 lpr_idx = 0; /* prevent warning */
96809675 while (h != 0) {
@@ -9685,13 +9680,13 @@ static int delete_property(JSContext *ctx, JSObject *p, JSAtom atom)
96859680 return false;
96869681 /* realloc the shape if needed */
96879682 if (lpr)
9688- lpr_idx = lpr - get_shape_prop(sh) ;
9683+ lpr_idx = lpr - sh->prop ;
96899684 if (js_shape_prepare_update(ctx, p, &pr))
96909685 return -1;
96919686 sh = p->shape;
96929687 /* remove property */
96939688 if (lpr) {
9694- lpr = get_shape_prop(sh) + lpr_idx;
9689+ lpr = &sh->prop[ lpr_idx] ;
96959690 lpr->hash_next = pr->hash_next;
96969691 } else {
96979692 prop_hash_end(sh)[-h1 - 1] = pr->hash_next;
@@ -9833,7 +9828,7 @@ static int set_array_length(JSContext *ctx, JSObject *p, JSValue val,
98339828 passes in case one of the property is not
98349829 configurable */
98359830 cur_len = len;
9836- for(i = 0, pr = get_shape_prop(sh) ; i < sh->prop_count;
9831+ for(i = 0, pr = sh->prop ; i < sh->prop_count;
98379832 i++, pr++) {
98389833 if (pr->atom != JS_ATOM_NULL &&
98399834 JS_AtomIsArrayIndex(ctx, &idx, pr->atom)) {
@@ -9844,7 +9839,7 @@ static int set_array_length(JSContext *ctx, JSObject *p, JSValue val,
98449839 }
98459840 }
98469841
9847- for(i = 0, pr = get_shape_prop(sh) ; i < sh->prop_count;
9842+ for(i = 0, pr = sh->prop ; i < sh->prop_count;
98489843 i++, pr++) {
98499844 if (pr->atom != JS_ATOM_NULL &&
98509845 JS_AtomIsArrayIndex(ctx, &idx, pr->atom)) {
@@ -9853,7 +9848,7 @@ static int set_array_length(JSContext *ctx, JSObject *p, JSValue val,
98539848 delete_property(ctx, p, pr->atom);
98549849 /* WARNING: the shape may have been modified */
98559850 sh = p->shape;
9856- pr = get_shape_prop(sh) + i ;
9851+ pr = &sh->prop[i] ;
98579852 }
98589853 }
98599854 }
@@ -9900,7 +9895,7 @@ static int add_fast_array_element(JSContext *ctx, JSObject *p,
99009895 if (likely(JS_VALUE_GET_TAG(p->prop[0].u.value) == JS_TAG_INT)) {
99019896 array_len = JS_VALUE_GET_INT(p->prop[0].u.value);
99029897 if (new_len > array_len) {
9903- if (unlikely(!(get_shape_prop( p->shape) ->flags & JS_PROP_WRITABLE))) {
9898+ if (unlikely(!(p->shape->prop ->flags & JS_PROP_WRITABLE))) {
99049899 JS_FreeValue(ctx, val);
99059900 return JS_ThrowTypeErrorReadOnly(ctx, flags, JS_ATOM_length);
99069901 }
@@ -10443,7 +10438,7 @@ static int JS_CreateProperty(JSContext *ctx, JSObject *p,
1044310438 plen = &p->prop[0];
1044410439 JS_ToUint32(ctx, &len, plen->u.value);
1044510440 if ((idx + 1) > len) {
10446- pslen = get_shape_prop( p->shape) ;
10441+ pslen = p->shape->prop ;
1044710442 if (unlikely(!(pslen->flags & JS_PROP_WRITABLE)))
1044810443 return JS_ThrowTypeErrorReadOnly(ctx, flags, JS_ATOM_length);
1044910444 /* XXX: should update the length after defining
@@ -10553,15 +10548,15 @@ static int js_shape_prepare_update(JSContext *ctx, JSObject *p,
1055310548 if (sh->is_hashed) {
1055410549 if (sh->header.ref_count != 1) {
1055510550 if (pprs)
10556- idx = *pprs - get_shape_prop(sh) ;
10551+ idx = *pprs - sh->prop ;
1055710552 /* clone the shape (the resulting one is no longer hashed) */
1055810553 sh = js_clone_shape(ctx, sh);
1055910554 if (!sh)
1056010555 return -1;
1056110556 js_free_shape(ctx->rt, p->shape);
1056210557 p->shape = sh;
1056310558 if (pprs)
10564- *pprs = get_shape_prop(sh) + idx;
10559+ *pprs = &sh->prop[ idx] ;
1056510560 } else {
1056610561 js_shape_hash_unlink(ctx->rt, sh);
1056710562 sh->is_hashed = false;
@@ -10751,7 +10746,7 @@ int JS_DefineProperty(JSContext *ctx, JSValueConst this_obj,
1075110746 property is read-only. */
1075210747 if ((flags & (JS_PROP_HAS_WRITABLE | JS_PROP_WRITABLE)) ==
1075310748 JS_PROP_HAS_WRITABLE) {
10754- prs = get_shape_prop( p->shape) ;
10749+ prs = p->shape->prop ;
1075510750 if (js_update_property_flags(ctx, p, &prs,
1075610751 prs->flags & ~JS_PROP_WRITABLE))
1075710752 return -1;
@@ -14168,7 +14163,7 @@ static __maybe_unused void JS_DumpObject(JSRuntime *rt, JSObject *p)
1416814163
1416914164 if (sh) {
1417014165 printf("{ ");
14171- for(i = 0, prs = get_shape_prop(sh) ; i < sh->prop_count; i++, prs++) {
14166+ for(i = 0, prs = sh->prop ; i < sh->prop_count; i++, prs++) {
1417214167 if (prs->atom != JS_ATOM_NULL) {
1417314168 pr = &p->prop[i];
1417414169 if (!is_first)
@@ -16147,7 +16142,7 @@ static JSValue build_for_in_iterator(JSContext *ctx, JSValue obj)
1614716142 JSShapeProperty *prs;
1614816143 /* check that there are no enumerable normal fields */
1614916144 sh = p->shape;
16150- for(i = 0, prs = get_shape_prop(sh) ; i < sh->prop_count; i++, prs++) {
16145+ for(i = 0, prs = sh->prop ; i < sh->prop_count; i++, prs++) {
1615116146 if (prs->flags & JS_PROP_ENUMERABLE)
1615216147 goto normal_case;
1615316148 }
@@ -16239,7 +16234,7 @@ static __exception int js_for_in_next(JSContext *ctx, JSValue *sp)
1623916234 JSShapeProperty *prs;
1624016235 if (it->idx >= sh->prop_count)
1624116236 goto done;
16242- prs = get_shape_prop(sh) + it->idx;
16237+ prs = &sh->prop[ it->idx] ;
1624316238 prop = prs->atom;
1624416239 it->idx++;
1624516240 if (prop == JS_ATOM_NULL || !(prs->flags & JS_PROP_ENUMERABLE))
@@ -37239,7 +37234,7 @@ static int JS_WriteObjectTag(BCWriterState *s, JSValueConst obj)
3723937234 for(pass = 0; pass < 2; pass++) {
3724037235 if (pass == 1)
3724137236 bc_put_leb128(s, prop_count);
37242- for(i = 0, pr = get_shape_prop(sh) ; i < sh->prop_count; i++, pr++) {
37237+ for(i = 0, pr = sh->prop ; i < sh->prop_count; i++, pr++) {
3724337238 atom = pr->atom;
3724437239 if (atom != JS_ATOM_NULL && (pr->flags & JS_PROP_ENUMERABLE)) {
3724537240 if (pr->flags & JS_PROP_TMASK) {
@@ -42266,7 +42261,7 @@ static JSValue js_array_push(JSContext *ctx, JSValueConst this_val,
4226642261 ctx->std_array_prototype)) {
4226742262 uint32_t array_len, new_len;
4226842263 if (likely(JS_VALUE_GET_TAG(p->prop[0].u.value) == JS_TAG_INT &&
42269- (get_shape_prop( p->shape) ->flags & JS_PROP_WRITABLE))) {
42264+ (p->shape->prop ->flags & JS_PROP_WRITABLE))) {
4227042265 array_len = JS_VALUE_GET_INT(p->prop[0].u.value);
4227142266 new_len = array_len + argc;
4227242267 if (likely(new_len >= array_len)) { /* no overflow */
0 commit comments