Closed Bug 838813 Opened 12 years ago Closed 12 years ago

Remove source notes no longer necessary due to e4x/decompiler removal

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: n.nethercote, Assigned: jorendorff)

References

Details

(Whiteboard: [js:t][MemShrink:P2])

Attachments

(12 files)

(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
(deleted), patch
n.nethercote
: review+
Details | Diff | Splinter Review
jorendorff has dibs on this (see bug 836949 comment 5).
BTW, this should reduce the "script-data" entries in about:memory.
Whiteboard: [js:t] → [js:t][MemShrink]
May I humbly suggest that you start with the destructuring srcnotes, a particular favorite of mine.
Whiteboard: [js:t][MemShrink] → [js:t][MemShrink:P2]
Attached patch part 1 - Remove SRC_INITPROP. (deleted) — Splinter Review
Attachment #710997 - Flags: review?(n.nethercote)
Attached patch part 2 - Remove SRC_GENEXP. (deleted) — Splinter Review
Attachment #710998 - Flags: review?(n.nethercote)
Attached patch part 3 - Remove SRC_DECL. (deleted) — Splinter Review
Attachment #710999 - Flags: review?(n.nethercote)
Attachment #710997 - Attachment description: , part 1 - Remove SRC_INITPROP. → part 1 - Remove SRC_INITPROP.
Attachment #711000 - Flags: review?(n.nethercote)
Attached patch part 5 - Remove SRC_DESTRUCT. (deleted) — Splinter Review
Attachment #711001 - Flags: review?(n.nethercote)
Attached patch part 6 - Remove SRC_BRACE. (deleted) — Splinter Review
Attachment #711003 - Flags: review?(n.nethercote)
Attached patch part 7 - Remove SRC_PCBASE. (deleted) — Splinter Review
Attachment #711004 - Flags: review?(n.nethercote)
Attachment #711014 - Flags: review?(n.nethercote)
Attached patch part 9 - Remove SRC_ENDBRACE. (deleted) — Splinter Review
Attachment #711015 - Flags: review?(n.nethercote)
Attachment #711017 - Flags: review?(n.nethercote)
Attached patch part 11 - Remove SRC_FUNCDEF. (deleted) — Splinter Review
Attachment #711038 - Flags: review?(n.nethercote)
Attachment #711039 - Flags: review?(n.nethercote)
Blocks: 838960
Attachment #710997 - Flags: review?(n.nethercote) → review+
Attachment #710998 - Flags: review?(n.nethercote) → review+
Comment on attachment 710999 [details] [diff] [review]
part 3 - Remove SRC_DECL.

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

::: js/src/frontend/BytecodeEmitter.cpp
@@ -4248,5 @@
> -        return false;
> -
> -    ptrdiff_t o = PackLetData((bodyEnd - bodyBegin) -
> -                              (JSOP_ENTERLET0_LENGTH + JSOP_LEAVEBLOCK_LENGTH),
> -                              letNotes.isGroupAssign());

I think PackLetData is dead now.  Maybe you'll get it in a later patch?
Attachment #710999 - Flags: review?(n.nethercote) → review+
Attachment #711000 - Flags: review?(n.nethercote) → review+
Attachment #711001 - Flags: review?(n.nethercote) → review+
Comment on attachment 711003 [details] [diff] [review]
part 6 - Remove SRC_BRACE.

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

::: js/src/frontend/BytecodeEmitter.cpp
@@ -4255,5 @@
> -        pn->expr()->getKind() != PNK_CATCH &&
> -        (stmtInfo.down
> -         ? stmtInfo.down->type == STMT_BLOCK &&
> -           (!stmtInfo.down->down || stmtInfo.down->down->type != STMT_FOR_IN_LOOP)
> -         : !bce->sc->isFunctionBox()))

Good riddance.

::: js/src/frontend/ParseNode.h
@@ +638,4 @@
>                                             which is left kid of PNK_FOR */
>  #define PNX_ENDCOMMA    0x10            /* array literal has comma at end */
>  #define PNX_GROUPINIT   0x20            /* var [a, b] = [c, d]; unit list */
> +#define PNX_FUNCDEFS    0x40            /* contains top-level function statements */

Dude, you just obsoleted my patch in bug 836949!  You know, the one you haven't reviewed yet! :P
Attachment #711003 - Flags: review?(n.nethercote) → review+
Attachment #711004 - Flags: review?(n.nethercote) → review+
Comment on attachment 711014 [details] [diff] [review]
part 8 - Remove SRC_LABEL and SRC_LABELBRACE.

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

Thanks for doing this as lots of little patches.  It makes the reviewing much easier.
Attachment #711014 - Flags: review?(n.nethercote) → review+
Attachment #711015 - Flags: review?(n.nethercote) → review+
Comment on attachment 711017 [details] [diff] [review]
part 10 - Do not remove SRC_SWITCH. Note where it's used.

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

I don't understand this, but just adding an assertion seems fine!
Attachment #711017 - Flags: review?(n.nethercote) → review+
Comment on attachment 711038 [details] [diff] [review]
part 11 - Remove SRC_FUNCDEF.

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

::: js/src/frontend/BytecodeEmitter.cpp
@@ -4554,5 @@
> -        /*
> -         * This second pass is needed to emit JSOP_NOP with a source note
> -         * for the already-emitted function definition prolog opcode. See
> -         * comments in EmitStatementList.
> -         */

That comment has baffled me for a long time.  What's the second pass?  Does it still exist?
Attachment #711038 - Flags: review?(n.nethercote) → review+
Comment on attachment 711039 [details] [diff] [review]
part 12 - Remove SRC_DESTRUCTLET.

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

Whoa.
Attachment #711039 - Flags: review?(n.nethercote) → review+
(In reply to Nicholas Nethercote [:njn] from comment #15)
> Comment on attachment 710999 [details] [diff] [review]
> part 3 - Remove SRC_DECL.
> 
> Review of attachment 710999 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: js/src/frontend/BytecodeEmitter.cpp
> @@ -4248,5 @@
> > -        return false;
> > -
> > -    ptrdiff_t o = PackLetData((bodyEnd - bodyBegin) -
> > -                              (JSOP_ENTERLET0_LENGTH + JSOP_LEAVEBLOCK_LENGTH),
> > -                              letNotes.isGroupAssign());
> 
> I think PackLetData is dead now.  Maybe you'll get it in a later patch?

No, I missed it. Gone in my local repo now...
Some final comments.

- Measurements of the "script-data" values in about:memory would be good.  You can get them on a per-compartment basis, or the total is down the bottom in the "other measurements" section.

- Have you grepped for "decompil"?  That might find other stuff to remove.  E.g. the comment above the definition of SrcNoteType has one occurrence.  And a comment in jsinterp.cpp (line 948) suggests that JSOP_SETNAME and JSOP_SETPROP might be able to be merged:  "Same for JSOP_SETNAME and JSOP_SETPROP, which differ only slightly but remain distinct for the decompiler".

- Is it worth renumbering the remaining srcnotes?  (If so, the XDR version number needs bumping.)

- Is SRC_HIDDEN still needed?  Its comment says "opcode shouldn't be decompiled", but it seems to have other, remaining uses.
> - Measurements of the "script-data" values in about:memory would be good. 

Gmail (if you have an account) and TechCrunch are two sites I often use for measuring, because they are both pigs.  (Gmail more understandably.)
(In reply to Nicholas Nethercote [:njn] from comment #22)
> - Measurements of the "script-data" values in about:memory would be good. 
> You can get them on a per-compartment basis, or the total is down the bottom
> in the "other measurements" section.

Yes, that would be good... it's probably a miniscule savings, though.

> - Have you grepped for "decompil"?  That might find other stuff to remove. 
> E.g. the comment above the definition of SrcNoteType has one occurrence. 
> And a comment in jsinterp.cpp (line 948) suggests that JSOP_SETNAME and
> JSOP_SETPROP might be able to be merged:  "Same for JSOP_SETNAME and
> JSOP_SETPROP, which differ only slightly but remain distinct for the
> decompiler".

Good point. There is a ton more to do.

> - Is it worth renumbering the remaining srcnotes?

Not to me.

> - Is SRC_HIDDEN still needed?  Its comment says "opcode shouldn't be
> decompiled", but it seems to have other, remaining uses.

Ooh. Yes, SRC_HIDDEN is still needed for two analyses in jsopcode. GetBlockChainAtPC is easy to read, and you can see how it's greatly simplified by SRC_HIDDEN.

But we are emitting it more than we really need to, and the name "SRC_HIDDEN" and the comment have become ridiculous. Filed follow-up bug 839110.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: