Closed
Bug 708428
Opened 13 years ago
Closed 12 years ago
The BytecodeEmitter should transform JSOP_GETGNAME "undefined" into JSOP_UNDEFINED
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: evilpie, Assigned: evilpie)
References
Details
Attachments
(1 file)
7.86 KB,
patch
|
jorendorff
:
feedback+
|
Details | Diff | Splinter Review |
Jägermonkey already does this, also for Infinity and NaN, but I think converting them into doubles would confuse people.
Assignee | ||
Updated•13 years ago
|
Assignee: general → evilpies
Assignee | ||
Comment 1•13 years ago
|
||
This feels like it might have been a bit to easy. I just looked at the points where we optimize nodes into jsop_getgname, and transformed them to jsop_undefined if appropriate. I first tried to follow jsop_arguments/jsop_callee, but I think they appear in a lot more places, because they apply in more places. Please a bit of feedback if this is sane :O
Attachment #580042 -
Flags: feedback?(jorendorff)
Assignee | ||
Comment 2•13 years ago
|
||
Comment on attachment 580042 [details] [diff] [review] WIP Review of attachment 580042 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jsopcode.cpp @@ +3144,5 @@ > /* FALL THROUGH */ > > case JSOP_SETRVAL: > rval = POP_STR(); > + if (*rval == '\0' || pc[-oplen] == JSOP_UNDEFINED) This is of course wrong, but I currently can't think of a way to reliable get the last jsop. Suggestions?
Comment 3•12 years ago
|
||
Comment on attachment 580042 [details] [diff] [review] WIP This seems fine. Another way to do it would be to wait until EmitNameOp when we are just about to emit the JSOP_GETGNAME opcode and change it there, at the last minute. (I didn't look at the code; that approach might be worse.) >- if (!bce->mightAliasLocals() && !TryConvertToGname(bce, pn, &op)) >+ if (!TryConvertToGname(bce, pn, &op)) I didn't look into why it's OK to remove the mightAliasLocals() check. (In reply to Tom Schuster (evilpie) from comment #2) > This is of course wrong, but I currently can't think of a way to reliable > get the last jsop. Suggestions? Not sure, but I think ss->bytecodes[top] would be JSOP_UNDEFINED just before you call POP_STR(). I would add tests for the decompiler and for more different kinds of shadowing, including 'undefined' inside of a with-block. Style nit: The new if/else in Decompile needs curly braces.
Attachment #580042 -
Flags: feedback?(jorendorff) → feedback+
Assignee | ||
Comment 4•12 years ago
|
||
Not really worth the required hacks.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•