mini_racer 0.17.0.pre5 → 0.17.0.pre7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd92c74de497ca8b317cb32e02345d204081c50ef44c11a61b0cfef3e32e2cff
4
- data.tar.gz: b2074ffd330b91006c28e0d6b9a4b346a9a0e6d9de30cffd83bb426189262c4d
3
+ metadata.gz: 1d058a397309a0e5354576fa25b299f26e9ca9576b23333063dbcd46fcf9f775
4
+ data.tar.gz: 3dde7c0c2e713ebb419593eb6fb0d7634f07ee4d91e35549aa9fb57987a255e5
5
5
  SHA512:
6
- metadata.gz: 36dd26be30d9e22f5c227f8864a03e6f55224b9265799d604bf933b7458ead17960fef48de19a8d33f6c3c1578f83740c9c8c704541beb7964f6de23f4ec1fb9
7
- data.tar.gz: 89067b89d2dbd6cf7b2af79991f30e53c6df8cc7d08e35623f730eb7010c287ccb98a29444375a7593f4494e11ad25b2c74a3d0b73ce104f7fc64edf22fb9e7e
6
+ metadata.gz: 8cf3e4c85acafb8161ff8a88d193b7bfde7e2b1ab241366364306a72416f462cbd31b4886a3b1f01402557a6045fd6ad40b1837849f307df9d3ac3fafdd7c6d0
7
+ data.tar.gz: a08db269e750b147daa7501cdf38dccdee8de7d07530b0112aecd1da3949b8daab704c778f1b3657d0dea328b087db9173f30e9aeb43f9d755d4a95dd1e51bac
data/CHANGELOG CHANGED
@@ -1,3 +1,12 @@
1
+ - 0.17.0.pre7 - 10-01-2025
2
+
3
+ - Objects containing non serializable properties will return an Error object vs raising an exception. Ben Noordhuis
4
+ - Truffle support was added back Eregon
5
+
6
+ - 0.17.0.pre6 - 08-01-2025
7
+
8
+ - Moved all mini_racer interaction with v8 to a dedicated native thread to avoid cross VM stack contamination. Ben Noordhuis
9
+
1
10
  - 0.17.0.pre5 - 30-09-2024
2
11
 
3
12
  - Handle segfault from JSON.stringify
data/README.md CHANGED
@@ -206,58 +206,27 @@ context.eval("counter")
206
206
  # => 1
207
207
  ```
208
208
 
209
- ### Shared isolates
209
+ ### Garbage collection
210
210
 
211
- By default, MiniRacer's contexts each have their own isolate (V8 runtime). For efficiency, it is possible to re-use an isolate across contexts:
211
+ Re-using the same context over and over again means V8's garbage collector will have to run to clean it up every now and then; it's possible to trigger a _blocking_ V8 GC run inside your context by running the `idle_notification` method on it, which takes a single argument: the amount of time (in milliseconds) that V8 should use at most for garbage collecting:
212
212
 
213
213
  ```ruby
214
- isolate = MiniRacer::Isolate.new
215
-
216
- context1 = MiniRacer::Context.new(isolate: isolate)
217
- context2 = MiniRacer::Context.new(isolate: isolate)
218
-
219
- context1.isolate == context2.isolate
220
- # => true
221
- ```
222
-
223
- The main benefit of this is avoiding creating/destroying isolates when not needed (for example if you use a lot of contexts).
224
-
225
- The caveat with this is that a given isolate can only execute one context at a time, so don't share isolates across contexts that you want to run concurrently.
226
-
227
- Also, note that if you want to use shared isolates together with snapshots, you need to first create an isolate with that snapshot, and then create contexts from that isolate:
228
-
229
- ```ruby
230
- snapshot = MiniRacer::Snapshot.new("function hello() { return 'world!'; }")
231
-
232
- isolate = MiniRacer::Isolate.new(snapshot)
233
-
234
- context = MiniRacer::Context.new(isolate: isolate)
235
-
236
- context.eval("hello()")
237
- # => "world!"
238
- ```
239
-
240
- Re-using the same isolate over and over again means V8's garbage collector will have to run to clean it up every now and then; it's possible to trigger a _blocking_ V8 GC run inside your isolate by running the `idle_notification` method on it, which takes a single argument: the amount of time (in milliseconds) that V8 should use at most for garbage collecting:
241
-
242
- ```ruby
243
- isolate = MiniRacer::Isolate.new
244
-
245
- context = MiniRacer::Context.new(isolate: isolate)
214
+ context = MiniRacer::Context.new
246
215
 
247
216
  # do stuff with that context...
248
217
 
249
218
  # give up to 100ms for V8 garbage collection
250
- isolate.idle_notification(100)
219
+ context.idle_notification(100)
251
220
 
252
221
  # force V8 to perform a full GC
253
- isolate.low_memory_notification
222
+ context.low_memory_notification
254
223
  ```
255
224
 
256
225
  This can come in handy to force V8 GC runs for example in between requests if you use MiniRacer on a web application.
257
226
 
258
227
  Note that this method maps directly to [`v8::Isolate::IdleNotification`](http://bespin.cz/~ondras/html/classv8_1_1Isolate.html#aea16cbb2e351de9a3ae7be2b7cb48297), and that in particular its return value is the same (true if there is no further garbage to collect, false otherwise) and the same caveats apply, in particular that `there is no guarantee that the [call will return] within the time limit.`
259
228
 
260
- Additionally you may automate this process on a context by defining it with `MiniRacer::Content.new(ensure_gc_after_idle: 1000)`. Using this will ensure V8 will run a full GC using `context.isolate.low_memory_notification` 1 second after the last eval on the context. Low memory notification is both slower and more aggressive than an idle_notification and will ensure long living isolates use minimal amounts of memory.
229
+ Additionally you may automate this process on a context by defining it with `MiniRacer::Context.new(ensure_gc_after_idle: 1000)`. Using this will ensure V8 will run a full GC using `context.low_memory_notification` 1 second after the last eval on the context. Low memory notification is both slower and more aggressive than an idle_notification and will ensure long living contexts use minimal amounts of memory.
261
230
 
262
231
  ### V8 Runtime flags
263
232
 
@@ -301,7 +270,7 @@ Please refer to http://node.green/ as a reference on other harmony features.
301
270
 
302
271
  A list of all V8 runtime flags can be found using `node --v8-options`, or else by perusing [the V8 source code for flags (make sure to use the right version of V8)](https://github.com/v8/v8/blob/master/src/flags/flag-definitions.h).
303
272
 
304
- Note that runtime flags must be set before any other operation (e.g. creating a context, a snapshot or an isolate), otherwise an exception will be thrown.
273
+ Note that runtime flags must be set before any other operation (e.g. creating a context or a snapshot), otherwise an exception will be thrown.
305
274
 
306
275
  Flags:
307
276
 
@@ -1,5 +1,7 @@
1
1
  require 'mkmf'
2
2
 
3
+ $srcs = ["mini_racer_extension.c", "mini_racer_v8.cc"]
4
+
3
5
  if RUBY_ENGINE == "truffleruby"
4
6
  File.write("Makefile", dummy_makefile($srcdir).join(""))
5
7
  return