Re:Porffor: A from-scratch ahead-of-time JS engine
by saagarjha on Tuesday July 30, 2024 @04:35PM
(#41113864)
What happens when someone calls eval?
[ Parent
| on HN ]
Re:Porffor: A from-scratch ahead-of-time JS engine
by syrusakbary on Tuesday July 30, 2024 @04:46PM
(#41113969)
Since Porffor can compile itself (you can run the compiler inside of Porffor), any calls to eval could be compiled to Wasm (via executing the Porffor compiler in Porffor JS engine) and executed performantly on the same JS context *
*or at least, in theory
Re:Porffor: A from-scratch ahead-of-time JS engine
by tasty_freeze on Tuesday July 30, 2024 @06:42PM
(#41114860)
I haven't used it, but reading their landing page, Porffor says their runtime is vastly smaller because it is AOT. If the compiler had to be bundled with the executable, then the size of the executable would grow much larger.
Re:Porffor: A from-scratch ahead-of-time JS engine
by spartanatreyu on Wednesday July 31, 2024 @01:44AM
(#41116646)
Yeah, but you'd only need to include Porffor into compiled code if it used eval.
And most devs stay away from eval for well-deserved security reasons.
[dead]
Re:Porffor: A from-scratch ahead-of-time JS engine
by syrusakbary on Wednesday July 31, 2024 @01:53PM
(#41121473)
You don't need to modify an already running program, you can plug new functions into an existing Wasm program via a table, and even attach variables via globals or function arguments.
I'd recommend checking the work on making SpiderMonkey emit Wasm as a backend
Re:Porffor: A from-scratch ahead-of-time JS engine
by canadahonk on Tuesday July 30, 2024 @06:52PM
(#41114917)
For now, unless it is given a literal string (eg `eval('42')`) eval just won't work.
Re:Porffor: A from-scratch ahead-of-time JS engine
by david2ndaccount on Tuesday July 30, 2024 @04:57PM
(#41114069)
With a string literal it works, with a dynamic string it just gives an undefined reference error to eval.