174 questions
1
vote
1
answer
95
views
The mechanism for transforming JavaScript syntactic sugar in V8 using async/await as an example
Is syntactic sugar such as async/await converted before compilation/interpretation?
Attention. I mean the situation when the engine supports the syntax of our code and we do not need to transpile it. ...
0
votes
1
answer
216
views
Where primitives inside objects are actually stored
When i Declare an Object and inside of that object i made a property that holds a primitive value
so in this Example
const foo = {
firstName: 'bar'
}
where the bar actually stored is it points the ...
1
vote
1
answer
57
views
Why is an inline cache for retrieving property from an object invalidated whenever someone changes any prototype above it, not below it?
I'm reading Mathias and Benedikt's article JavaScript engine fundamentals: optimizing prototypes. The article says:
This ValidityCell is invalidated whenever someone changes the associated prototype ...
0
votes
0
answers
83
views
FileSystemNotFoundException in GraalVM Javascript Engine in Springboot Application
I created a springboot project and added GraalVM dependency in pom.xml to execute Javascript Code in my Spingboot Project.
<dependency>
<groupId>org.graalvm.js</...
1
vote
2
answers
137
views
Regex replacement problems
I am trying to write a regex replacment that will do the following but have tried for several hours to no avail.
I have the following regex: (?:\> \[!anki\]-) ([^\n]+)\n(.+(?:\n(?:^.{1,3}$|^.{4}(?&...
1
vote
1
answer
1k
views
Clearing up confusion about V8 and the JavaScript engine
I've been researching the V8 engine and JavaScript engines in general for about 2 hours, and I was wondering if I have the process correct.
First, we have JavaScript code.
With the code as input, the ...
1
vote
2
answers
2k
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 ...
-1
votes
1
answer
162
views
How JavaScript language is been executed under the hood in Google V8 engine
Hello Guys I have a question, so i study computer science at university , we have built a simple language called NewJava , its syntax is similar to Java, we built the interpreter with c++ , we have ...
-2
votes
1
answer
189
views
How can arrow function's access it's parameters value?
Well while studying how JavaScript behind the scenes work I read that arrow functions does not have their own 'this' keyword nor their own parameters.
//MAIN PROBLEM
However, you can access the ...
0
votes
1
answer
70
views
How to disable Javascript debugging in NetBeans when using ScriptEngine?
Development environment is netbeans, java application, which runs javascript thru ScriptEngine in GraalVM.
When using debug mode, it automatically force a debug session with Chrome when scriptengine ...
0
votes
0
answers
1k
views
ScriptEngineManager() from javax library returns NULL (eclipse)
When my piece of code below runs on Eclipse on both on Mac and Win8 (both are with Open JDK-17.0.2) below I get the java.lang.NullPointerException: Cannot invoke "javax.script.ScriptEngine.eval(...
0
votes
0
answers
61
views
How typed array stores numbers in javascript
If I understood correctly, every number in javascript is 64-bit (i64)?
Does that mean that new Uint8Array([num]) uses less memory than just num?
0
votes
2
answers
698
views
What's the relation between the renderer process and a JavaScript engine?
I'm learning about how a browser works and so far I've learned that browsers have a process called the renderer.
Part of the job of this process is to parse and run a JavaScript code when it finds ...
5
votes
1
answer
2k
views
How is JavaScript code transformed into Machine Code? Or why is it not?
I'm trying to understand the process of how a piece of JavaScript code is executed. So far, I've managed to have most of the layout pictured out, but there's a few gaps that I wish to cover.
I know ...
0
votes
1
answer
270
views
Does complexity depend on the size of numbers in JS engine?
Does it matter how big numbers to calculate in JavaScript Engine, especially V8 in NodeJS?
The applicable example: I'm calculating in loops time date variables in milliseconds and have some time ...
3
votes
1
answer
416
views
Need Clarification on Execution Context
function a(){
b();
var c;
}
function b(){
var d;
}
a();
var d;
I would like clarification on the Execution Context for the code above. From what I understand, during the creation phase ...
1
vote
0
answers
716
views
How to introduce react context to plain JS
React context solves the problem of injecting dependencies without having to prop drill down the entire tree of components. The problem is not unique to react or components though, on the server you ...
0
votes
0
answers
574
views
The javascript engine of htmlunit can't load the generated page with these settings
I am trying to get content of script-generated web page but unfortunately HtmlUnit doesn't seem to work properly. I think the problem is with the class trying to wrap the script.
Snippet of code:
...
0
votes
1
answer
454
views
Unity + ClearScript - Importing DLL
I'm trying to use ClearScript in Unity, but fail because Unity does not see the DLL.
To be sure, I cloned the project and had the DLLs built. I did this using the instructions from ClearScript.
The ...
12
votes
1
answer
15k
views
Time complexity of Javascript Array.find() in modern browsers
Since array.find() iterates over an array, if I handle (potentially) large arrays, I always make sure to have an indexed object like so:
{ [id:string]: Item }
if I need to look up items by id in ...
0
votes
1
answer
181
views
Execution of Regular function and Arrow function
I am trying to build this 2d-breakout game https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript I tried to replace some function with arrow function.
document....
0
votes
0
answers
247
views
JavaScript: What is the data structure for the call stack?
I'm writing an article about JS concurrency model and event loop. I've read many (even internally) conflicting articles regarding the data structures of the call stack and Execution Contexts.
A ...
0
votes
1
answer
1k
views
Chrome versus Edge Javascript differences
From time to time i get Javascript Files (created by use of Adobe Animate) that crashes in either chrome or edge. In some cases these files crash only in chrome, in some cases they crash only in edge. ...
4
votes
3
answers
313
views
Why are function expressions not included in the variable object of the Execution Context?
While going through the Execution Context part of the JavaScript.The Core. (1st ed.) by Dmitry Soshnikov, I came across this line that explicitly says that function expressions are not included in the ...
0
votes
1
answer
30
views
What is `delete(<anything>)`?
When I use delete keyword as a function it returns boolean and if I pass anything it doesn't throw error
const foo = 0
delete(foo) // false
const bar = 1
delete(bar) // false
delete(unknown) // true
...
3
votes
1
answer
1k
views
Measuring the Performance with the Hermes Engine
I am trying to profiling in React Native and using hermes engine. I want measure the time in between a function call.
In Js We can use console.time or performace.now but when I am using those ...
2
votes
0
answers
90
views
What's the performance penalty in calling Object.setProtoytypeOf() in the following code?
I have been hearing quite a lot that Object.setPrototypeOf() in JavaScript is not a good thing to do. It reduces optimizations and lowers down the performance of an application.
Specifically, it ...
1
vote
1
answer
3k
views
Does JavaScript code converted to assembly code?
I read article about how JavaScript Engine works, but there is thing that confusing me, it says the following:
JavaScript code first parsed
The source code translated to bytecode
The bytecode gets ...
2
votes
1
answer
1k
views
why this type of error comes in DevTools failed to load SourceMap
DevTools failed to load SourceMap: Could not load content for http://127.0.0.1:8000/css/bootstrap.min.css.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILUREenter image description ...
1
vote
1
answer
294
views
Macrotasks and microtasks exercise
I have the following question about micro and macro tasks running in Google Chrome. See the next example (The following code was proposed by Jake Archibald):
// Let's get hold of those elements
var ...
0
votes
0
answers
23
views
JavaScript var scoping in strict mode [duplicate]
So since ES6 all functions are block scoped in strict mode, but "var" ignores block scope, then why code below gives a reference error?
'use strict'
function asd() {
var ssss = 5;
}
...
0
votes
0
answers
253
views
Are functions kept only once in memory in JavaScript?
Before asking my question let me give you some information. See this piece of code
"use strict"
function outer() {
let counter = 0;
function incrementCounter() {
...
0
votes
1
answer
102
views
Is a browser's console an interface to the web API?
From my research, the browser gives us some features that the JavaScript engine itself doesn’t provide: a Web API. This includes the DOM API, setTimeout, HTTP requests, and so on.
So because browsers ...
11
votes
1
answer
13k
views
What JavaScript engine does Apple's Safari browser use?
I found out from the Internet that Google Chrome uses V8 and Firefox uses SpiderMonkey to compile JavaScript to machine code. What JavaScript engine does Safari browser use then?
26
votes
9
answers
24k
views
How to fix the Android AdMob "Unable to obtain a JavascriptEngine" error?
MainActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
MobileAds.initialize(this) {}
MobileAds.setRequestConfiguration(
...
8
votes
1
answer
4k
views
Why does V8 uses pointer tagging and not NaN boxing?
I'm learning V8 internals now. I learned that V8 uses pointer tagging for value storing, but wondered why it is not use NaN boxing.
AFAIK, NaN boxing is better because it can also store doubles and ...
1
vote
1
answer
338
views
How do I register a Python DOM object with a javascript engine on initialization?
Context:
I'm creating a python application called itbrowz. The ultimate desired outcome of this application is to be a passable modern web browser that can be used directly in iTerm2. For that to ...
0
votes
1
answer
52
views
Do Javascript engines do this kind of optimisation?
NB I've done a bit of reading about JS engine optimisation, but most of it is too technical for me to understand enough to apply to this question. I'm also aware that not all engines are the same. I'd ...
0
votes
0
answers
19
views
object caching in modern JavaScript? [duplicate]
I'm preparing to take a JavaScript test, and came upon this post:
http://www.javascriptkit.com/javatutors/efficientjs.shtml
The gist is that this:
<script type="text/javascript">
for (var i=0;...
0
votes
0
answers
96
views
Why application thread (main thread) is stopped, while javascript garbage collection algorithm is running?
I am asking in the context of Google V8 Engine and it's Mark and Sweep algorithm.
As v8 engine has some gc threads, that can do garbage collection concurrently with main thread operations.
17
votes
2
answers
19k
views
Nashorn alternative for Java 11 [closed]
I am using the Nashorn JavaScript Engine in Java 11 which works fine except it will be deprecated soon. I have tried GraalVM which I find quite worse as it takes 13-14 seconds to execute a simple ...
-3
votes
1
answer
236
views
In which order these code statements are moved to call stack?
I am new to Javascript and trying to understand the execution engine of JS. I know that any async code statement moves to the call-stack and then gets immediately removed and executed in a separate ...
1
vote
0
answers
140
views
Which declare variable on JavaScript? Engine or Compiler?
When I read YDKJS(You Dont Know JS) book in there getify says "First, Compiler declares a variable (if not previously declared in the current scope)" - but I don't understand how compiler declare a ...
1
vote
2
answers
1k
views
JavaScript - Object definition available before code execution on Safari
Objects and functions which I require only to execute once on a page load are wrapped inside an undefined check for the object. On Chrome on Windows/Linux which I usually use, the code works perfectly ...
1
vote
1
answer
229
views
ECMA Support in Rhino Engine
I know that Google's V8 engine supports upto the latest ECMAScript.But what is the latest ECMAScript that is supported by Rhino Engine?
1
vote
0
answers
403
views
ChakraCore.NET JavaScript engine: How to expose C# objects(including properties and variables) to javascript
I am able to access object methods by following samples provided in https://github.com/JohnMasen/ChakraCore.NET but couldn't find a way to bind variables in the object. Is there a way to bind ...
1
vote
0
answers
57
views
Console of the chrome is Javascript Engine?
Console in Google Chrome is a example of Javascript Engine? If not, please tell me what is the most popular example of Javascript Engine. This is not my homework, i'm kinda confused. Thanks a lot.
1
vote
0
answers
365
views
Evaluate boolean expressions from arrayList
I generate a truth table from any boolean expression and store it into a 2D array. As a first step, I store my boolean expression in an object arrayList. I count noumbers of variables to deduct ...
0
votes
1
answer
901
views
General server-side use of V8: Isolates
Google's open sourced V8 engine is mature, performant JIT compiler.
Implemented primarily in C++, acting as JS centric execution runtime.
It has an isolation implementation (V8: Isolates), ...
-2
votes
1
answer
197
views
JavaScript Algorithms and JavaScript Engines
Is algorithms for JavaScript functions on different JavaScript engine varies?
I run Array.sort() in Chrome and Firefox browser, and two of them perform differently for the same code.
Are they used ...