mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
send messages directly to objects when possible rather than extracting a bound method first.
This commit is contained in:
parent
c1909ad39c
commit
d1cf3cea0f
1 changed files with 11 additions and 3 deletions
|
@ -25,9 +25,9 @@ module V8
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.rubycall(rubycode, *args)
|
def self.rubyprotect
|
||||||
begin
|
begin
|
||||||
To.v8(rubycode.call(*args))
|
To.v8(yield)
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
case e
|
case e
|
||||||
when SystemExit, NoMemoryError
|
when SystemExit, NoMemoryError
|
||||||
|
@ -40,8 +40,16 @@ module V8
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.rubycall(rubycode, *args)
|
||||||
|
rubyprotect do
|
||||||
|
rubycode.call(*args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.rubysend(obj, message, *args)
|
def self.rubysend(obj, message, *args)
|
||||||
rubycall(obj.method(message), *args)
|
rubyprotect do
|
||||||
|
obj.send(message, *args)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Add table
Reference in a new issue