v8

Why are two calls to string.charCodeAt() faster than having one with another one in a never reached if?

余生长醉 提交于 2019-12-19 09:47:26
问题 I discovered a weird behavior in nodejs/chrome/v8. It seems this code: var x = str.charCodeAt(5); x = str.charCodeAt(5); is faster than this var x = str.charCodeAt(5); // x is not greater than 170 if (x > 170) { x = str.charCodeAt(5); } At first I though maybe the comparison is more expensive than the actual second call, but when the content inside the if block is not calling str.charCodeAt(5) the performance is the same as with a single call. Why is this? My best guess is v8 is optimizing

What does V8's ignition really do?

*爱你&永不变心* 提交于 2019-12-19 09:22:12
问题 On https://v8.dev/docs/ignition we can see that: Ignition is a fast low-level register-based interpreter written using the backend of TurboFan on https://docs.google.com/document/d/11T2CRex9hXxoJwbYqVQ32yIPMh0uouUZLdyrtmMoL44/edit?ts=56f27d9d# The aim of the Ignition project is to build an interpreter for V8 which executes a low-level bytecode, thus enabling run-once or non-hot code to be stored more compactly in bytecode form. The interpreter itself consists of a set of bytecode handler code

How to turn the V8 compiled javascript into an EXE?

强颜欢笑 提交于 2019-12-19 05:45:02
问题 I know that google's v8 compiles javascript into native machine (binary if I understand correctly) code. Is there a way to take the output and turn it into a exe? 回答1: I don't think you can directly turn a piece of JavaScript into an executable using V8, but you can probably make an application that bundles the V8 engine with the JavaScript and runs it as a stand-alone. You can find all information about V8 on its project page. Also note that JavaScript can't be completely compiled as it's a

How to turn the V8 compiled javascript into an EXE?

╄→尐↘猪︶ㄣ 提交于 2019-12-19 05:44:45
问题 I know that google's v8 compiles javascript into native machine (binary if I understand correctly) code. Is there a way to take the output and turn it into a exe? 回答1: I don't think you can directly turn a piece of JavaScript into an executable using V8, but you can probably make an application that bundles the V8 engine with the JavaScript and runs it as a stand-alone. You can find all information about V8 on its project page. Also note that JavaScript can't be completely compiled as it's a

how to render 32bit unicode characters in google v8 (and nodejs)

与世无争的帅哥 提交于 2019-12-19 05:43:52
问题 does anyone have an idea how to render unicode 'astral plane' characters (whose CIDs are beyond 0xffff) in google v8, the javascript vm that drives both google chrome and nodejs? funnily enough, when i give google chrome (it identifies as 11.0.696.71, running on ubuntu 10.4) an html page like this: <script>document.write( "helo" ) document.write( "𡥂 ⿸𠂇子" ); </script> it will correctly render the 'wide' character 𡥂 alongside with the 'narrow' ones, but when i try the equivalent in nodejs

How to store persistent handles in V8?

久未见 提交于 2019-12-19 02:05:18
问题 I want my class to hold a v8::Context and a v8::External as members. Therefore, I thought I had to use persistent handles. class ScriptHelper { public: ScriptHelper(v8::Persistent<v8::Context> Context) : context(Context) { // ... } // ... private: v8::Persistent<v8::Context> context; v8::Persistent<v8::External> external; }; However, persistent handles are non copyable in V8, so the code does not compile. The error occurs in the lines where the two memberes get initialized. For the context,

How to install V8Js for PHP on XAMPP for Windows?

非 Y 不嫁゛ 提交于 2019-12-18 21:16:36
问题 Been working for days now trying to find an easy way to install V8Js on XAMPP for windows, yet with no success. I have downloaded the latest XAMPP version with PHP version 7.2.0 VC15, and followed the instructions in this blog post - https://blog.xenokore.com/how-to-install-v8js-for-php-on-windows/ - but to no avail. I don't see a mention to V8Js in the phpinfo, and when I try to use it I get an ERROR Error: Class 'V8Js' not found in... I have downloaded the dll files from here - https://blog

Does V8 have an event loop?

谁说我不能喝 提交于 2019-12-18 16:53:45
问题 I keep hearing V8 has its rudimentary event loop implementation but couldn't find it doesn't really make sense to me. Methinks, the simplest design of a JS engine would be to simply run synchronously and let the "embedder" write their own event loop - like nodejs got libuv. Is there an event loop implementation in v8? If so, could you point me at it? 回答1: Your intuition is right that the event loop is something that embedders should have control over. However, it is also a fundamental

MongoDB SpiderMonkey doesn't understand UTF-8

喜你入骨 提交于 2019-12-18 15:52:39
问题 If I add non-ASCII characters to MongoDB database then all db.find() fail telling "non ascii character detected". It's problem of SpiderMonkey, I have to rebuild it with UTF-8 support. I've tried to do it like in http://www.mongodb.org/display/DOCS/Building+Spider+Monkey but it doesn't work (SpiderMonkey is not installed after I've completed all steps). I've got Ubuntu 11.04. Does anybody have instruction how to make it work there? Working instruction how to make work MongoDB with Google V8