Class: MiniRacer::Isolate

Inherits:
Object
  • Object
show all
Defined in:
lib/mini_racer.rb,
lib/mini_racer/truffleruby.rb

Instance Method Summary collapse

Constructor Details

#initialize(snapshot = nil) ⇒ Isolate

Returns a new instance of Isolate.



75
76
77
78
79
80
81
82
# File 'lib/mini_racer.rb', line 75

def initialize(snapshot = nil)
  unless snapshot.nil? || snapshot.is_a?(Snapshot)
    raise ArgumentError, "snapshot must be a Snapshot object, passed a #{snapshot.inspect}"
  end

  # defined in the C class
  init_with_snapshot(snapshot)
end

Instance Method Details

#idle_notification(idle_time) ⇒ Object



328
329
330
# File 'lib/mini_racer/truffleruby.rb', line 328

def idle_notification(idle_time)
  true
end

#init_with_snapshot(snapshot) ⇒ Object



318
319
320
321
322
# File 'lib/mini_racer/truffleruby.rb', line 318

def init_with_snapshot(snapshot)
  # TruffleRuby does not have a 1-1 concept with isolate.
  # However, isolate can hold a snapshot, and code and ASTs are shared between contexts.
  @snapshot = snapshot
end

#low_memory_notificationObject



324
325
326
# File 'lib/mini_racer/truffleruby.rb', line 324

def low_memory_notification
  GC.start
end