You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation might not be easy to prevent side effects though. Do you know how these are prevented in Chrome?
V8 defines whitelists for bytecodes and builtins. During side-effect free mode, if we execute bytecode or builtins that are not whitelisted, we abort. For a greylist of bytecodes and builtins, we only allow operations on objects that have been created during side-effect free mode, to ensure that these changes do not escape.
Bindings defined through the V8 API are generally not whitelisted unless explicitly marked as such.
Seeing @jdalton recently joined @nodjes/repl - he didn't get the ping about this before (I think?).
Regarding v8::Script::Run - sure - I'm not familiar with Runtime.evaluate or if we can even use inspector functions in the REPL (even if we run an inspector in the background).
@benjamingr We currently use inspector functions in the REPL when they’re available for accessing pseudo-global-scope let and const variables, so that might be the easier route to go (and doesn’t require explicit V8 support being added in the C++ API)
Reacted by Benjamin Gruenbaum and Ruben Bridgewater
Activity
BridgeAR commentedon May 26, 2018
I like the idea.
BridgeAR commentedon May 26, 2018
The implementation might not be easy to prevent side effects though. Do you know how these are prevented in Chrome?
benjamingr commentedon May 26, 2018
@BridgeAR they use the function I linked to above in
SharedFunctionInfo::SideEffectState BuiltinGetSideEffectStateand time the evaluation out after 500msdevsnek commentedon May 26, 2018
as a sidenote we would need to start properly marking our natively defined functions on whether they have side effects or not.
benjamingr commentedon May 26, 2018
@devsnek
IIUC only as progressive enhancement - things that weren't tagged would not eager-evaluate and the users would get the same UX they do today.
hashseed commentedon May 28, 2018
V8 defines whitelists for bytecodes and builtins. During side-effect free mode, if we execute bytecode or builtins that are not whitelisted, we abort. For a greylist of bytecodes and builtins, we only allow operations on objects that have been created during side-effect free mode, to ensure that these changes do not escape.
Bindings defined through the V8 API are generally not whitelisted unless explicitly marked as such.
hashseed commentedon May 28, 2018
Note that side-effect free mode is only accessible through the DevTools protocol right now, through
Runtime.evaluateandDebugger.evaluateOnCallFrame.benjamingr commentedon May 28, 2018
@hashseed would it be possible to expose it in a way where Node.js can use side effect free mode?
I think this could be really cool to have in our REPL
hashseed commentedon May 28, 2018
You mean as option to
v8::Script::Run? I'd be open to that. Then againRuntime.evaluateessentially just does that.benjamingr commentedon May 28, 2018
Seeing @jdalton recently joined @nodjes/repl - he didn't get the ping about this before (I think?).
Regarding
v8::Script::Run- sure - I'm not familiar withRuntime.evaluateor if we can even use inspector functions in the REPL (even if we run an inspector in the background).addaleax commentedon May 28, 2018
@benjamingr We currently use inspector functions in the REPL when they’re available for accessing pseudo-global-scope
letandconstvariables, so that might be the easier route to go (and doesn’t require explicit V8 support being added in the C++ API)hashseed commentedon May 29, 2018
I prefer the route through inspector because it already exists and has coverage via Chrome Devtools.
15 remaining items
antsmartian commentedon Mar 26, 2019
@metaa There was a attempt and a open PR here: #22875. I will try to close this when I get free time.
repl: support previews by eager evaluating input
repl: support previews by eager evaluating input
repl: support previews by eager evaluating input
repl: support previews by eager evaluating input