therubyracer 0.10.2 → 0.11.0beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of therubyracer might be problematic. Click here for more details.
- data/.gitignore +21 -11
- data/.travis.yml +2 -1
- data/Changelog.md +46 -0
- data/Gemfile +16 -1
- data/README.md +31 -13
- data/Rakefile +42 -23
- data/benchmarks.rb +217 -0
- data/ext/v8/accessor.cc +181 -0
- data/ext/v8/array.cc +26 -0
- data/ext/v8/backref.cc +56 -0
- data/ext/v8/build.rb +51 -0
- data/ext/v8/constants.cc +34 -0
- data/ext/v8/constraints.cc +52 -0
- data/ext/v8/context.cc +130 -0
- data/ext/v8/date.cc +18 -0
- data/ext/v8/exception.cc +38 -0
- data/ext/v8/extconf.rb +14 -18
- data/ext/v8/external.cc +43 -0
- data/ext/v8/function.cc +58 -0
- data/ext/v8/gc.cc +43 -0
- data/ext/v8/handles.cc +34 -0
- data/ext/v8/heap.cc +31 -0
- data/ext/v8/init.cc +39 -0
- data/ext/v8/invocation.cc +86 -0
- data/ext/v8/locker.cc +77 -0
- data/ext/v8/message.cc +51 -0
- data/ext/v8/object.cc +334 -0
- data/ext/v8/primitive.cc +8 -0
- data/ext/v8/rr.cc +83 -0
- data/ext/v8/rr.h +878 -36
- data/ext/v8/script.cc +80 -0
- data/ext/v8/signature.cc +18 -0
- data/ext/v8/stack.cc +75 -0
- data/ext/v8/string.cc +47 -0
- data/ext/v8/template.cc +175 -0
- data/ext/v8/trycatch.cc +86 -0
- data/ext/v8/v8.cc +87 -0
- data/ext/v8/value.cc +239 -0
- data/lib/v8.rb +30 -22
- data/lib/v8/access.rb +5 -87
- data/lib/v8/access/indices.rb +40 -0
- data/lib/v8/access/invocation.rb +47 -0
- data/lib/v8/access/names.rb +65 -0
- data/lib/v8/array.rb +19 -10
- data/lib/v8/context.rb +85 -78
- data/lib/v8/conversion.rb +35 -0
- data/lib/v8/conversion/array.rb +11 -0
- data/lib/v8/conversion/class.rb +120 -0
- data/lib/v8/conversion/code.rb +38 -0
- data/lib/v8/conversion/fundamental.rb +11 -0
- data/lib/v8/conversion/hash.rb +11 -0
- data/lib/v8/conversion/indentity.rb +31 -0
- data/lib/v8/conversion/method.rb +26 -0
- data/lib/v8/conversion/object.rb +28 -0
- data/lib/v8/conversion/primitive.rb +7 -0
- data/lib/v8/conversion/proc.rb +5 -0
- data/lib/v8/conversion/reference.rb +16 -0
- data/lib/v8/conversion/string.rb +12 -0
- data/lib/v8/conversion/symbol.rb +7 -0
- data/lib/v8/conversion/time.rb +13 -0
- data/lib/v8/error.rb +18 -123
- data/lib/v8/error/protect.rb +20 -0
- data/lib/v8/error/try.rb +15 -0
- data/lib/v8/function.rb +18 -34
- data/lib/v8/object.rb +48 -52
- data/lib/v8/util/weakcell.rb +29 -0
- data/lib/v8/version.rb +2 -2
- data/spec/c/array_spec.rb +17 -0
- data/spec/c/constants_spec.rb +20 -0
- data/spec/c/exception_spec.rb +26 -0
- data/spec/c/external_spec.rb +9 -0
- data/spec/c/function_spec.rb +46 -0
- data/spec/c/handles_spec.rb +35 -0
- data/spec/c/locker_spec.rb +38 -0
- data/spec/c/object_spec.rb +46 -0
- data/spec/c/script_spec.rb +28 -0
- data/spec/c/string_spec.rb +16 -0
- data/spec/c/template_spec.rb +30 -0
- data/spec/c/trycatch_spec.rb +51 -0
- data/spec/mem/blunt_spec.rb +42 -0
- data/spec/redjs_spec.rb +10 -0
- data/spec/spec_helper.rb +40 -4
- data/spec/threading_spec.rb +52 -0
- data/spec/v8/context_spec.rb +19 -0
- data/spec/v8/conversion_spec.rb +9 -0
- data/spec/v8/error_spec.rb +15 -125
- data/spec/v8/function_spec.rb +9 -0
- data/therubyracer.gemspec +15 -24
- metadata +102 -135
- data/.gitmodules +0 -3
- data/.rspec +0 -1
- data/.yardopts +0 -1
- data/bin/therubyracer +0 -11
- data/ext/v8/rr.cpp +0 -189
- data/ext/v8/v8.cpp +0 -48
- data/ext/v8/v8_array.cpp +0 -48
- data/ext/v8/v8_array.h +0 -8
- data/ext/v8/v8_callbacks.cpp +0 -81
- data/ext/v8/v8_callbacks.h +0 -8
- data/ext/v8/v8_context.cpp +0 -92
- data/ext/v8/v8_context.h +0 -6
- data/ext/v8/v8_date.cpp +0 -34
- data/ext/v8/v8_date.h +0 -6
- data/ext/v8/v8_debug.cpp +0 -17
- data/ext/v8/v8_debug.h +0 -6
- data/ext/v8/v8_exception.cpp +0 -133
- data/ext/v8/v8_exception.h +0 -11
- data/ext/v8/v8_external.cpp +0 -70
- data/ext/v8/v8_external.h +0 -8
- data/ext/v8/v8_function.cpp +0 -69
- data/ext/v8/v8_function.h +0 -11
- data/ext/v8/v8_handle.cpp +0 -186
- data/ext/v8/v8_handle.h +0 -48
- data/ext/v8/v8_locker.cpp +0 -139
- data/ext/v8/v8_locker.h +0 -6
- data/ext/v8/v8_message.cpp +0 -67
- data/ext/v8/v8_message.h +0 -10
- data/ext/v8/v8_object.cpp +0 -122
- data/ext/v8/v8_object.h +0 -10
- data/ext/v8/v8_script.cpp +0 -36
- data/ext/v8/v8_script.h +0 -8
- data/ext/v8/v8_string.cpp +0 -52
- data/ext/v8/v8_string.h +0 -9
- data/ext/v8/v8_template.cpp +0 -344
- data/ext/v8/v8_template.h +0 -8
- data/ext/v8/v8_try_catch.cpp +0 -70
- data/ext/v8/v8_try_catch.h +0 -5
- data/ext/v8/v8_v8.cpp +0 -35
- data/ext/v8/v8_v8.h +0 -6
- data/ext/v8/v8_value.cpp +0 -175
- data/ext/v8/v8_value.h +0 -10
- data/ext/v8/v8_weakref.cpp +0 -61
- data/ext/v8/v8_weakref.h +0 -29
- data/lib/v8/c/locker.rb +0 -18
- data/lib/v8/cli.rb +0 -133
- data/lib/v8/portal.rb +0 -86
- data/lib/v8/portal/caller.rb +0 -37
- data/lib/v8/portal/constructor.rb +0 -98
- data/lib/v8/portal/function.rb +0 -63
- data/lib/v8/portal/interceptors.rb +0 -152
- data/lib/v8/portal/proxies.rb +0 -151
- data/lib/v8/portal/templates.rb +0 -73
- data/lib/v8/stack.rb +0 -66
- data/lib/v8/tap.rb +0 -9
- data/spec/ext/array_spec.rb +0 -15
- data/spec/ext/cxt_spec.rb +0 -57
- data/spec/ext/ext_spec_helper.rb +0 -27
- data/spec/ext/func_spec.rb +0 -64
- data/spec/ext/object_spec.rb +0 -10
- data/spec/ext/string_spec.rb +0 -11
- data/spec/ext/try_catch_spec.rb +0 -60
- data/spec/redjs_helper.rb +0 -3
- data/spec/v8/portal/proxies_spec.rb +0 -106
- data/specmem/handle_memspec.rb +0 -41
- data/specmem/object_memspec.rb +0 -14
- data/specmem/proxies_memspec.rb +0 -49
- data/specmem/spec_helper.rb +0 -24
- data/specthread/spec_helper.rb +0 -2
- data/specthread/threading_spec.rb +0 -13
data/specmem/handle_memspec.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe V8::C::Handle do
|
5
|
-
include V8::MemSpec
|
6
|
-
context "A JavaScript Object reflected into Ruby" do
|
7
|
-
|
8
|
-
before do
|
9
|
-
@weakref_callback = WeakrefCallback.new
|
10
|
-
end
|
11
|
-
|
12
|
-
it "has a strong reference from the ruby side, which is not released until the Ruby reference goes away" do
|
13
|
-
handle = c::Handle::New(object = c::Object::New())
|
14
|
-
handle.MakeWeak(nil, @weakref_callback)
|
15
|
-
ruby_gc do
|
16
|
-
v8_gc
|
17
|
-
@weakref_callback.should_not have_been_invoked
|
18
|
-
handle.should_not be_dead
|
19
|
-
end
|
20
|
-
ruby_gc do
|
21
|
-
object = nil
|
22
|
-
v8_gc
|
23
|
-
@weakref_callback.should have_been_invoked
|
24
|
-
handle.should be_dead
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
class WeakrefCallback
|
31
|
-
|
32
|
-
def call(value, parameters)
|
33
|
-
@invoked = true
|
34
|
-
end
|
35
|
-
|
36
|
-
def has_been_invoked?
|
37
|
-
@invoked
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
data/specmem/object_memspec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe V8::C::Object do
|
5
|
-
include V8::MemSpec
|
6
|
-
it "will return a new peer and not barf if the old peer has been garbage collected" do
|
7
|
-
v8_eval('var o = {foo: "bar"}')
|
8
|
-
old_id = v8_eval('o').object_id
|
9
|
-
ruby_gc do
|
10
|
-
v8_eval('o').Get(c::String::New("foo")).Utf8Value().should == "bar"
|
11
|
-
v8_eval('o').object_id.should_not be(old_id)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/specmem/proxies_memspec.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe V8::Portal::Proxies do
|
4
|
-
include V8::MemSpec
|
5
|
-
|
6
|
-
context "A Ruby object embedded into JavaScript" do
|
7
|
-
it "holds a hard reference to any ruby object which is linked to a javascript proxy" do
|
8
|
-
subject.register_javascript_proxy c::Object::New(), :for => Object.new
|
9
|
-
ruby_gc do
|
10
|
-
subject.should_not be_empty
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
it "releases the hard reference if its corresponding javascript object has been garbage collected" do
|
15
|
-
ruby_gc do
|
16
|
-
rb_object = Object.new
|
17
|
-
js_proxy = c::Object::New()
|
18
|
-
subject.should be_empty
|
19
|
-
subject.register_javascript_proxy js_proxy, :for => rb_object
|
20
|
-
rb_object = nil
|
21
|
-
subject.should_not be_empty
|
22
|
-
v8_gc()
|
23
|
-
end
|
24
|
-
subject.should be_empty
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context "A JavaScript object embedded into Ruby" do
|
29
|
-
it "holds a hard reference to any JavaScript object which is linked to a Ruby proxy" do
|
30
|
-
proxy = Object.new
|
31
|
-
subject.register_ruby_proxy proxy, :for => c::Object::New()
|
32
|
-
ruby_gc do
|
33
|
-
subject.should_not be_empty
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
it "clears any strong references to the JavaScript object when it's Ruby proxy is garbage collected" do
|
38
|
-
subject.register_ruby_proxy Object.new, :for => c::Object::New()
|
39
|
-
subject.should_not be_empty
|
40
|
-
ruby_gc do
|
41
|
-
v8_gc
|
42
|
-
GC.start
|
43
|
-
v8_gc
|
44
|
-
end
|
45
|
-
subject.should be_empty
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
data/specmem/spec_helper.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require Pathname(__FILE__).dirname.join('../spec/spec_helper')
|
2
|
-
|
3
|
-
module V8::MemSpec
|
4
|
-
|
5
|
-
def self.included(cls)
|
6
|
-
cls.class_eval do
|
7
|
-
include V8::ExtSpec
|
8
|
-
before(:all) {V8::C::V8::SetFlagsFromString("--expose-gc")}
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def ruby_gc
|
13
|
-
current = GC.stress
|
14
|
-
GC.stress = true
|
15
|
-
yield
|
16
|
-
ensure
|
17
|
-
GC.stress = current
|
18
|
-
end
|
19
|
-
|
20
|
-
def v8_gc
|
21
|
-
while !c::V8::IdleNotification();end
|
22
|
-
v8_eval('gc()', 'gc.js')
|
23
|
-
end
|
24
|
-
end
|
data/specthread/spec_helper.rb
DELETED