Questions tagged [v8]
V8 is Google's open source JavaScript engine.
2,985
questions
0
votes
0
answers
18
views
Can V8 optimize a function declared async, if all the code in it is synchonous?
The title says it all.
Another way of saying the same thing would be: if an async function does not contain any await calls does V8 know to optimize it away?
-1
votes
0
answers
47
views
SyntaxError: Invalid left-hand side in assignment Error on my Project
this is my HomeController.cs. i am using Microsoft.ClearScript.V8 library and when i run this code there get an error in "engine.Execute(additionalJson)" this line.
public IActionResult ...
0
votes
2
answers
120
views
What happens with async await exactly?
I have such a piece of code
async function loop() {
for (let i = 0; i < 3; i++) {
console.log(i,new Error("").stack);
await 1;
}
}
loop();
when I run it in Node (Chrome ...
0
votes
1
answer
35
views
Get V8 to retain debugging data
I am currently trying to debug V8, just in case anyone has any insights I will also explain the issue, but that is lateral to the question.
Context
I have a bundled JavaScript file that works as a ...
-1
votes
1
answer
39
views
Run .wasm (WasmGC) files from the terminal or from code?
Is there a way of running .wasm files programmatically or through the terminal that allows running .wasm files that follow the WasmGC spec today?
0
votes
1
answer
19
views
How to make best use out of V8's Profiler.takePreciseCoverage's return data
I've some code that outputs Profiler.takePreciseCoverage's data as JSON. Currently I can make use out of only the count and see that a function named fibonacci is running too many times. I don't know ...
0
votes
1
answer
48
views
How to trigger V8 "tiering up" with Liftoff [Arm64]
Working with V8 right now and I am trying to trying to trigger the Tiering Up of the Liftoff Assembler found in v8/v8/src/wasm/baseline/arm64/liftoff-assembler-arm64.h
Does anyone know how to do this? ...
0
votes
3
answers
87
views
Javascript Engine Optimization
If I have the following code in Javascript:
import getTranslation from "some-library";
import getUserSettings from "some-other-library";
const getTranslatedLabel = () => {
...
0
votes
1
answer
63
views
How to use linq in microsoft.clearscript.v8
I am using microsoft.clearscript.v8 in ASP.Net Core MVC. This code is in my Home controller:
public async Task<IActionResult> Index()
{
using (var engine1 = new V8ScriptEngine())
{
...
1
vote
0
answers
59
views
Backtrace doesn't work in GDB but works in LLDB
I'm trying to debug a nodejs core dump as an experimentation. My main target was simulating a production problem and seeing V8 stack trace in a core dump. Therefore I intentionally wrote a piece of ...
0
votes
0
answers
46
views
microsoft.clearscript.v8 in use promise but this code in error return
In this code I am using microsoft.clearscript.v8 library in c# (asp .net core mvc)
how to solve this error '((Microsoft.ClearScript.ScriptItem)promiseResult).UnderlyingSystemType' threw an exception ...
2
votes
0
answers
68
views
What's the difference between these two JS codes in V8?
I try to create a codeCache via V8. Use ScriptCompiler::CreateCodeCache function.
ScriptCompiler::CachedData* CreateCachedData(Local<String> sourceContent, Local<String> sourceName) {
...
0
votes
1
answer
42
views
Multiple warning messages "warning: (Internal error: pc 0x7ffff4688dd5 in read in CU, but not in symtab.)" in GDB, V8 debugging
I was debugging V8 x64 Debug Version, it has all debug files, I built with debug files for debugging. But symbols not properly loading in GDB. I cannot search or set breakpoint by function names, and ...
0
votes
0
answers
68
views
Google App Script's time-driven trigger is not firing/executing a function that works otherwise when manually running it
I have created a manual time-driven trigger that runs the function sendScheduledEmails every 30 minutes. See image below. Failure notification is set to notify me immediately if it fails.
Despite ...
4
votes
2
answers
112
views
Does pushing a string into an array, or setting it as the value to an object property, copy the string or keep a reference in JavaScript?
In v8 / Node.js in particular, when you push a primitive type (string, number, boolean) into an array, does it clone the string, or store a reference?
I know you can't do this and change the string:
...
0
votes
2
answers
83
views
In nodejs, how was javascript with c++ code references compiled and executed by the V8 engine? [closed]
I know that internalBindings is used in nodejs to help javascript code introduce the c++ module, but in the end v8 will compile javascript into ast. At this time, ast contains both the content of the ...
0
votes
1
answer
84
views
Write rust app that allows sandboxed plugins written in .. rust? [closed]
I want to write an app in rust that is extensible with plugins written by (untrusted) users. Those plugins are downloadable via a web platform and can be installed by any user of the core software, ...
0
votes
1
answer
72
views
How do I keep load module dynamically but without constant memory usage increase?
There is a need to load and serialize esm module dynamically on deno. As of I know, since there is no way to clear cache on await import(), I tried importing inside WebWorker, then kill it after it's ...
0
votes
1
answer
66
views
ReadableStreamBYOBReader.read ignoring offset on chrome
I'm trying to read a file with minimal amount of data copy using a ReadableStreamBYOBReader, but it seems that reader isn't reading at and writing to the correct offsets in Chrome.
In the following ...
0
votes
1
answer
68
views
V8 dead code elimination based on a runtime const
This is related to Is V8 capable of dead code elimination, based on the value of the `const`? except instead of an exported const, I have the following JavaScript code:
// ... a `state` object is ...
0
votes
1
answer
89
views
How much memory do javascript objects take in Node.js vs Chrome?
I don't understand why the heap size twice as big as it's supposed to be.
I created a perfect binary tree. I guess v8 knows that each node has 3 fields.
function buildTree(depth) {
if (depth === 0) ...
0
votes
1
answer
91
views
Intl not defined error , add intl support to V8
I am executing javascript using V8 in my project and i am getting this error:
Stack: ReferenceError: Intl is not defined
at getDateTimeFormat ([email protected]/plugin/timezone/index.js:24:5)
at ...
-1
votes
1
answer
63
views
Why is it not supported to cross-compile v8 for Android platform on Windows platform
“Android builds are only supported on Linux and Mac hosts”
There is such a sentence in the file BUILDCONFIG.gn,But there is not much explanation, and there is no information on the official website.I ...
0
votes
0
answers
19
views
How to avoid multiple VMs in chrome? (Nextjs)
I'm using nextjs to dev locally and I noticed some really strange bugs. (To be specific, I'm developing a PIXI app.) When I dug it, I realized that sometimes there might be multiple VMs running, each ...
-2
votes
1
answer
75
views
React scripts build javascript heap out of memory
Working on a react project.
when I try to run npm run build it shows java script heap out of memory error.
Error details
I tried to find memory leak but no memory leak found but it is a single page ...
0
votes
0
answers
63
views
Fix error static assertion failed due to requirement while building v8 ninja
The error stack below comes while executing command to build V8:
ninja -C out.gn/x64.release
ninja: Entering directory `out.gn/x64.release'
[3100/3298] CXX obj/test/unittests/v8_unittests_sources/...
0
votes
0
answers
37
views
tarfile.ReadError: file could not be opened successfully in update.py while executing gclient command
I ran fetch v8 command while trying to compile v8 from source code in my local system (executing this on rosetta terminal). I run into this error. Executing gclient sync -f or gclient after getting ...
0
votes
1
answer
36
views
i18n support on V8 with c++ wrapper file
In a project i am working we use V8 to execute javascript. There are v8lib_monolith.a files ( which suggest that v8 engine is pre compiled) . In the cmakelists which i am using to build my project i ...
0
votes
1
answer
54
views
Is there a difference between having class methods vs top-level functions in terms of Javascript parsing speed?
I'm developing a single page application and I have many files that are formatted like this:
export function a() {
// .. code here
}
export function b() {
// .. code here
}
export function c() {
...
1
vote
2
answers
101
views
Does Javascript ever garbage collect functions or constants?
Let's say there is a file in my app that consists of nothing but hundreds of exported functions, but only one rarely used part of my app uses them. A file like this:
export function a() {
..
}
...
0
votes
1
answer
16
views
"Deploy aborted" while running `update_depot_tools`
I'm trying to fetch/build v8 and need to install depot_tools first. While running update_depot_tools, I keep getting errors starting with the error
[P59642 22:11:48.064 deployer.go:355 W] [unzip 1/12]...
0
votes
0
answers
26
views
How to import a module in a C# JS runtime like V8.NET
In my C# code, I would like to execute javascript code that imports a module.
My C# code currently looks like this.
var code = """
import module from 'module';
"""
var ...
0
votes
1
answer
62
views
Memory usage for a recursive program in Node JS
I want to run a function again after sometime once the execution is completed. I have written 3 programs but I am not sure about the memory usage of the programs and which one would be the most ...
0
votes
0
answers
40
views
Run methods from Java Classes using J2V8
I'm in need of guidance for executing methods from Java classes using J2V8. While I can register a JS method with a Java callback, there are a lot of methods to define and thats is boring. Your ...
0
votes
1
answer
129
views
ClearScript V8 JS Cannot use Arrow Functions and modify destructured values
Update 2: Add the usage usage scenario.
Update 1: Interestingly enough
(
function({ value }){
return value * 2;
}
)
works just fine (as well as "-", "/"). ...
1
vote
1
answer
1k
views
Error: [email protected] has been disabled because it depends on Python 2 to build
I want to install v8 3.15 on MacOs with M2 pro apple chip. Getting the error that is disabled.
I tried to install x86-64 brew with rosetta and use that to install v8 but still getting the same error.
...
2
votes
0
answers
76
views
Why does exception stack trace not work in NodeJS when embedded in C++ code
I have following code:
process.on('uncaughtException', (err, origin) => {
fs.writeFileSync("error.txt", err.toString());
})
f = fs.createReadStream("blah");
f.on('data', (c) ...
0
votes
1
answer
152
views
Javascript Private Property Performance on V8
I have created some tests on jsperf.app and the results are not in line with the charts in this V8 blog post: https://v8.dev/blog/faster-class-features
According to the "interpreted" chart ...
0
votes
0
answers
80
views
use nodejs v8 isolate in another native thread
I needed to execute some Javascript code in another thread with the same isolate.
So I created another global-context with v8-isolate in Nodejs, and api: SetSecurityToken was also called. Then I use ...
0
votes
1
answer
28
views
Why the onevent properties are being treated as closure in memory snapshot?
When I take a memory snapshot after triggering the largeClosures() and stopAndClear() click event handler. I can see the (closure) row contains these event handlers.
These event handlers are bound to ...
0
votes
1
answer
41
views
js (v8) rest params and gc
does rest params allocate array
function foo(a, b, ...rest) {
/*...*/
}
in example above its obvoius that array created, but what about this case
function foo(...rest) {
/*...*/
}
there rest ...
0
votes
1
answer
55
views
If memory fragmentation is no longer an issue with 64-bit virtual address space, why does garbage collector in some languages need to compact?
From what I got here:
Why is memory fragmentation an issue on a 64-bit machine?
Heap fragmentation in 64 bit land
Memory fragmentation seems no longer an issue in 64-bit virtual address space, so ...
-1
votes
2
answers
294
views
Why android phone doesn't have built in javascript engine in order to run javascript code for react-native?
As I was reading few blogs on how react native works under the hood, I found out that ios devices have built in javascript engine called javascript core which is used in safari browser. But android ...
0
votes
0
answers
168
views
How can I queue functions in Appscript?
I have an AppScript WebApp that is used by several users simultaneously. The web app runs functions that all edit the same sheet, but I do not want the script to attempt to run all functions called by ...
0
votes
0
answers
111
views
How do I run an npm library in rust?
I want to run this npm library fabric.js server side but I'm thinking of writing my backend in rust, is there a way to use v8 or something like that so that I can use that library and all it's ...
2
votes
2
answers
149
views
Is there a limit for V8's "large object space"?
In Node, I see there are options for configuring space for the "Young generation" and "Old generation" sections of memory, i.e. --max-semi-space-size and --max-old-space-size, but ...
0
votes
1
answer
134
views
Javascript V8 Torque Engine Loading Binary Data Improperly
We load font files using opentype.js and have found a bug either in our code, the V8 engine, or Chromium that returns the result of DataView.getInt16() as 65536 lower or higher than it should be. This ...
0
votes
0
answers
62
views
DataView.getInt16 returning values less than -32768 [duplicate]
I've been parsing binary font files for years without issues and am just now getting strange result from code like this.
const value = dataView.getInt16(offset, false);
Which either returns correctly ...
-1
votes
1
answer
51
views
why d8 not runs from console path?
When running d8 from the console path, it works fine. But adding this path to .bashrc as export PATH="$HOME/pathtod8/":$PATH causes it to fail.
Failed to open startup resource 'snapshot_blob....
1
vote
0
answers
82
views
Cannot Build v8go v0.9.0 in Docker
The author of the popular v8go library is not responsive and this issue is very pressing for me.
It looks like the version of GCC that ships with the official Golang Dcoker containers is too old to ...