v8

Why is Math.pow() (sometimes) not equal to ** in JavaScript?

不问归期 提交于 2019-12-20 08:12:16
问题 I've just discovered the ECMAScript 7 feature a**b as an alternative for Math.pow(a,b) (MDN Reference) and came across a discussion in that post, in which they apparently behave differently. I've tested it in Chrome 55 and can confirm that the results differ. Math.pow(99,99) returns 3.697296376497263e+197 whereas 99**99 returns 3.697296376497268e+197 So logging the difference Math.pow(99,99) - 99**99 results in -5.311379928167671e+182 . So far it could be said, that it's simply another

Implicit and Explicit Regex creation yield different exec results

。_饼干妹妹 提交于 2019-12-20 05:55:37
问题 I am searching on a largeish (500kb) document with a regex. I am using node.js (v0.10.13), but the behaviour is the same in Chrome (31) DevTools. With implicit regex creation I get what I expect to: >/worker(?:.|\n)+Name:\s+(.+?)\s+Job title/.exec(text) ["worker John Doe (s): Name: Mrs Jean Smith Job title", "Mrs Jean Smith"] If I explicitly create a RegExp (which I need to do, since the expression can change at run-time) then it fails: >new RegExp('worker(?:.|\n)+Name:\s+(.+?)\s+Job title')

Node-Webkit on Windows runs in 3 different processes?

耗尽温柔 提交于 2019-12-20 04:12:29
问题 I'm sorry if this is a duplicate. I tried to Google the answer but it isn't very helpful. If I run a node-webkit app using nw . , and then open Windows Task Manager, there are three different processes by the name of nw running. I have checked repeatedly but there is a single node-webkit application running on my system. Also, if I "End Task" any one of them, the app exits and the other two processes vanish too. Is that normal behaviour? Is there a documented explanation behind this? Here is

Node Buffer to char array

泄露秘密 提交于 2019-12-20 03:52:44
问题 I have a native NodeJS addon that accepts a Buffer instance as one of it's arguments. I'm able to convert a char array into a Buffer with the following code, but looking for the other way around. static v8::Local<v8::Object> create_buffer(char *data, unsigned long length) { node::Buffer *slow_buffer = node::Buffer::New(length); memcpy(node::Buffer::Data(slow_buffer), data, length); v8::Handle<v8::Value> constructor_arguments[3] = { slow_buffer->handle_, v8::Integer::New(length), v8::Integer:

Memory Leak with an XMLHttpRequest and setInterval

戏子无情 提交于 2019-12-20 02:38:17
问题 Here's some code that I run on Google Chrome 19.0.1061.1 (Official Build 125213) dev: <html> <title>Memory Leak</title> <script type="text/javascript"> (function(){ this.window.setInterval(function() { var xhr = new XMLHttpRequest(); xhr.open('GET', '', false); xhr.send(); }, 50); }).call(this); </script> </html> When I inspect memory usage in chrome://tasks, I can see that "Private Memory" is growing up indefinitely (8GB RAM config). If I change the sample of code above to something like

Why isn't Map subclassable in chrome/node?

廉价感情. 提交于 2019-12-20 01:46:16
问题 So ES 6 is bringing us Maps (and none too soon). Wishing to subclass Map for my own nefarious purposes, I tried the following (abbreviated for clarity): function Foo() { return Map.apply(this, [].slice.call(arguments)); } var bar = new Foo(); In V8 environments this throws an Error "Map constructor not called with 'new'". Why? SpiderMonkey gets this 'right': Map.call({}, [['foo', 'bar']]).get('foo'); will, as expected, yield 'bar'. In both SpiderMonkey and V8 attempting something like

Why isn't Map subclassable in chrome/node?

老子叫甜甜 提交于 2019-12-20 01:46:14
问题 So ES 6 is bringing us Maps (and none too soon). Wishing to subclass Map for my own nefarious purposes, I tried the following (abbreviated for clarity): function Foo() { return Map.apply(this, [].slice.call(arguments)); } var bar = new Foo(); In V8 environments this throws an Error "Map constructor not called with 'new'". Why? SpiderMonkey gets this 'right': Map.call({}, [['foo', 'bar']]).get('foo'); will, as expected, yield 'bar'. In both SpiderMonkey and V8 attempting something like

const within block scopes in Node and Chrome (V8)

耗尽温柔 提交于 2019-12-20 01:07:13
问题 I am writing a nodejs (v4.2.4) app were I encountered some odd behaviour. function A(number) { this.number = number; } for(var i = 0; i < 3; i++) { const a = new A(i); console.log(a.number); } const b = new A(99); console.log(b.number); My intuition, coming from Java (and the one of FireFox), is that the output should have been 0 1 2 99 However, Node (and Chrome) give me 0 0 0 99 I investigated and understood from MSN - block scope that var does not have block scope in javascript. Looking

how to add path with module to python?

天涯浪子 提交于 2019-12-19 16:16:10
问题 I try to build V8 javascript engine. When I try to invoke the command python build/git_v8 , I get error: File build/gyp_v8, line 48 in < module > import gyp ImportError: No module named GYP How I can tell python where search GYP module and what is the correct path to the module in the folder GYP? My version of python is 2.6.2.2, recommended in build instructions. 回答1: Obviously, the module gyp.py is not in the search path of modules (sys.path). sys.path is an array variable in sys module

how to add path with module to python?

北城余情 提交于 2019-12-19 16:16:05
问题 I try to build V8 javascript engine. When I try to invoke the command python build/git_v8 , I get error: File build/gyp_v8, line 48 in < module > import gyp ImportError: No module named GYP How I can tell python where search GYP module and what is the correct path to the module in the folder GYP? My version of python is 2.6.2.2, recommended in build instructions. 回答1: Obviously, the module gyp.py is not in the search path of modules (sys.path). sys.path is an array variable in sys module