diff --git a/src/browser/print_stats.js b/src/browser/print_stats.js index e7861efa..2beaaca4 100644 --- a/src/browser/print_stats.js +++ b/src/browser/print_stats.js @@ -59,6 +59,9 @@ const print_stats = { "LOOP_SAFETY", "CONDITION_OPTIMISED", "CONDITION_UNOPTIMISED", + "CONDITION_UNOPTIMISED_PF", + "CONDITION_UNOPTIMISED_UNHANDLED_L", + "CONDITION_UNOPTIMISED_UNHANDLED_LE", "FAILED_PAGE_CHANGE", "SAFE_READ_FAST", "SAFE_READ_SLOW_PAGE_CROSSED", diff --git a/src/rust/codegen.rs b/src/rust/codegen.rs index f03dd060..8f38ac4d 100644 --- a/src/rust/codegen.rs +++ b/src/rust/codegen.rs @@ -2170,8 +2170,14 @@ pub fn gen_test_l(ctx: &mut JitContext, negate: ConditionNegate) { gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_OPTIMISED); gen_getsf(ctx, negate); }, - _ => { + &Instruction::Other | Instruction::Add { .. } => { gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED); + if let Instruction::Add { .. } = ctx.previous_instruction { + gen_profiler_stat_increment( + ctx.builder, + profiler::stat::CONDITION_UNOPTIMISED_UNHANDLED_L, + ); + } gen_getsf(ctx, ConditionNegate::False); ctx.builder.eqz_i32(); gen_getof(ctx); @@ -2294,8 +2300,14 @@ pub fn gen_test_le(ctx: &mut JitContext, negate: ConditionNegate) { ctx.builder.eqz_i32(); } }, - _ => { + Instruction::Other | Instruction::Add { .. } => { gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED); + if let Instruction::Add { .. } = ctx.previous_instruction { + gen_profiler_stat_increment( + ctx.builder, + profiler::stat::CONDITION_UNOPTIMISED_UNHANDLED_LE, + ); + } gen_test_l(ctx, ConditionNegate::False); gen_getzf(ctx, ConditionNegate::False); ctx.builder.or_i32(); @@ -2473,8 +2485,16 @@ pub fn gen_condition_fn(ctx: &mut JitContext, condition: u8) { 0x9 => { gen_getsf(ctx, ConditionNegate::True); }, - 0xA => ctx.builder.call_fn0_ret("test_p"), - 0xB => ctx.builder.call_fn0_ret("test_np"), + 0xA => { + gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED); + gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED_PF); + ctx.builder.call_fn0_ret("test_p"); + }, + 0xB => { + gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED); + gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_UNOPTIMISED_PF); + ctx.builder.call_fn0_ret("test_np"); + }, 0xC => { gen_test_l(ctx, ConditionNegate::False); }, diff --git a/src/rust/profiler.rs b/src/rust/profiler.rs index f360e6e2..5044c7e7 100644 --- a/src/rust/profiler.rs +++ b/src/rust/profiler.rs @@ -48,6 +48,9 @@ pub enum stat { CONDITION_OPTIMISED, CONDITION_UNOPTIMISED, + CONDITION_UNOPTIMISED_PF, + CONDITION_UNOPTIMISED_UNHANDLED_L, + CONDITION_UNOPTIMISED_UNHANDLED_LE, FAILED_PAGE_CHANGE,