Sha256: 99ae9fa0bac752c486fc511d25fb778a597995a2081243ec600edc7b7403b4e3

Contents?: true

Size: 950 Bytes

Versions: 37

Compression:

Stored size: 950 Bytes

Contents

#include "rr.h"

namespace rr {
  GC::Queue* queue;

  GC::Queue::Queue() : first(0), divider(0), last(0){
    first = new GC::Queue::Node(NULL);
    divider = first;
    last = first;
  }

  void GC::Queue::Enqueue(void* reference) {
    last->next = new Node(reference);
    last = last->next;
    while (first != divider) {
      Node* tmp = first;
      first = first->next;
      delete tmp;
    }
  }

  void* GC::Queue::Dequeue() {
    void* result = NULL;
    if (divider != last) {
      result = divider->next->value;
      divider = divider->next;
    }
    return result;
  }

  void GC::Finalize(void* phantom) {
    queue->Enqueue(phantom);
  }
  void GC::Drain(v8::GCType type, v8::GCCallbackFlags flags) {
    for(Phantom phantom = queue->Dequeue(); phantom.NotNull(); phantom = queue->Dequeue()) {
      phantom.destroy();
    }
  }
  void GC::Init() {
    queue = new GC::Queue();
    v8::V8::AddGCPrologueCallback(GC::Drain);
  }
}

Version data entries

37 entries across 37 versions & 8 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/therubyracer-0.12.2/ext/v8/gc.cc
therubyracer-0.12.3 ext/v8/gc.cc
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.11.4/ext/v8/gc.cc
therubyracer-xcode-0.12.3 ext/v8/gc.cc
therubyracer-xcode-0.12.2 ext/v8/gc.cc
therubyracer-tmpfork-0.12.2 ext/v8/gc.cc
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/therubyracer-0.12.2/ext/v8/gc.cc
therubyracer-0.12.2 ext/v8/gc.cc
therubyracer-0.12.1 ext/v8/gc.cc
therubyracer-discourse-0.12.0 ext/v8/gc.cc
therubyracer-0.12.0 ext/v8/gc.cc
therubyracer-0.11.4 ext/v8/gc.cc
therubyracer-0.11.3 ext/v8/gc.cc
therubyracer-0.11.2 ext/v8/gc.cc
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/therubyracer-0.11.0/ext/v8/gc.cc
therubyracer-0.11.1 ext/v8/gc.cc
therubyracer-0.11.1beta1 ext/v8/gc.cc
therubyracer-0.11.0 ext/v8/gc.cc
therubyracer-0.11.0beta8-x86-freebsd-9 ext/v8/gc.cc
therubyracer-0.11.0beta8-x86_64-linux ext/v8/gc.cc