Closed Bug 770846 Opened 12 years ago Closed 12 years ago

Convert some macros to methods and flags to bitfields in TreeContext.h

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: jorendorff, Assigned: jorendorff)

References

Details

Attachments

(4 files)

      No description provided.
Assignee: general → jorendorff
Attachment #639055 - Flags: review?(n.nethercote)
Attachment #639057 - Flags: review?(n.nethercote)
It is only used during parsing, not emitting.
Attachment #639058 - Flags: review?(n.nethercote)
Blocks: 770849
Comment on attachment 639055 [details] [diff] [review]
Part 1 - STMT_IS_TRYING and friends, v1

Review of attachment 639055 [details] [diff] [review]:
-----------------------------------------------------------------

Your first three patches are almost identical to my three patches in bug 770067, from three days ago.  I'm happy to abandon my patches in favour of yours because you have follow-ups.  But I'd like to understand how this duplication of work happened -- did you not see my review requests?

::: js/src/frontend/TreeContext.h
@@ +274,5 @@
>  };
>  
>  /*
>   * NB: If you add enumerators for scope statements, add them between STMT_WITH
>   * and STMT_CATCH, or you will break the STMT_TYPE_IS_SCOPE macro. If you add

STMT_TYPE_IS_SCOPE has been renamed.  Also, you changed it from a range test to "type == STMT_WITH || type == STMT_CATCH", so this comment is no longer correct.  I suggest you keep it as a range test;  that's what I did in my patch.
Attachment #639055 - Flags: review?(n.nethercote) → review+
Attachment #639056 - Flags: review?(n.nethercote) → review+
Comment on attachment 639057 [details] [diff] [review]
Part 3 - GOSUBS and friends

Review of attachment 639057 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/frontend/TreeContext.h
@@ +397,5 @@
> +
> +    ptrdiff_t &gosubs() {
> +        JS_ASSERT(type == STMT_FINALLY);
> +        return breaks;
> +    }

I used unions in my patch, but I didn't have the type assertions.  Maybe you could use unions?  And/or: having protected these accesses with assertions, is it worth protecting the update/breaks/continues accesses similarly?  I'll let you decide;  what you have is already a clear improvement.
Attachment #639057 - Flags: review?(n.nethercote) → review+
Comment on attachment 639058 [details] [diff] [review]
Part 4 - move isFunctionBodyBlock from StmtInfoBase to StmtInfoTC, v1

Review of attachment 639058 [details] [diff] [review]:
-----------------------------------------------------------------

Finally, a patch that isn't familiar :P  Nice change.
Attachment #639058 - Flags: review?(n.nethercote) → review+
(In reply to Nicholas Nethercote [:njn] from comment #5)
> Comment on attachment 639055 [details] [diff] [review]
> Part 1 - STMT_IS_TRYING and friends, v1
> 
> Review of attachment 639055 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Your first three patches are almost identical to my three patches in bug
> 770067, from three days ago.  I'm happy to abandon my patches in favour of
> yours because you have follow-ups.  But I'd like to understand how this
> duplication of work happened -- did you not see my review requests?

Right, I just hadn't gotten to them yet. Great minds think alike, I guess.

Thanks for reviewing anyway.

> >   * NB: If you add enumerators for scope statements, add them between STMT_WITH
> >   * and STMT_CATCH, or you will break the STMT_TYPE_IS_SCOPE macro. If you add
> 
> STMT_TYPE_IS_SCOPE has been renamed.  Also, you changed it from a range test
> to "type == STMT_WITH || type == STMT_CATCH", so this comment is no longer
> correct.  I suggest you keep it as a range test;  that's what I did in my
> patch.

OK.
(In reply to Nicholas Nethercote [:njn] from comment #6)
> ::: js/src/frontend/TreeContext.h
> @@ +397,5 @@
> > +
> > +    ptrdiff_t &gosubs() {
> > +        JS_ASSERT(type == STMT_FINALLY);
> > +        return breaks;
> > +    }
> 
> I used unions in my patch, but I didn't have the type assertions.  Maybe you
> could use unions?  And/or: having protected these accesses with assertions,
> is it worth protecting the update/breaks/continues accesses similarly?  I'll
> let you decide;  what you have is already a clear improvement.

Oh, you know what we should do, we should make a subclass for each of those, and assert when downcasting rather than on every access.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: