Closed Bug 475844 Opened 15 years ago Closed 9 years ago

Bytecode for regexps and sub-functions seems to differ depending on compilation method

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
minor

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jruderman, Unassigned)

Details

(Keywords: testcase)

new Function --> "regexp null"
function(){} --> "object /x/"

I'd expect the bytecode to not depend on how the function was compiled, unless there's a semantic difference I'm not aware of.

<brendan> Jesse: bug, igor may be interested -- came in with movement of literal objects out of script->atomMap into their own tables -- please file
js> f = new Function("return /x/");      
function anonymous() {
    return /x/;
}
js> dis(f)                          
flags: LAMBDA INTERPRETED
main:
00000:  regexp null
00003:  return
00004:  stop

Source notes:

js> dis(eval(uneval(f))
)
flags: LAMBDA INTERPRETED
main:
00000:  object /x/
00003:  return
00004:  stop

Source notes:
js> f = new Function("({ get x() 5 })");
function anonymous() {
    ({get x() 5});
}
js> dis(f)
flags: LAMBDA INTERPRETED
main:
00000:  newinit 1
00002:  anonfunobj null
00005:  getter
00006:  initprop "x"
00009:  endinit
00010:  pop
00011:  stop

Source notes:

js> dis(eval(uneval(f)))
flags: LAMBDA INTERPRETED
main:
00000:  newinit 1
00002:  anonfunobj (function () 5)
00005:  getter
00006:  initprop "x"
00009:  endinit
00010:  pop
00011:  stop

Source notes:
Assignee: general → nobody
No longer reproducible - Resolving as WFM.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.