Closed Bug 932276 Opened 11 years ago Closed 11 years ago

Compute static scope extents at compile-time and store them in JSScript

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: wingo, Assigned: wingo)

References

Details

(Whiteboard: [qa-])

Attachments

(3 files, 1 obsolete file)

The bytecode emitter should record the extent of block scopes at compile-time and store that in the script object.

This will allow computation of the block chain corresponding to a PC solely based on the PC, without abstract interpretation of the bytecode.  In the case of lexical blocks with unaliased locals, this will remove the need for ENTERBLOCK / LEAVEBLOCK instructions.  It also removes the need for SRC_HIDDEN annotations for nonlocal block exits -- the last use of SRC_HIDDEN after bug 932180.
Assignee: nobody → wingo
Depends on: 932216
Attachment #823984 - Flags: review?(jorendorff)
Attachment #823986 - Flags: review?(jorendorff)
Attachment #823987 - Flags: review?(jorendorff)
Blocks: 932312
Attachment #823984 - Flags: review?(jorendorff) → review+
Comment on attachment 823986 [details] [diff] [review]
Bytecode emitter records static scope extents (2/3)

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

::: js/src/frontend/BytecodeEmitter.cpp
@@ +786,5 @@
>  
>  static bool
> +EmitInternedObjectOp(ExclusiveContext *cx, uint32_t index, JSOp op, BytecodeEmitter *bce)
> +{
> +    JS_ASSERT(JOF_OPTYPE(op) == JOF_OBJECT);

Can this also assert that index is in range?

@@ +1087,5 @@
> +    JS_ASSERT(stmt->isBlockScope);
> +    JS_ASSERT(stmt->blockScopeIndex == bce->blockScopeList.length() - 1);
> +    JS_ASSERT(bce->blockScopeList.list[stmt->blockScopeIndex].length == 0);
> +    uint32_t scopeObjectIndex = bce->blockScopeList.list[stmt->blockScopeIndex].index;
> +    JS_ASSERT(scopeObjectIndex == bce->objectList.length - 1);

These assertions seem to explain the timing of EmitEnterBlock relative to the initialization of all these other bits of the script, which is nice. Can we also assert that pn->pn_objbox and scopeObjectIndex refer to the same thing?
Attachment #823986 - Flags: review?(jorendorff) → review+
Attachment #823987 - Flags: review?(jorendorff) → review+
Attachment #823987 - Attachment is obsolete: true
Comment on attachment 830704 [details] [diff] [review]
Reimplement GetBlockChainAtPC using JSScript::blockScopes() (3/3) v2

Thanks for the review, nits addressed.
Attachment #830704 - Attachment description: Reimplement GetBlockChainAtPC using JSScript::blockScopes() (3/3) → Reimplement GetBlockChainAtPC using JSScript::blockScopes() (3/3) v2
Attachment #830704 - Flags: review+
Keywords: checkin-needed
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: