v8

Is Node.js production-ready on Windows? [closed]

半城伤御伤魂 提交于 2019-12-25 04:07:37
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . In the new 0.5.1 branch, there is an official Windows executable of Node.js. The Linux version of Node.js uses established libraries

RenderScript No Class Def found, when trying to blur background image

跟風遠走 提交于 2019-12-25 03:13:25
问题 When trying to blur an image I want to use import android.support.v8.renderscript.* So I put this in my build.gradle file: android { compileSdkVersion 23 buildToolsVersion '23.0.1'" defaultConfig { minSdkVersion 14 targetSdkVersion 23 renderscriptTargetApi 18 renderscriptSupportModeEnabled true }} And I use this method to blur the image: public static Bitmap blur(Context ctx, Bitmap image) { int width = Math.round(image.getWidth() * BITMAP_SCALE); int height = Math.round(image.getHeight() *

how do I go into eval('debugger') mode when already stopped at 'regular' debugger statement?

≯℡__Kan透↙ 提交于 2019-12-25 01:14:17
问题 I recently started to swap out all my debugger statements with eval('debugger') statements. The reason is that with the plain version, not all "factually/theoretically" visible variables are "practically" visible. This happens because of optimization (see earlier SO question). With this trick, the problem is like "90% solved" - there are some drawbacks. Apart from longer source code, those are: When third party libraries are involved, it is not feasible, maybe not even possible to have the

SetInternalFieldCount on constructor->InstanceTemplate() did not work for the instantiated object

吃可爱长大的小学妹 提交于 2019-12-25 00:52:53
问题 This post is about exposing C++ objects to the v8 javascript engine. To attach a C++ object to a javascript object, I make use of the GetInternalField() and External APIs. Before you can set or get any internal field, you have to call SetInternalFieldCount() on the corresponding ObjectTemplate . Since I want to expose a constructor function to the JS, I created a FunctionTemplate , set a C++ function that attache the native object to the JS object to that template, and finally

Implementing Zobrist hashing in Javascript

南楼画角 提交于 2019-12-24 18:01:22
问题 I need to implement Zobrist hashing for a chess engine in Javascript and I'm wondering what is the best way of accomplishing this. Now, I'm not a computer scientist and never had formal algorithms and data structures classes so I'm sorry if I'm a bit off on this... From what I understand I need a 64 bit hashfunction to encode a position as lower than that originates too many collisions. Now in javascript I only have access to 32 bits numbers. Also there is an issue with how I implement the

error MSB4057: The target “v8” does not exist in the project

久未见 提交于 2019-12-24 15:13:42
问题 I'm trying to build V8 as part of ArangoDB using the official build scripts and following the official Windows build instructions. The compilation fails for all v8* targets ( v8-build.bat ): msbuild All.sln /t:v8 /p:Configuration=Release /p:Platform=x64 msbuild All.sln /t:v8_libbase /p:Configuration=Release /p:Platform=x64 msbuild All.sln /t:v8_libplatform /p:Configuration=Release /p:Platform=x64 error MSB4057: The target "v8" does not exist in the project. If I open the solution file in

In nodejs, is there a better design pattern to call async functions synchronously?

自古美人都是妖i 提交于 2019-12-24 10:45:33
问题 For example, I want to write a test case, which need to track the status of a series calls. I can get something like this: async_fun(function () { // Do something ... async_fun(function () { // Do something ... async_fun(function () { // Do something ... // ... }); }); }); async_fun(); When I need to run a large loop, I can make a tail recursion like below: function helper (mount) { async_fun(function (){ if (mount) return; // Do something ... helper(mount--); }); } helper(10000); But, I

How is adding a new class with prototype methods a form of V8 optimization in JS?

半腔热情 提交于 2019-12-24 10:19:40
问题 I'm reading through Winston's code base and there was a comment in their DerivedLogger class line 22 that says: Create a new class derived logger for which the levels can be attached to the prototype of. This is a V8 optimization that is well known to increase performance of prototype functions. From what I gather here, they are saying that adding a new class (DerivedLogger) which adds prototype methods is a well known form of V8 optimization? how is it different from just adding the methods

Pass functions in a vm script context

这一生的挚爱 提交于 2019-12-24 07:37:05
问题 Let's say I have a library module that looks like this: module.exports = { increment: function() { count++; } } And I'd like to use it in a dynamically generated script that looks like this: (function() { lib.increment(); })(); by passing it in a sandbox: var sandbox = { count: 1 lib: require('./lib') } var script = new vm.Script('(function() { lib.increment() })();'); script.runInNewContext(sandbox); The obvious problem I run into is that I on the one hand can't require "lib" because "count"

Is there a limit on the number of members in a Javascript Set()? Or is this a bug in V8

≡放荡痞女 提交于 2019-12-24 01:19:45
问题 Here's some simple Javascript code that repeatedly adds integers into a Set: var i; var limit = 1 << 24; var s = new Set(); for (i = 0; i < limit + 10; i++) { s.add(i); if (i >= limit - 10) console.log ("Set size is now " + s.size) } When the set size grows to 2^24 exactly (which I've called "limit"), there is a FATAL ERROR: invalid table size Allocation failed - process out of memory The process isn't anywhere near running into an actual memory limit, and it's really suspicious that this