Closed
Bug 478075
Opened 15 years ago
Closed 15 years ago
js_GetCallObject doesn't need 'parent' argument
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla1.9.2a1
People
(Reporter: jimb, Assigned: jimb)
Details
(Keywords: fixed1.9.1, Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file, 1 obsolete file)
6.43 KB,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
jsfun.cpp:js_GetCallObject takes a 'parent' argument, provides a default value if it's NULL, but then asserts that the parent must be the scopeChain of the passed-in fp. It's surprising for a function to take an argument, suggesting that its behavior can meaningfully vary depending on the value passed in, and then discover that there's only one permissible value --- which some callers compute in a circuitous way. We should just drop the 'parent' argument, and always set the parent from the fp.
Assignee | ||
Comment 1•15 years ago
|
||
Attachment #362774 -
Flags: review?
Assignee | ||
Updated•15 years ago
|
Attachment #362774 -
Flags: review? → review?(bent.mozilla)
Assignee | ||
Updated•15 years ago
|
Attachment #362774 -
Flags: review?(bent.mozilla) → review?(brendan)
Comment 2•15 years ago
|
||
Comment on attachment 362774 [details] [diff] [review] Bug 478075: Remove parent argument to js_GetCallObject. >+ /* Create the call object, using the frame's enclosing scope as >+ its parent, and link the call to its stack frame. */ Nit: looks good but this "Harbison&Steele" style is not consistent with prevailing major comment style. Anything to assert about fp->scopeChain here? I'm not sure, but the thought occurs. >+ /* Push callobj on the top of the scope chain, and make it the >+ variables object. */ Another good-lookin' but non-conformant multiline comment. If enough people prefer this style and don't mind two multiline comment styles, let's add it to the style guide. We should have a straw IRC poll or something. Thanks, /be
Attachment #362774 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 3•15 years ago
|
||
Revised comments; added assert.
Attachment #362774 -
Attachment is obsolete: true
Attachment #362974 -
Flags: review?(brendan)
Comment 4•15 years ago
|
||
Comment on attachment 362974 [details] [diff] [review] Bug 478075: Remove parent argument to js_GetCallObject. >+#ifdef DEBUG >+ /* A call object should be a frame's outermost scope chain element. */ >+ JSClass *classp = OBJ_GET_CLASS(cx, fp->scopeChain); >+ if (classp == &js_WithClass >+ || classp == &js_BlockClass >+ || classp == &js_CallClass) Thanks, good assert. You could use JS_ASSERT_IF(x,y) instead of if (x) JS_ASSERT(y). More nits: && and || at end of line, other ops generally at start of continuation (it is what it is, to some extent; mainly aligning conjuctive and alternative terms' starting columns seems a win, whereas it's easy to miss single-char operators at the end, and who said the trailing terms were created equal :-P -- but prevailing style is when-in-Rome for code changes, until we build new Rome or it gets sacked by vandals ;-). The other prevailing style thing would be if any condition were multiline (or then, or else -- even if only due to a comment), then brace everything. Also why not use our new tw=99 order and put the condition on one line? Thanks, r=me with the one-line condition nit-pick. /be
Attachment #362974 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 5•15 years ago
|
||
Thanks! Landed in TM: http://hg.mozilla.org/tracemonkey/rev/b9da8c3fd3ad
Status: NEW → ASSIGNED
Whiteboard: fixed-in-tracemonkey
Assignee | ||
Updated•15 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment 6•15 years ago
|
||
m-c: http://hg.mozilla.org/mozilla-central/rev/b9da8c3fd3ad , ftw!
Comment 7•15 years ago
|
||
m-191: http://hg.mozilla.org/releases/mozilla-1.9.1/rev/176061aa5ccf
Keywords: fixed1.9.1
Updated•15 years ago
|
OS: Linux → All
Hardware: x86 → All
Target Milestone: --- → mozilla1.9.2a1
Version: unspecified → Trunk
You need to log in
before you can comment on or make changes to this bug.
Description
•