v8

Strange behaviour of JavaScript in Chrome Developer Tool

元气小坏坏 提交于 2019-12-30 08:33:21
问题 Recently, working with JavaScript in Developer Tool, I found strange feature. Chrome accepts any code between opening bracket with operator (plus, minus sign) and operator with closing brackets and executes it, like this: I didn't find this behaviour in another browsers, just in Chrome. Maybe it's a feature, but why and how it works, can it be problem with JavaScript engine? 回答1: This is the way chrome evaluates your input: with (typeof __commandLineAPI !== 'undefined' ? __commandLineAPI : {

Strange behaviour of JavaScript in Chrome Developer Tool

只谈情不闲聊 提交于 2019-12-30 08:33:02
问题 Recently, working with JavaScript in Developer Tool, I found strange feature. Chrome accepts any code between opening bracket with operator (plus, minus sign) and operator with closing brackets and executes it, like this: I didn't find this behaviour in another browsers, just in Chrome. Maybe it's a feature, but why and how it works, can it be problem with JavaScript engine? 回答1: This is the way chrome evaluates your input: with (typeof __commandLineAPI !== 'undefined' ? __commandLineAPI : {

Turn thin archive into normal one

孤街醉人 提交于 2019-12-30 04:46:26
问题 I'm building V8, and by default it builds as a "thin" archive, where the .a files essentially just contain pointers to the object files on your filesystem instead of containing the object files themselves. See man ar for details. I want to be able to put this library in a central place so that other people can link to it, and it would be obviously much easier to provide a normal archive file instead of providing a gaggle of object files as well. How do I take the thin archives produced by the

how to know which javascript version in my NODEJS?

与世无争的帅哥 提交于 2019-12-30 03:41:34
问题 I want to know which javascript version is my NodeJS is supporting ? 回答1: Use process.versions. From that page in the documentation: console.log(process.versions); outputs { node: '0.4.12', v8: '3.1.8.26', ares: '1.7.4', ev: '4.4', openssl: '1.0.0e-fips' } EDIT : V8 uses the ECMAScript as specified in ECMA-262, 5th edition . Reference: http://code.google.com/p/v8/ 回答2: According to its documentation, this command could be used; node -p process.versions.v8 回答3: Not trying to necropost, here --

V8 Multithreaded function

烈酒焚心 提交于 2019-12-29 07:16:07
问题 I'm writing a Node plugin and I'm having problems trying to call a V8 function object from a C++ worker thread. My plugin basically starts a C++ std::thread and enters a wait loop using WaitForSingleOject(), this is triggered by a different C++ app (An X-Plane plugin) writing to a bit of shared memory. I'm trying to get my Node plugin to wake up when the Windows shared event is signaled then call a JavaScript function that I've registered from the node app, which will in turn pass the data

What is the variable $x used for in Chrome?

风流意气都作罢 提交于 2019-12-29 06:48:12
问题 A few days ago a friend and I were playing around with the Javascript console in Chrome (using a slightly older version, but this can be repeated in the latest stable build on both OSX and windows) when we assigned a string to the variable $x. $x = "hello" but when we echo out the value of $x, we get given the following code in the console: bound: function (xpath, context) { var doc = (context && context.ownerDocument) || inspectedWindow.document; var result = doc.evaluate(xpath, context ||

Is Javascript substring virtual?

坚强是说给别人听的谎言 提交于 2019-12-29 05:09:34
问题 If we have a huge string, named str1 , say 5 million characters long, and then str2 = str1.substr(5555, 100) so that str2 is 100 characters long and is a substring of str1 starting at 5555 (or any other randomly selected position). How JavaScript stores str2 internally? Is the string contents copied or the new string is sort of virtual and only a reference to the original string and values for position and size are stored? I know this is implementation dependent, ECMAScript standard (probably

Is Javascript substring virtual?

老子叫甜甜 提交于 2019-12-29 05:08:28
问题 If we have a huge string, named str1 , say 5 million characters long, and then str2 = str1.substr(5555, 100) so that str2 is 100 characters long and is a substring of str1 starting at 5555 (or any other randomly selected position). How JavaScript stores str2 internally? Is the string contents copied or the new string is sort of virtual and only a reference to the original string and values for position and size are stored? I know this is implementation dependent, ECMAScript standard (probably

Object descriptor getter/setter performance in recent Chrome/V8 versions

落花浮王杯 提交于 2019-12-28 01:33:29
问题 Given var obj = {}; var _a = 1; obj._a = 1; obj.aGetter = function() { return _a; } obj.aSetter = function(val) { _a = val; } Object.defineProperty(obj, 'a', { enumerable: true, get: function () { return _a; }, set: function(val) { _a = val; } }); using getter/setter functions obj.aSetter(2); obj.aGetter(); will have some decrease in Chrome/V8 performance (~3x) when compared to direct property access: obj._a = 2; obj._a; This is be understandable. And using descriptor getter/setter obj.a = 2;

Prevent multiple console logging output while clustering

扶醉桌前 提交于 2019-12-25 12:12:43
问题 I'm using the cluster module for nodejs . Here is how I have it set up: var cluster = require('cluster'); if (cluster.isMaster) { var numCPUs = require('os').cpus().length; for (var i = 0; i < numCPUs; i++) { cluster.fork(); } }else{ console.log("Turkey Test"); } Now, I am forking 6 threads (6 cores) on my PC. So, when debugging my app and reading data from the console, this will appear: Is there anyway to make console.log output only once regardless of how many clusters are running? 回答1: You