h8 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 2ee6c0b2e2d9f2e6ee7c1baba1d2e5d5ff4bb82c
4
- data.tar.gz: 1ce87dddfef9bc287f235c0bb31a69a03d32363c
3
+ metadata.gz: 7384caa28f422353e348519ea0f56f9869f8243f
4
+ data.tar.gz: ef389e8693081cf4c7173bbffd31e2127bcf978e
5
5
  SHA512:
6
- metadata.gz: 511f1e2854ffccb6cb1d42b0ab7789bbd9173c31cf05a7d3fe24aba192d4fb2ad4dba6ba8039fc1b642312d2c138cbb8835bf47c2e36a1b3e736550771c470dd
7
- data.tar.gz: 474499e5c938efd557c39de0383bbbc8d01b9b5a4eefe04fe86b66621b74de2edf6e41a6da96cdb551f083066f0fe355bebd0885d991ae9d6668320b59ec08b6
6
+ metadata.gz: ef76e195a1db60ca07987b46e5060830a73221c7e45daaf8e4fa8b8a8ab7540a25ed1f65740421cddeb19936d3abf8cd24f1a5ea5911292402c1f7b90b366875
7
+ data.tar.gz: 171b71959ebba1159e62c771a8f529d648307667770dbda0c03bfdaa106abb45c293bd5b7781ff9258abf286886d4e300ae20cc09bb875c6001861a033a784bc
data/README.md CHANGED
@@ -38,19 +38,9 @@ uncaught javascript exceptions raise ruby error in ruby code.
38
38
 
39
39
  ## Main difference from therubyracer/features not ready
40
40
 
41
- The pity thing is, if we will Lock() the context on each call to it, the performance degradation
42
- will be notable and no matter whether you need threading with it. So, if you really need it, you
43
- wrap it with Mutex or whatever you want, without slowing down all the rest of us.
44
-
45
- - H8 is thread safe (users Lockers) but script is executed in the calling ruby thread without
46
- releasing gvl (other ruby threads can not perform on this core while javascript code runs).
47
-
48
- The same performance reason. If we release gvl on script start and reacquire it every time the ruby
49
- object, callback, class, whatever is referenced from JS, the execution will considerably degrade. As
50
- this gem is intended to let javascript/coffescript tightly integrate with ruby objects we have
51
- decided to not to slow down everything. If it is a problem, lets discuss it.
52
-
53
- - correct and accurate object tracking in both JS and Ruby VMs, GC aware.
41
+ - H8 is thread safe (uses Lockers) but script is executed in the calling ruby thread without
42
+ releasing gvl (other ruby threads can not perform on this core while javascript code runs). We are
43
+ working on it, as simply releasing GVL and reacquring it may degrade performance.
54
44
 
55
45
  - labmda/proc passed as var to the context **does not receives first (this) argument
56
46
  automatically!**
@@ -76,7 +66,7 @@ when such a lambda needs javascript's this - but, no problem, pass it this, or w
76
66
  you need ;)
77
67
 
78
68
  - there is no 'Context object initialization' - it does not work well in rubyracer so it is not
79
- likely used widely. We can add it later, though.
69
+ likely used widely. We can add it later, though - if you need it, add an issue.
80
70
 
81
71
 
82
72
 
data/ext/h8/h8.cpp CHANGED
@@ -105,8 +105,7 @@ h8::H8::~H8() {
105
105
  // this should also remove it from the list:
106
106
  resources.peek_first<AllocatedResource>()->free();
107
107
  }
108
+ persistent_context.Reset();
108
109
  }
109
-
110
- persistent_context.Reset();
111
110
  isolate->Dispose();
112
111
  }
data/ext/h8/js_gate.h CHANGED
@@ -184,6 +184,11 @@ public:
184
184
  virtual void free() {
185
185
  persistent_value.Reset();
186
186
  AllocatedResource::free();
187
+ h8 = 0;
188
+ }
189
+
190
+ virtual void rb_mark_gc() {
191
+ rb_gc_mark(h8->ruby_context());
187
192
  }
188
193
 
189
194
  virtual Local<Value> value() const {
@@ -195,7 +200,13 @@ public:
195
200
  }
196
201
 
197
202
  virtual ~JsGate() {
198
- persistent_value.Reset();
203
+ if( h8 ) {
204
+ Locker l(h8->getIsolate());
205
+ persistent_value.Reset();
206
+ }
207
+ else {
208
+ persistent_value.Reset();
209
+ }
199
210
  }
200
211
 
201
212
  private:
data/ext/h8/main.cpp CHANGED
@@ -34,7 +34,7 @@ static void rvalue_free(void* ptr) {
34
34
 
35
35
  static void rvalue_mark(void* ptr) {
36
36
  JsGate *gate = (JsGate*) ptr;
37
- rb_gc_mark(gate->ruby_context());
37
+ gate->rb_mark_gc();
38
38
  }
39
39
 
40
40
  VALUE rvalue_alloc(VALUE klass) {
data/lib/h8/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module H8
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: h8
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergeych
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-29 00:00:00.000000000 Z
11
+ date: 2014-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler