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

Unified Diff: src/debug.cc

Issue 274043002: Use ReplaceCode instead of set_code in debug.cc. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | 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 4e633c91cfa867cffada2363a956b1c5fe780c81..bb589086609aa6f67a5d1eb4f22e933c481a363e 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -2050,12 +2050,11 @@ void Debug::EnsureFunctionHasDebugBreakSlots(Handle<JSFunction> function) {
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());
+ if (!code.is_null()) function->ReplaceCode(*code.ToHandleChecked());
+ } else {
+ // Simply use shared code if it has debug break slots.
+ function->ReplaceCode(function->shared()->code());
}
-
- // Keep function code in sync with shared function info.
- function->ReplaceCode(function->shared()->code());
}
@@ -2152,8 +2151,8 @@ void Debug::PrepareForBreakPoints() {
Code::Kind kind = function->code()->kind();
if (kind == Code::FUNCTION &&
!function->code()->has_debug_break_slots()) {
- function->set_code(*lazy_compile);
- function->shared()->set_code(*lazy_compile);
+ function->ReplaceCode(*lazy_compile);
+ function->shared()->ReplaceCode(*lazy_compile);
} else if (kind == Code::BUILTIN &&
(function->IsInOptimizationQueue() ||
function->IsMarkedForOptimization() ||
@@ -2162,10 +2161,10 @@ void Debug::PrepareForBreakPoints() {
Code* shared_code = function->shared()->code();
if (shared_code->kind() == Code::FUNCTION &&
shared_code->has_debug_break_slots()) {
- function->set_code(shared_code);
+ function->ReplaceCode(shared_code);
} else {
- function->set_code(*lazy_compile);
- function->shared()->set_code(*lazy_compile);
+ function->ReplaceCode(*lazy_compile);
+ function->shared()->ReplaceCode(*lazy_compile);
}
}
} else if (obj->IsJSGeneratorObject()) {
@@ -2206,8 +2205,8 @@ void Debug::PrepareForBreakPoints() {
Handle<JSFunction> &function = generator_functions[i];
if (function->code()->kind() != Code::FUNCTION) continue;
if (function->code()->has_debug_break_slots()) continue;
- function->set_code(*lazy_compile);
- function->shared()->set_code(*lazy_compile);
+ function->ReplaceCode(*lazy_compile);
+ function->shared()->ReplaceCode(*lazy_compile);
}
// Now recompile all functions with activation frames and and
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698