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.

Files changed (159) hide show
  1. data/.gitignore +21 -11
  2. data/.travis.yml +2 -1
  3. data/Changelog.md +46 -0
  4. data/Gemfile +16 -1
  5. data/README.md +31 -13
  6. data/Rakefile +42 -23
  7. data/benchmarks.rb +217 -0
  8. data/ext/v8/accessor.cc +181 -0
  9. data/ext/v8/array.cc +26 -0
  10. data/ext/v8/backref.cc +56 -0
  11. data/ext/v8/build.rb +51 -0
  12. data/ext/v8/constants.cc +34 -0
  13. data/ext/v8/constraints.cc +52 -0
  14. data/ext/v8/context.cc +130 -0
  15. data/ext/v8/date.cc +18 -0
  16. data/ext/v8/exception.cc +38 -0
  17. data/ext/v8/extconf.rb +14 -18
  18. data/ext/v8/external.cc +43 -0
  19. data/ext/v8/function.cc +58 -0
  20. data/ext/v8/gc.cc +43 -0
  21. data/ext/v8/handles.cc +34 -0
  22. data/ext/v8/heap.cc +31 -0
  23. data/ext/v8/init.cc +39 -0
  24. data/ext/v8/invocation.cc +86 -0
  25. data/ext/v8/locker.cc +77 -0
  26. data/ext/v8/message.cc +51 -0
  27. data/ext/v8/object.cc +334 -0
  28. data/ext/v8/primitive.cc +8 -0
  29. data/ext/v8/rr.cc +83 -0
  30. data/ext/v8/rr.h +878 -36
  31. data/ext/v8/script.cc +80 -0
  32. data/ext/v8/signature.cc +18 -0
  33. data/ext/v8/stack.cc +75 -0
  34. data/ext/v8/string.cc +47 -0
  35. data/ext/v8/template.cc +175 -0
  36. data/ext/v8/trycatch.cc +86 -0
  37. data/ext/v8/v8.cc +87 -0
  38. data/ext/v8/value.cc +239 -0
  39. data/lib/v8.rb +30 -22
  40. data/lib/v8/access.rb +5 -87
  41. data/lib/v8/access/indices.rb +40 -0
  42. data/lib/v8/access/invocation.rb +47 -0
  43. data/lib/v8/access/names.rb +65 -0
  44. data/lib/v8/array.rb +19 -10
  45. data/lib/v8/context.rb +85 -78
  46. data/lib/v8/conversion.rb +35 -0
  47. data/lib/v8/conversion/array.rb +11 -0
  48. data/lib/v8/conversion/class.rb +120 -0
  49. data/lib/v8/conversion/code.rb +38 -0
  50. data/lib/v8/conversion/fundamental.rb +11 -0
  51. data/lib/v8/conversion/hash.rb +11 -0
  52. data/lib/v8/conversion/indentity.rb +31 -0
  53. data/lib/v8/conversion/method.rb +26 -0
  54. data/lib/v8/conversion/object.rb +28 -0
  55. data/lib/v8/conversion/primitive.rb +7 -0
  56. data/lib/v8/conversion/proc.rb +5 -0
  57. data/lib/v8/conversion/reference.rb +16 -0
  58. data/lib/v8/conversion/string.rb +12 -0
  59. data/lib/v8/conversion/symbol.rb +7 -0
  60. data/lib/v8/conversion/time.rb +13 -0
  61. data/lib/v8/error.rb +18 -123
  62. data/lib/v8/error/protect.rb +20 -0
  63. data/lib/v8/error/try.rb +15 -0
  64. data/lib/v8/function.rb +18 -34
  65. data/lib/v8/object.rb +48 -52
  66. data/lib/v8/util/weakcell.rb +29 -0
  67. data/lib/v8/version.rb +2 -2
  68. data/spec/c/array_spec.rb +17 -0
  69. data/spec/c/constants_spec.rb +20 -0
  70. data/spec/c/exception_spec.rb +26 -0
  71. data/spec/c/external_spec.rb +9 -0
  72. data/spec/c/function_spec.rb +46 -0
  73. data/spec/c/handles_spec.rb +35 -0
  74. data/spec/c/locker_spec.rb +38 -0
  75. data/spec/c/object_spec.rb +46 -0
  76. data/spec/c/script_spec.rb +28 -0
  77. data/spec/c/string_spec.rb +16 -0
  78. data/spec/c/template_spec.rb +30 -0
  79. data/spec/c/trycatch_spec.rb +51 -0
  80. data/spec/mem/blunt_spec.rb +42 -0
  81. data/spec/redjs_spec.rb +10 -0
  82. data/spec/spec_helper.rb +40 -4
  83. data/spec/threading_spec.rb +52 -0
  84. data/spec/v8/context_spec.rb +19 -0
  85. data/spec/v8/conversion_spec.rb +9 -0
  86. data/spec/v8/error_spec.rb +15 -125
  87. data/spec/v8/function_spec.rb +9 -0
  88. data/therubyracer.gemspec +15 -24
  89. metadata +102 -135
  90. data/.gitmodules +0 -3
  91. data/.rspec +0 -1
  92. data/.yardopts +0 -1
  93. data/bin/therubyracer +0 -11
  94. data/ext/v8/rr.cpp +0 -189
  95. data/ext/v8/v8.cpp +0 -48
  96. data/ext/v8/v8_array.cpp +0 -48
  97. data/ext/v8/v8_array.h +0 -8
  98. data/ext/v8/v8_callbacks.cpp +0 -81
  99. data/ext/v8/v8_callbacks.h +0 -8
  100. data/ext/v8/v8_context.cpp +0 -92
  101. data/ext/v8/v8_context.h +0 -6
  102. data/ext/v8/v8_date.cpp +0 -34
  103. data/ext/v8/v8_date.h +0 -6
  104. data/ext/v8/v8_debug.cpp +0 -17
  105. data/ext/v8/v8_debug.h +0 -6
  106. data/ext/v8/v8_exception.cpp +0 -133
  107. data/ext/v8/v8_exception.h +0 -11
  108. data/ext/v8/v8_external.cpp +0 -70
  109. data/ext/v8/v8_external.h +0 -8
  110. data/ext/v8/v8_function.cpp +0 -69
  111. data/ext/v8/v8_function.h +0 -11
  112. data/ext/v8/v8_handle.cpp +0 -186
  113. data/ext/v8/v8_handle.h +0 -48
  114. data/ext/v8/v8_locker.cpp +0 -139
  115. data/ext/v8/v8_locker.h +0 -6
  116. data/ext/v8/v8_message.cpp +0 -67
  117. data/ext/v8/v8_message.h +0 -10
  118. data/ext/v8/v8_object.cpp +0 -122
  119. data/ext/v8/v8_object.h +0 -10
  120. data/ext/v8/v8_script.cpp +0 -36
  121. data/ext/v8/v8_script.h +0 -8
  122. data/ext/v8/v8_string.cpp +0 -52
  123. data/ext/v8/v8_string.h +0 -9
  124. data/ext/v8/v8_template.cpp +0 -344
  125. data/ext/v8/v8_template.h +0 -8
  126. data/ext/v8/v8_try_catch.cpp +0 -70
  127. data/ext/v8/v8_try_catch.h +0 -5
  128. data/ext/v8/v8_v8.cpp +0 -35
  129. data/ext/v8/v8_v8.h +0 -6
  130. data/ext/v8/v8_value.cpp +0 -175
  131. data/ext/v8/v8_value.h +0 -10
  132. data/ext/v8/v8_weakref.cpp +0 -61
  133. data/ext/v8/v8_weakref.h +0 -29
  134. data/lib/v8/c/locker.rb +0 -18
  135. data/lib/v8/cli.rb +0 -133
  136. data/lib/v8/portal.rb +0 -86
  137. data/lib/v8/portal/caller.rb +0 -37
  138. data/lib/v8/portal/constructor.rb +0 -98
  139. data/lib/v8/portal/function.rb +0 -63
  140. data/lib/v8/portal/interceptors.rb +0 -152
  141. data/lib/v8/portal/proxies.rb +0 -151
  142. data/lib/v8/portal/templates.rb +0 -73
  143. data/lib/v8/stack.rb +0 -66
  144. data/lib/v8/tap.rb +0 -9
  145. data/spec/ext/array_spec.rb +0 -15
  146. data/spec/ext/cxt_spec.rb +0 -57
  147. data/spec/ext/ext_spec_helper.rb +0 -27
  148. data/spec/ext/func_spec.rb +0 -64
  149. data/spec/ext/object_spec.rb +0 -10
  150. data/spec/ext/string_spec.rb +0 -11
  151. data/spec/ext/try_catch_spec.rb +0 -60
  152. data/spec/redjs_helper.rb +0 -3
  153. data/spec/v8/portal/proxies_spec.rb +0 -106
  154. data/specmem/handle_memspec.rb +0 -41
  155. data/specmem/object_memspec.rb +0 -14
  156. data/specmem/proxies_memspec.rb +0 -49
  157. data/specmem/spec_helper.rb +0 -24
  158. data/specthread/spec_helper.rb +0 -2
  159. data/specthread/threading_spec.rb +0 -13
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,2 +0,0 @@
1
- require Pathname(__FILE__).dirname.join('../spec/spec_helper')
2
-
@@ -1,13 +0,0 @@
1
-
2
- require 'spec_helper'
3
-
4
- describe "using v8 from multiple threads" do
5
-
6
- it "is possible" do
7
- Thread.new do
8
- require 'v8'
9
- V8::Context.new
10
- end.join
11
- V8::Context.new
12
- end
13
- end