diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 4994975358..13ff06e606 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -811,7 +811,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, return; } - if (FLAG_trap_on_deopt && info()->IsOptimizing()) { + if (info()->ShouldTrapOnDeopt()) { __ stop("trap_on_deopt", cc); } diff --git a/src/compiler.h b/src/compiler.h index 50053e5625..47d459a282 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -199,6 +199,11 @@ class CompilationInfo { return IsCompilingForDebugging::decode(flags_); } + bool ShouldTrapOnDeopt() const { + return (FLAG_trap_on_deopt && IsOptimizing()) || + (FLAG_trap_on_stub_deopt && IsStub()); + } + bool has_global_object() const { return !closure().is_null() && (closure()->context()->global_object() != NULL); diff --git a/src/flag-definitions.h b/src/flag-definitions.h index c68beb5ed9..c0ad4a8e17 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -264,6 +264,8 @@ DEFINE_int(deopt_every_n_garbage_collections, "deoptimize every n garbage collections") DEFINE_bool(print_deopt_stress, false, "print number of possible deopt points") DEFINE_bool(trap_on_deopt, false, "put a break point before deoptimizing") +DEFINE_bool(trap_on_stub_deopt, false, + "put a break point before deoptimizing a stub") DEFINE_bool(deoptimize_uncommon_cases, true, "deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true, "polymorphic inlining") DEFINE_bool(use_osr, true, "use on-stack replacement") diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 725a34e0f7..8c1175d865 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -1010,7 +1010,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, __ bind(&done); } - if (FLAG_trap_on_deopt && info()->IsOptimizing()) { + if (info()->ShouldTrapOnDeopt()) { Label done; if (cc != no_condition) __ j(NegateCondition(cc), &done, Label::kNear); __ int3(); diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 15325e06b5..91be0d6a50 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -787,7 +787,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, return; } - if (FLAG_trap_on_deopt && info()->IsOptimizing()) { + if (info()->ShouldTrapOnDeopt()) { Label skip; if (cc != al) { __ Branch(&skip, NegateCondition(cc), src1, src2); diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 8cbfec2076..72340658ac 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -693,7 +693,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, ASSERT(FLAG_deopt_every_n_times == 0); // Not yet implemented on x64. - if (FLAG_trap_on_deopt && info()->IsOptimizing()) { + if (info()->ShouldTrapOnDeopt()) { Label done; if (cc != no_condition) { __ j(NegateCondition(cc), &done, Label::kNear);