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
25
votes
5 answers

Pop up blocker API- how to check if user has it enabled

I need to know when the user clicks on the button that triggers window.open if there is stable API/way to know beforehand if the user actively has a pop-up blocker? In some cases the user doesn't know/pay attention that they have pop-up blocker…
John Jerrby
  • 1,683
  • 7
  • 31
  • 68
25
votes
2 answers

Why is let slower than var in a for loop in nodejs?

I have written a very simple benchmark: console.time('var'); for (var i = 0; i < 100000000; i++) {} console.timeEnd('var') console.time('let'); for (let i = 0; i < 100000000; i++) {} console.timeEnd('let') If you're running Chrome, you can try it…
Jan Grz
  • 1,373
  • 14
  • 18
25
votes
3 answers

What are node.js bindings?

I am very new to node.js and I can not seem to find a definition anywhere as to what node.js bindings are. I have seen this term used in slides and nodejs talks but it was never clearly explained. Can anyone help clarify this concept for me? I have…
n3wb
  • 1,037
  • 5
  • 12
  • 20
25
votes
3 answers

How do you free a wrapped C++ object when associated Javascript object is garbage collected in V8?

V8's documentation explains how to create a Javascript object that wraps a C++ object. The Javascript object holds on to a pointer to a C++ object instance. My question is, let's say you create the C++ object on the heap, how can you get a…
postfuturist
  • 22,211
  • 11
  • 65
  • 85
25
votes
7 answers

Cross-compiling Node.js for ARM6 (Raspberry Pi)

I'm trying to get node.js v0.7.9 to compile for the raspberry pi, but as node and v8 are quite large, I'm hoping to be able to cross-compile on another more powerful PC. I'm using the linux-x86 arm-bcm2708-linux-gnueabi toolchain from…
Adam M-W
  • 3,509
  • 9
  • 49
  • 69
24
votes
3 answers

Debugging "Maximum call stack size exceeded"

I have a server that I can cause to die with the following output: events.js:38 EventEmitter.prototype.emit = function(type) { ^ RangeError: Maximum call stack size exceeded However, without a stack dump or trace,…
OrangeDog
  • 36,653
  • 12
  • 122
  • 207
24
votes
1 answer

why doesn't NodeJS support String.prototype.replaceAll?

This string method exists in browserland, but not in Node. Why not? It's neither brand-new nor exotic. replaceAll is part of ECMA-262 src replaceAll is described in detail on the V8 blog (added in v8.1) src NodeJS upgraded to V8 v8.1 with NodeJS…
Tom
  • 8,509
  • 7
  • 49
  • 78
24
votes
2 answers

How does the following code work?

#define TYPE_CHECK(T, S) \ while (false) { \ *(static_cast(0)) = static_cast(0); \ } I am reading Google v8's code and found…
Jexcy
  • 594
  • 4
  • 15
24
votes
2 answers

Memory overhead of typed arrays vs strings

I am trying to reduce the memory usage of a JavaScript web application that stores a lot of information in memory in the form of a large number of small strings. When I changed the code to use Uint8Array instead of String, I noticed that memory…
safsaf32
  • 1,517
  • 2
  • 13
  • 18
24
votes
3 answers

What is "CrankShaftScript" in Node.js?

There are more and more references in the Node.js community to "CrankShaftScript" (and "CrankShaftJS") on Twitter, GitHub, and Facebook group discussions. I thought Node.js was written in C++ and JavaScript, so what is CrankShaftScript referring to…
Matt Hargett
  • 1,906
  • 1
  • 17
  • 37
24
votes
2 answers

Does node.js compile JavaScript?

Node.js uses V8 and it compiles the JavaScript as an optimization strategy. So, the JavaScript running at the server side via node.js / V8 is compiled or interpreted?
Marcell Alves
  • 583
  • 2
  • 5
  • 19
24
votes
7 answers

Fix therubyracer/libv8 (0.12.1) installation on Mavericks

OK, I’m at the end of my tether with this. There are a few similar questions but they all refer to therubyracer 0.10, and they mostly conclude that the problem can be fixed by upgrading to 0.12. I’m having similar problems, but when I use…
Chris S
  • 719
  • 1
  • 6
  • 13
24
votes
2 answers

Is Javascript substring virtual?

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…
exebook
  • 32,014
  • 33
  • 141
  • 226
24
votes
1 answer

How to call C++ code from Node.js?

I'm currently developing a simulator that runs on a server and should display data in the browser. For serving files, communication and things like that, I'd like to use Node.js. But, I'm not sure if it will perform as well as I'd want it to in the…
corazza
  • 31,222
  • 37
  • 115
  • 186
23
votes
2 answers

Does Microsoft's ChakraCore provide any performance benefit over Google's V8 when used as JS Engine for Node.js

[I have Edited my question to narrow down the scenario to only Node.js. Please Re-Open it. It is a helpful question and Proper answers might come in future and not sooner as ChakraCore is still at very young age. But this question is Valid and…
Suman Barick
  • 3,311
  • 2
  • 19
  • 31