Class: Rubinius::Coverage::CFG::BasicBlock
- Inherits:
-
Object
- Object
- Rubinius::Coverage::CFG::BasicBlock
- Defined in:
- lib/rubinius/coverage.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#enter_ip ⇒ Object
Returns the value of attribute enter_ip.
-
#exit_ip ⇒ Object
Returns the value of attribute exit_ip.
-
#left ⇒ Object
Returns the value of attribute left.
-
#lines ⇒ Object
Returns the value of attribute lines.
-
#right ⇒ Object
Returns the value of attribute right.
Instance Method Summary collapse
- #coverage(code, call_sites) ⇒ Object
-
#initialize(enter_ip) ⇒ BasicBlock
constructor
A new instance of BasicBlock.
Constructor Details
#initialize(enter_ip) ⇒ BasicBlock
Returns a new instance of BasicBlock.
110 111 112 113 114 |
# File 'lib/rubinius/coverage.rb', line 110 def initialize(enter_ip) @enter_ip = @exit_ip = enter_ip @lines = [] @count = 0 end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
108 109 110 |
# File 'lib/rubinius/coverage.rb', line 108 def count @count end |
#enter_ip ⇒ Object
Returns the value of attribute enter_ip.
108 109 110 |
# File 'lib/rubinius/coverage.rb', line 108 def enter_ip @enter_ip end |
#exit_ip ⇒ Object
Returns the value of attribute exit_ip.
108 109 110 |
# File 'lib/rubinius/coverage.rb', line 108 def exit_ip @exit_ip end |
#left ⇒ Object
Returns the value of attribute left.
108 109 110 |
# File 'lib/rubinius/coverage.rb', line 108 def left @left end |
#lines ⇒ Object
Returns the value of attribute lines.
108 109 110 |
# File 'lib/rubinius/coverage.rb', line 108 def lines @lines end |
#right ⇒ Object
Returns the value of attribute right.
108 109 110 |
# File 'lib/rubinius/coverage.rb', line 108 def right @right end |
Instance Method Details
#coverage(code, call_sites) ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/rubinius/coverage.rb', line 116 def coverage(code, call_sites) total = code.lines.size - 2 i = 0 while i < total if (@enter_ip < code.lines[i+2] and @exit_ip >= code.lines[i]) or (code.lines[i+2] == 0 and @enter_ip == 0) line = code.lines[i+1] @lines << line unless @lines.include? line end i += 2 end call_sites.each do |cs| if cs.ip >= @enter_ip and cs.ip <= @exit_ip cs_count = cs.invokes + cs.hits + cs.misses @count = cs_count if cs_count > @count end end end |