class CodeTools::AST::SendFastNew
Emits a fast path for new
Public Class Methods
match?(line, receiver, name, arguments, privately)
click to toggle source
# File lib/rubinius/code/ast/transforms.rb, line 251 def self.match?(line, receiver, name, arguments, privately) # ignore vcall style return false if !arguments and privately name == :new end
Public Instance Methods
bytecode(g)
click to toggle source
Calls superclass method
CodeTools::AST::SendWithArguments#bytecode
# File lib/rubinius/code/ast/transforms.rb, line 257 def bytecode(g) return super(g) if @block or @arguments.splat? pos(g) slow = g.new_label done = g.new_label @receiver.bytecode(g) g.dup if @privately g.check_serial_private :new, Rubinius::CompiledCode::KernelMethodSerial else g.check_serial :new, Rubinius::CompiledCode::KernelMethodSerial end g.goto_if_false slow # fast path g.send :allocate, 0, true g.dup @arguments.bytecode(g) g.send :initialize, @arguments.size, true g.pop g.goto done # slow path slow.set! @arguments.bytecode(g) g.send :new, @arguments.size, @privately done.set! end