Questions tagged [v8]

V8 is Google's open source JavaScript engine.

About V8

V8 is Google's Javascript engine that is used in Google Chrome (). It is written in C++ (), and is open source, which can be checked out by following the instructions on the v8 wiki.

V8 can run standalone, or can be embedded into C++ applications.

Documentation on V8 can be found on its wiki pages.

There are a number of flags that can be passed to V8 to expose its internals. For instance, --trace-deopt gets V8 to log code deoptimizations, and --expose-gc allows scripts to manually invoke a garbage collection. The full list of flags can be found by reading the source.

Links:

Tag Usage

Use this tag to ask questions about:

  • Usage of the V8 API
  • Performance and profiling with V8
  • How V8 works
2955 questions
46
votes
1 answer

How to read nodejs internal profiler tick-processor output

I'm interested in profiling my Node.js application. I've started it with --prof flag, and obtained a v8.log file. I've taken the windows-tick-processor and obtained a supposedly human readable profiling log. At the bottom of the question are a few a…
nathan g
  • 858
  • 9
  • 17
44
votes
5 answers

How to debug node js app with breakpoints and everything?

I've installed node-inspector just to find out that it doesn't support breakpoints :| What's the point in it at all, bearing in mind that on big part node code is asynchronous and you simply cannot follow it step by step?.. I'm definitely missing a…
jayarjo
  • 16,124
  • 24
  • 94
  • 138
41
votes
3 answers

Math.random() returns value greater than one?

While playing around with random numbers in JavaScript I discovered a surprising bug, presumably in the V8 JavaScript engine in Google Chrome. Consider: // Generate a random number [1,5]. var rand5 = function() { return parseInt(Math.random() *…
maerics
  • 151,642
  • 46
  • 269
  • 291
41
votes
4 answers

Embed a JavaScript engine in an iOS application

I wonder if anyone has successfully ported a javascript engine/interpreter to iOS. I'm writing an iPhone game that I would like to use Javascript as the high-level scripting language (AI, gameplay, etc.), but to do that, I need to compile the JS…
dennycd
  • 415
  • 1
  • 7
  • 11
41
votes
5 answers

how to know which javascript version in my NODEJS?

I want to know which javascript version is my NodeJS is supporting ?
Dexter
  • 12,172
  • 9
  • 27
  • 30
39
votes
1 answer

How do 'cluster' and 'worker_threads' work in Node.js?

Did I understand correctly: If I use cluster package, does it mean that a new node instance is created for each created worker? What is the difference between cluster and worker_threads packages?
38
votes
5 answers

How does setInterval and setTimeout work?

I was in an awkward situation, I am working with pure JavaScript for almost 3 years, and I know that JavaScript is single-threaded language, and that you can simulate asynchronous execution using setInterval and setTimeout functions, but when I…
Taron Mehrabyan
  • 2,199
  • 2
  • 20
  • 27
38
votes
3 answers

Calling a v8 javascript function from c++ with an argument

I am working with c++ and v8, and have run into the following challenge: I want to be able to define a function in javascript using v8, then call the function later on through c++. Additionally, I want to be able to pass an argument to the…
user396404
  • 2,759
  • 7
  • 31
  • 42
38
votes
11 answers

Javascript: How to get multiple matches in RegEx .exec results

When I run /(a)/g.exec('a a a ').length I get 2 but I thought it should return 3 because there are 3 as in the string, not 2! Why is that? I want to be able to search for all occurances of a string in RegEx and iterate over them. FWIW: I'm using…
Trindaz
  • 17,029
  • 21
  • 82
  • 111
37
votes
6 answers

Maximum number of entries in Node.js Map?

I was making a large Map in Node.js v11.9.0 and it kept failing with "FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory". My map's keys and values shouldn't be getting anywhere near the size of Node's heap size, so I…
Ahmed Fasih
  • 6,458
  • 7
  • 54
  • 95
35
votes
3 answers

Access function location programmatically

Is it possible in code to access ["[[FunctionLocation]]"] property that google chrome developer tools show when using console log on a function ?
Sushruth
  • 1,074
  • 1
  • 9
  • 14
35
votes
9 answers

Referencing Google's V8 engine from a .NET app

I'm building a .NET 3.5 application and have the need to evaluate JS code on the server - basically a user provided rule set that can work within a browser or on the server. Managed JS is not an option, because the JS code would be provided at…
NathanD
  • 8,061
  • 7
  • 30
  • 26
34
votes
5 answers

node.js in Eclipse - which plugin(s) are most people using?

I'm mostly interested in server-side web development, though being able to redeploy some bits in Chrome would be nice. I am currently running Eclipse Indigo on Ubuntu for developing mostly Java/Scala programs and to use git. So far I've come across…
danja
  • 1,030
  • 2
  • 10
  • 15
34
votes
3 answers

How to embed V8 in a Java application?

I'm looking for a solution for embedding the Google JavaScript engine V8 in my Java application. Have you got some solutions?
Stephan
  • 41,764
  • 65
  • 238
  • 329
34
votes
1 answer

How is asynchronous javascript interpreted and executed in Node.js?

I've been doing a lot of research into the core of Node.js lately, and I have some questions about the inner workings of the Node platform. As I understand it, Node.js works like this: Node has an API, written in Javascript, that allows the…
Chandler Freeman
  • 899
  • 1
  • 10
  • 25