therubyracer 0.11.0beta5-x86-linux → 0.11.0beta6-x86-linux
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/benchmarks.rb +1 -0
- data/ext/v8/accessor.cc +3 -3
- data/ext/v8/backref.cc +0 -2
- data/ext/v8/extconf.rb +3 -1
- data/ext/v8/init.so +0 -0
- data/ext/v8/rr.h +1 -3
- data/ext/v8/trycatch.cc +7 -9
- data/lib/v8/conversion.rb +2 -1
- data/lib/v8/conversion/class.rb +76 -77
- data/lib/v8/version.rb +1 -1
- data/spec/v8/conversion_spec.rb +12 -0
- metadata +2 -2
data/benchmarks.rb
CHANGED
data/ext/v8/accessor.cc
CHANGED
@@ -12,7 +12,7 @@ namespace rr {
|
|
12
12
|
store(&Info::Class);
|
13
13
|
}
|
14
14
|
|
15
|
-
Accessor::Accessor(VALUE getter, VALUE setter, VALUE data_) : get(getter), set(setter), data(data_) {}
|
15
|
+
Accessor::Accessor(VALUE getter, VALUE setter, VALUE data_) : get(getter), set(setter), query(Qnil), deleter(Qnil), enumerator(Qnil), data(data_) {}
|
16
16
|
|
17
17
|
Accessor::Accessor(VALUE get, VALUE set, VALUE query, VALUE deleter, VALUE enumerator, VALUE data) {
|
18
18
|
this->get = get;
|
@@ -31,7 +31,7 @@ namespace rr {
|
|
31
31
|
this->deleter = unwrap(wrapper, 3);
|
32
32
|
this->enumerator = unwrap(wrapper, 4);
|
33
33
|
v8::Handle<v8::Value> data = wrapper->Get(5);
|
34
|
-
if (!data.IsEmpty()) {
|
34
|
+
if (!data.IsEmpty() && !data->IsNull() && !data->IsUndefined()) {
|
35
35
|
this->data = Value(data);
|
36
36
|
}
|
37
37
|
}
|
@@ -57,7 +57,7 @@ namespace rr {
|
|
57
57
|
|
58
58
|
VALUE Accessor::unwrap(v8::Handle<v8::Object> wrapper, int index) {
|
59
59
|
v8::Handle<v8::Value> value = wrapper->Get(index);
|
60
|
-
if (value.IsEmpty()) {
|
60
|
+
if (value.IsEmpty() || !value->IsExternal()) {
|
61
61
|
return Qnil;
|
62
62
|
} else {
|
63
63
|
v8::Handle<v8::External> external(v8::External::Cast(*value));
|
data/ext/v8/backref.cc
CHANGED
data/ext/v8/extconf.rb
CHANGED
@@ -13,7 +13,9 @@ if CONFIG['warnflags']
|
|
13
13
|
CONFIG['warnflags'].gsub!('-Wdeclaration-after-statement', '')
|
14
14
|
CONFIG['warnflags'].gsub!('-Wimplicit-function-declaration', '')
|
15
15
|
end
|
16
|
-
|
16
|
+
if enable_config('debug')
|
17
|
+
$CFLAGS += " -O0 -ggdb3"
|
18
|
+
end
|
17
19
|
if have_rubygem_libv8?
|
18
20
|
build_with_rubygem_libv8
|
19
21
|
else
|
data/ext/v8/init.so
CHANGED
Binary file
|
data/ext/v8/rr.h
CHANGED
@@ -726,9 +726,8 @@ public:
|
|
726
726
|
class TryCatch {
|
727
727
|
public:
|
728
728
|
static void Init();
|
729
|
-
TryCatch();
|
729
|
+
TryCatch(v8::TryCatch*);
|
730
730
|
TryCatch(VALUE value);
|
731
|
-
~TryCatch();
|
732
731
|
operator VALUE();
|
733
732
|
inline v8::TryCatch* operator->() {return this->impl;}
|
734
733
|
static VALUE HasCaught(VALUE self);
|
@@ -746,7 +745,6 @@ private:
|
|
746
745
|
static VALUE doCall(VALUE code);
|
747
746
|
static VALUE Class;
|
748
747
|
v8::TryCatch* impl;
|
749
|
-
bool allocated;
|
750
748
|
};
|
751
749
|
|
752
750
|
class Locker {
|
data/ext/v8/trycatch.cc
CHANGED
@@ -20,15 +20,13 @@ namespace rr {
|
|
20
20
|
rb_define_singleton_method(c, "TryCatch", (VALUE (*)(...))&doTryCatch, -1);
|
21
21
|
}
|
22
22
|
|
23
|
-
TryCatch::TryCatch(
|
24
|
-
|
25
|
-
Data_Get_Struct(value, class v8::TryCatch, impl);
|
23
|
+
TryCatch::TryCatch(v8::TryCatch* impl) {
|
24
|
+
this->impl = impl;
|
26
25
|
}
|
27
|
-
TryCatch
|
28
|
-
|
29
|
-
delete this->impl;
|
30
|
-
}
|
26
|
+
TryCatch::TryCatch(VALUE value) {
|
27
|
+
Data_Get_Struct(value, class v8::TryCatch, impl);
|
31
28
|
}
|
29
|
+
|
32
30
|
TryCatch::operator VALUE() {
|
33
31
|
return Data_Wrap_Struct(Class, 0, 0, impl);
|
34
32
|
}
|
@@ -80,7 +78,7 @@ namespace rr {
|
|
80
78
|
}
|
81
79
|
|
82
80
|
VALUE TryCatch::doCall(VALUE code) {
|
83
|
-
TryCatch trycatch;
|
84
|
-
return rb_funcall(code, rb_intern("call"), 1, (VALUE)trycatch);
|
81
|
+
v8::TryCatch trycatch;
|
82
|
+
return rb_funcall(code, rb_intern("call"), 1, (VALUE)TryCatch(&trycatch));
|
85
83
|
}
|
86
84
|
}
|
data/lib/v8/conversion.rb
CHANGED
@@ -20,9 +20,10 @@ end
|
|
20
20
|
|
21
21
|
for type in [Class, Object, Array, Hash, String, Symbol, Time, Proc, Method] do
|
22
22
|
type.class_eval do
|
23
|
-
include V8::Conversion.const_get(name)
|
23
|
+
include V8::Conversion.const_get(type.name)
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
26
27
|
class UnboundMethod
|
27
28
|
include V8::Conversion::Method
|
28
29
|
end
|
data/lib/v8/conversion/class.rb
CHANGED
@@ -4,117 +4,116 @@ class V8::Conversion
|
|
4
4
|
|
5
5
|
def to_template
|
6
6
|
weakcell(:constructor) do
|
7
|
-
template = V8::C::FunctionTemplate::New(Constructor.new(self))
|
7
|
+
template = V8::C::FunctionTemplate::New(V8::Conversion::Constructor.new(self))
|
8
8
|
prototype = template.InstanceTemplate()
|
9
|
-
prototype.SetNamedPropertyHandler(Get, Set)
|
10
|
-
prototype.SetIndexedPropertyHandler(IGet, ISet)
|
9
|
+
prototype.SetNamedPropertyHandler(V8::Conversion::Get, V8::Conversion::Set)
|
10
|
+
prototype.SetIndexedPropertyHandler(V8::Conversion::IGet, V8::Conversion::ISet)
|
11
11
|
if self != ::Object && superclass != ::Object && superclass != ::Class
|
12
12
|
template.Inherit(superclass.to_template)
|
13
13
|
end
|
14
14
|
template
|
15
15
|
end
|
16
16
|
end
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
class Constructor
|
20
|
+
include V8::Error::Protect
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
def initialize(cls)
|
23
|
+
@class = cls
|
24
|
+
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
26
|
+
def call(arguments)
|
27
|
+
arguments.extend Args
|
28
|
+
protect do
|
29
|
+
if arguments.linkage_call?
|
30
|
+
arguments.link
|
31
|
+
else
|
32
|
+
arguments.construct @class
|
33
33
|
end
|
34
|
-
return arguments.This()
|
35
34
|
end
|
35
|
+
return arguments.This()
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
module Args
|
39
|
+
def linkage_call?
|
40
|
+
self.Length() == 1 && self[0].IsExternal()
|
41
|
+
end
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
def link
|
44
|
+
external = self[0]
|
45
|
+
This().SetHiddenValue("rr::implementation", external)
|
46
|
+
context.link external.Value(), This()
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
|
49
|
+
def construct(cls)
|
50
|
+
context.link cls.new(*to_args), This()
|
51
|
+
end
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
def context
|
54
|
+
V8::Context.current
|
55
|
+
end
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
return args
|
57
|
+
def to_args
|
58
|
+
args = ::Array.new(Length())
|
59
|
+
0.upto(args.length - 1) do |i|
|
60
|
+
args[i] = self[i]
|
62
61
|
end
|
62
|
+
return args
|
63
63
|
end
|
64
64
|
end
|
65
|
+
end
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
67
|
+
module Accessor
|
68
|
+
include V8::Error::Protect
|
69
|
+
def intercept(info, key, &block)
|
70
|
+
context = V8::Context.current
|
71
|
+
access = context.access
|
72
|
+
object = context.to_ruby(info.This())
|
73
|
+
handles_property = true
|
74
|
+
dontintercept = proc do
|
75
|
+
handles_property = false
|
76
|
+
end
|
77
|
+
protect do
|
78
|
+
result = block.call(context, access, object, context.to_ruby(key), dontintercept)
|
79
|
+
handles_property ? context.to_v8(result) : V8::C::Value::Empty
|
80
80
|
end
|
81
81
|
end
|
82
|
+
end
|
82
83
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
84
|
+
class Get
|
85
|
+
extend Accessor
|
86
|
+
def self.call(property, info)
|
87
|
+
intercept(info, property) do |context, access, object, key, dontintercept|
|
88
|
+
access.get(object, key, &dontintercept)
|
89
89
|
end
|
90
90
|
end
|
91
|
+
end
|
91
92
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
end
|
93
|
+
class Set
|
94
|
+
extend Accessor
|
95
|
+
def self.call(property, value, info)
|
96
|
+
intercept(info, property) do |context, access, object, key, dontintercept|
|
97
|
+
access.set(object, key, context.to_ruby(value), &dontintercept)
|
98
98
|
end
|
99
99
|
end
|
100
|
+
end
|
100
101
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
end
|
102
|
+
class IGet
|
103
|
+
extend Accessor
|
104
|
+
def self.call(property, info)
|
105
|
+
intercept(info, property) do |context, access, object, key, dontintercept|
|
106
|
+
access.iget(object, key, &dontintercept)
|
107
107
|
end
|
108
108
|
end
|
109
|
+
end
|
109
110
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end
|
111
|
+
class ISet
|
112
|
+
extend Accessor
|
113
|
+
def self.call(property, value, info)
|
114
|
+
intercept(info, property) do |context, access, object, key, dontintercept|
|
115
|
+
access.iset(object, key, context.to_ruby(value), &dontintercept)
|
116
116
|
end
|
117
117
|
end
|
118
|
-
|
119
118
|
end
|
120
119
|
end
|
data/lib/v8/version.rb
CHANGED
data/spec/v8/conversion_spec.rb
CHANGED
@@ -6,4 +6,16 @@ describe V8::Conversion do
|
|
6
6
|
cxt['big'] = BigDecimal.new('1.1')
|
7
7
|
cxt['big'].should eql BigDecimal.new('1.1')
|
8
8
|
end
|
9
|
+
|
10
|
+
it "doesn't try to use V8::Conversion::Class::* as root objects" do
|
11
|
+
klass = Class.new do
|
12
|
+
class << self
|
13
|
+
def test
|
14
|
+
Set.new
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
klass.test.should be_instance_of(::Set)
|
20
|
+
end
|
9
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: therubyracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.0beta6
|
5
5
|
segments:
|
6
6
|
hash:
|
7
7
|
platform: x86-linux
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-08-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ref
|