Chromium Code Reviews| Index: src/debug.cc |
| diff --git a/src/debug.cc b/src/debug.cc |
| index 6ec7ad695bb3a6cd1836dfa4bef742d34bd31049..cc26d20f19ca411cfcbf2437bd9d0bffc05aaf27 100644 |
| --- a/src/debug.cc |
| +++ b/src/debug.cc |
| @@ -2037,18 +2037,23 @@ class ForceDebuggerActive { |
| }; |
| -void Debug::MaybeRecompileFunctionForDebugging(Handle<JSFunction> function) { |
| - ASSERT_EQ(Code::FUNCTION, function->code()->kind()); |
| - ASSERT_EQ(function->code(), function->shared()->code()); |
| - |
| - if (function->code()->has_debug_break_slots()) return; |
| +void Debug::EnsureFunctionHasDebugBreakSlots(Handle<JSFunction> function) { |
| + if (function->code()->kind() == Code::FUNCTION && |
| + function->code()->has_debug_break_slots()) { |
| + // Nothing to do. Function code already had debug break slots. |
| + return; |
| + } |
| - ForceDebuggerActive force_debugger_active(isolate_); |
| - MaybeHandle<Code> code = Compiler::GetCodeForDebugging(function); |
| - // Recompilation can fail. In that case leave the code as it was. |
| - if (!code.is_null()) |
| - function->ReplaceCode(*code.ToHandleChecked()); |
| - ASSERT_EQ(function->code(), function->shared()->code()); |
| + // Make sure that the shared full code is compiled with debug |
| + // break slots. |
| + if (!function->shared()->code()->has_debug_break_slots()) { |
| + ForceDebuggerActive force_debugger_active(isolate_); |
| + MaybeHandle<Code> code = Compiler::GetCodeForDebugging(function); |
| + // Recompilation can fail. In that case leave the code as it was. |
| + if (!code.is_null()) |
| + function->ReplaceCode(*code.ToHandleChecked()); |
| + ASSERT_EQ(function->code(), function->shared()->code()); |
| + } |
| } |
|
Yang
2014/05/08 16:36:48
You need to replace the function code by the share
rmcilroy
2014/05/08 16:57:16
Done.
|
| @@ -2057,7 +2062,7 @@ void Debug::RecompileAndRelocateSuspendedGenerators( |
| for (int i = 0; i < generators.length(); i++) { |
| Handle<JSFunction> fun(generators[i]->function()); |
| - MaybeRecompileFunctionForDebugging(fun); |
| + EnsureFunctionHasDebugBreakSlots(fun); |
| int code_offset = generators[i]->continuation(); |
| int pc_offset = ComputePcOffsetFromCodeOffset(fun->code(), code_offset); |
| @@ -2217,7 +2222,7 @@ void Debug::PrepareForBreakPoints() { |
| if (!shared->allows_lazy_compilation()) continue; |
| if (shared->code()->kind() == Code::BUILTIN) continue; |
| - MaybeRecompileFunctionForDebugging(function); |
| + EnsureFunctionHasDebugBreakSlots(function); |
| } |
| RedirectActivationsToRecompiledCodeOnThread(isolate_, |