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
1
vote
2 answers

SyntaxError in Chrome but ReferenceError in node

So I run the same code 5=6 on both chrome and node this of course produces an error. But look at the error type! On chrome it's a SyntaxError on node ReferenceError. Well that's odd. For one thing cause both use v8, for another because…
George Mauer
  • 117,483
  • 131
  • 382
  • 612
1
vote
1 answer

Load *.dylib or *.so into the V8 Javascript runtime?

While not specifically related to Frida's use of V8, I was reading this Frida release page and noticed it made the following reference: Short of writing the whole agent in C, one could go ahead and build a native library, and load it using…
sherrellbc
  • 4,650
  • 9
  • 48
  • 77
1
vote
1 answer

Embeding V8 in C++ causes "unrecognized external symbol" errors related to libcpp

I am trying to embed v8 into my application (using Visual Studio 2019). First, I built it to x86 (ia32) debug static linked library. I also wanted it to be monolitic. There were some errors, but eventualy I managed and I succesfully built it. I ran…
Redcap16
  • 13
  • 3
1
vote
0 answers

Since googlesheets changed to V8 runtime none of my scripts work. How do I open sheet to todays date and back up sheet?

It looks like all my googlesheets have been updated to V8 runtime however now none of my scripts work. I need to back up my googlesheets daily and this script is just failing. I need to open on todays date and jump to todays date. Please can anyone…
Natalie
  • 11
  • 1
1
vote
0 answers

Node Express Handlebars and high CPU usage

We've developed a Node.js Express app which uses Handlebars as a templating engine. The problem is that it uses a lot of CPU and we can't understand why. For example, it uses 25% CPU on single thread for a single user request. The process is ran…
1
vote
1 answer

v8 NAN support moving from Nodejs 10 to 14

On Windows my NodeJS / Electron app has a dependency on a native library. The app interacts with this library via a 3rd party Node module based on NAN. This module works well but is out of date. That has forced us to stick with Nodejs v10.x.x.…
Shane Gannon
  • 6,770
  • 7
  • 41
  • 64
1
vote
1 answer

Syntax Error on internal function when calling another function in a library

I am having an issue with a script that references a library. My issue is not connecting to the library, its that my script calls a function, but when it runs, it errors out on a function that I am not referencing. In sheet A, I have this…
Stephen
  • 11
  • 2
1
vote
1 answer

Get a reference to the script object

In V8 at least, in the debugger, you see local, script and global categorizing the variables. I got a reference to global. All you do for that is set this on entry to a property to use later if need be. However, I can't find how to save a reference…
toddmo
  • 20,682
  • 14
  • 97
  • 107
1
vote
2 answers

Unable to access exception properties in v8 runtime

I am trying to get the stack trace (and other details) when an exception occurs in my code. To do this the following piece of code use to work: function catchException() { var errLog = []; try { var temp; temp.split(","); …
1
vote
1 answer

How is an "array" implemented in JavaScript?

I use the term loosely as an array in JavaScript can look like this: let array = [1, 'a', "hello"]; If I do array.push('end') I get [1, 'a', "hello", "end"] An array in JavaScript seems to have nothing to do with the arrays taught in Computer…
jennifer
  • 682
  • 5
  • 14
1
vote
1 answer

How v8 Javascript engine performs bit operations on Int32Array values

As far as I know, V8 Javascript engine makes double number conversion (to i32 and back) to perform bit operation. Let's consider next example: const int32 = new Int32Array(2); int32[0] = 42; int32[1] = 2; const y = int32[0] | int32[1]; Does V8…
1
vote
1 answer

How do I assign a name to a v8::Object so that scripts can access it?

I'm currently trying to add scripting functionality to my C++ application by using v8. The goal is to process some data in buffers with JS and then return the result. I think I can generate an ArrayBuffer by using New with an appropriate…
Tobias Langner
  • 10,634
  • 6
  • 46
  • 76
1
vote
1 answer

What happens when you wait to resolve a promise in Node

const fetchPromise = fetch('example.com') // Takes 1 second to resolve ... ... // Do 3 seconds of work ... const response = await fetchPromise // What happens with the promise between seconds 2-3? What happens with the promise response before you…
BryceLarkin
  • 476
  • 1
  • 6
  • 16
1
vote
1 answer

How can I inspect x86/x64 code generated by V8 from WebAssembly?

https://webassembly.studio/ allows inspection of WebAssembly (WASM) files and the corresponding SpiderMonkey-generated x86 code. I'd like to similarly inspect instructions generated by V8's WASM compilers (Liftoff and TurboFan). I'm entirely…
Dennis
  • 323
  • 7
  • 17
1
vote
1 answer

Can anyone explain this Google V8 bytecode CreateObjectLiteral?

This is a JavaScript source code. const obj = { name: 'hello', age: 12 }; console.log(obj); And this is a Google V8 byte code generated using node js option --print-bytecode. [generated bytecode for function: ] Parameter count 6 Frame size…
ZhefengJin
  • 930
  • 8
  • 17
1 2 3
99
100