Skip to content

Commit

Permalink
Add flowgraph for JumpTable
Browse files Browse the repository at this point in the history
  • Loading branch information
HalidOdat committed Jul 21, 2023
1 parent a968b2a commit e79a846
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions boa_engine/src/vm/flowgraph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,25 @@ impl CodeBlock {
pc += size_of::<u32>();

graph.add_node(previous_pc, NodeShape::None, label.into(), Color::None);
graph.add_edge(previous_pc, default as usize, Some("DEFAULT".into()), Color::None, EdgeStyle::Line);
graph.add_edge(
previous_pc,
default as usize,
Some("DEFAULT".into()),
Color::None,
EdgeStyle::Line,
);

for i in 0..count {
let address = self.read::<u32>(pc);
pc += size_of::<u32>();

graph.add_edge(previous_pc, address as usize, Some(format!("Index: {i}").into()), Color::None, EdgeStyle::Line);
graph.add_edge(
previous_pc,
address as usize,
Some(format!("Index: {i}").into()),
Color::None,
EdgeStyle::Line,
);
}
}
Opcode::Pop
Expand Down

0 comments on commit e79a846

Please sign in to comment.