Closed Bug 1457365 Opened 7 years ago Closed 7 years ago

Do not add source note for useless expressions

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

https://searchfox.org/mozilla-central/rev/78dbe34925f04975f16cb9a5d4938be714d41897/js/src/frontend/BytecodeEmitter.cpp#8703-8704 > bool > BytecodeEmitter::emitExpressionStatement(ParseNode* pn) > { > ... > > if (!updateSourceCoordNotes(pn->pn_pos.begin)) > return false; > ... > if (useful) { > JSOp op = wantval ? JSOP_SETRVAL : JSOP_POP; > ValueUsage valueUsage = wantval ? ValueUsage::WantValue : ValueUsage::IgnoreValue; > MOZ_ASSERT_IF(expr->isKind(ParseNodeKind::Assign), expr->isOp(JSOP_NOP)); > if (!emitTree(expr, valueUsage)) > return false; > if (!emit1(op)) > return false; Currently updateSourceCoordNotes is called regardless of useful-ness. But we don't have to call it for useless expressions, since we don't emit bytecode for them.
here's try with the change. https://treeherder.mozilla.org/#/jobs?repo=try&revision=bf823a24557d083ed20fb57a223cc2fb496da996&group_state=expanded I'll post the patch once try finishes without unexpected failure.
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
This will reduce the source note size, and also help bug 1455548, since now we have to handle source note only if we're emitting the code there.
Attachment #8971495 - Flags: review?(jorendorff)
Attachment #8971495 - Flags: review?(jorendorff) → review+
Priority: -- → P2
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: