Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: src/debug.cc

Issue 271873003: Restore behavior of PrepareForBreakpoints which was broken by r21145 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Set function code to shared Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 6ec7ad695bb3a6cd1836dfa4bef742d34bd31049..23679d8299b4ab57a96f72f7af4a845b16e9ceac 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -2037,18 +2037,25 @@ class ForceDebuggerActive {
};
-void Debug::MaybeRecompileFunctionForDebugging(Handle<JSFunction> function) {
- ASSERT_EQ(Code::FUNCTION, function->code()->kind());
- ASSERT_EQ(function->code(), function->shared()->code());
+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;
+ }
- if (function->code()->has_debug_break_slots()) return;
+ // 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());
+ }
- 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());
+ // Keep function code in sync with shared function info.
+ function->set_code(function->shared()->code());
}
@@ -2057,7 +2064,7 @@ void Debug::RecompileAndRelocateSuspendedGenerators(
for (int i = 0; i < generators.length(); i++) {
Handle<JSFunction> fun(generators[i]->function());
- MaybeRecompileFunctionForDebugging(fun);
+ EnsureFunctionHasDebugBreakSlots(fun);
rmcilroy 2014/05/08 17:00:45 Should there also be checks here to just continue
Yang 2014/05/08 17:03:49 Not sure about lazy compilation. I'll do some rese
rmcilroy 2014/05/08 17:45:37 OK, I'll land as-is now, and leave investigation o
wingo 2014/05/12 08:02:50 Some test cases would have been nice here. I don'
int code_offset = generators[i]->continuation();
int pc_offset = ComputePcOffsetFromCodeOffset(fun->code(), code_offset);
@@ -2217,7 +2224,7 @@ void Debug::PrepareForBreakPoints() {
if (!shared->allows_lazy_compilation()) continue;
if (shared->code()->kind() == Code::BUILTIN) continue;
- MaybeRecompileFunctionForDebugging(function);
+ EnsureFunctionHasDebugBreakSlots(function);
}
RedirectActivationsToRecompiledCodeOnThread(isolate_,
« no previous file with comments | « src/debug.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698