Questions tagged [spidermonkey]

SpiderMonkey is Mozilla's JavaScript and WebAssembly Engine. A highly tailored version of which executes JavaScript & WebAssembly in the Firefox web browser.

SpiderMonkey is Mozilla's JavaScript & WebAssembly Engine. A highly tailored and polished-to-fit version of SpiderMonkey executes JavaScript & WebAssembly in the Firefox web browser. SpiderMonkey is also the first JavaScript engine ever made.

This virtual machine (VM) is implemented in C++, Rust and JavaScript and has support for Just-In-Time (JIT) compilation on several major platforms.

Resources


Related tags

318 questions
4
votes
2 answers

JavaScript class memory usage

So I've been doing some JavaScript class-like stuff such as MyClass = function() { var x; this.sayX = function() { alert(x); } } but I've also seen MyClass = function() { this.x = 0; } MyClass.prototype.sayX = function() { …
RandomInsano
  • 1,204
  • 2
  • 16
  • 36
4
votes
1 answer

JSAPI segfault in JS_NewContext

I am writing a simple C++ program that embeds SpiderMonkey. Unfortunately, it segfaults in JS_NewContext(). The program (saved as jsapi_use.cpp): #define __STDC_LIMIT_MACROS #include #include #include…
Demi
  • 3,535
  • 5
  • 29
  • 45
4
votes
2 answers

How to create, handle, and destroy JS::Heap objects in Spidermonkey?

Using Spidermonkey 24, 38, 45 Spidermonkey documentation says: "GC thing pointers on the heap must be wrapped in a JS::Heap. The only exception to this is if they are added as roots with the JS_AddRoot() functions or JS::PersistentRooted class, but…
dmitri
  • 3,183
  • 23
  • 28
4
votes
1 answer

JSON serialization in Spidermonkey

I'm using python-spidermonkey to run JavaScript code. In order to pass objects (instead of just strings) to Python, I'm thinking of returning a JSON string. This seems like a common issue, so I wonder whether there are any facilities for this built…
AnC
  • 4,099
  • 8
  • 43
  • 69
4
votes
4 answers

Is there an engine-agnostic Reflect.parse?

Mozilla have delivered an API for parsing a Javascript module to generate an abstract syntax tree. They call it Reflect.parse. Is there a Reflect.parse, or something similar, written as a standalone module in Javascript? something I could run on…
Cheeso
  • 189,189
  • 101
  • 473
  • 713
3
votes
2 answers

Spidermonkey and Garbage Collection

I am embedding Spidermonkey in my C++ application. I need to implementing some custom Javascript functions in native C++ that pass around a jsval. I need to guard the jsval against accidental garbage collection. Is it proper for me to do this: (1)…
JavaMan
  • 4,954
  • 4
  • 41
  • 69
3
votes
1 answer

what is the aim of JS_CANONICALIZE_NAN in spidermonkey engine?

I wondering what is the aim of JS_CANONICALIZE_NAN and if it is always needed on all platforms ?
Franck Freiburger
  • 26,310
  • 20
  • 70
  • 95
3
votes
1 answer

Garbage collector issues on spidermonkey.... JS_AnchorPtr()?

I've rolled my own javascript server side language called bondi. Just recently upgraded to the new spider monkey. Now that JS enter local roots and leave local roots function is gone/useless from the 1.8.5 api, is it enough to just use anchor…
Jason
  • 15,064
  • 15
  • 65
  • 105
3
votes
1 answer

What is the best independent test suite for benchmarking JavaScript engines?

I'm looking for the best tool for benchmarking the speed of JavaScript interpreters. Preferably this shouldn't be a tool written by a conflicted party such as Mozilla or Google, although I understand that these might give the most accurate…
Jivings
  • 22,834
  • 6
  • 60
  • 101
3
votes
1 answer

What are the tags for firefox releases in mozilla's repository?

I want to recompile the source code of SpiderMonkey. The mercurial repository is accessible from https://hg.mozilla.org/mozilla-central/ , but I am having a hard time to understand what tags are used to keep track of the released versions. The tags…
Ottavio Campana
  • 4,088
  • 5
  • 31
  • 58
3
votes
1 answer

V8's equivalence of SpiderMonkey's catch(e if e..)

Using SpiderMonkey you can utilize conditional catch blocks to route exceptions to the appropriate handler. try { // function could throw three exceptions getCustInfo("Lee", 1234, "lee@netscape.com") } catch (e if e == "InvalidNameException") { //…
Amjad Masad
  • 4,035
  • 1
  • 21
  • 20
3
votes
2 answers

Difference between JavaScript shell and node.js

I have been developing in Node.js for some time now. Today, I came across this article Introduction to the JavaScript shell - Mozilla | MDN It talks about javascript shell and goes onto say that it can execute javascript programs from a file as…
Ashwin K Joseph
  • 371
  • 2
  • 4
  • 14
3
votes
1 answer

ES6 Maps and Sets: how are object keys indexed efficiently?

In ES6, Maps and Sets can use Objects as keys. However since the ES6 specification does not dictate the underlying implementation of these datastructures, I was wondering how does the modern JS engines store the keys in order to guarantee O(1) or at…
luanped
  • 3,178
  • 2
  • 26
  • 40
3
votes
1 answer

Javascript var vs let (de)optimization/slowdown issue in v8 and SpiderMonkey

During JavaScript code refactoring in my project I've found that some of my loops slowed down drastically. Searching for root cause I've found this SO question stating slowdown is caused by let statement inside for loop and closure creation. To my…
Chajnik-U
  • 501
  • 4
  • 8
3
votes
2 answers

Checking for NaNs in asm.js code

How can I efficiently check in asm.js code whether a floating point value is a NaN? A way that works in principle is to import the global isNaN JavaScript function as a foreign function into the asm.js module. As calling foreign function is…
Marc
  • 4,327
  • 4
  • 30
  • 46