Commit 6dac67da authored by yangguo@chromium.org's avatar yangguo@chromium.org

Use ReplaceCode instead of set_code in debug.cc.

R=ulan@chromium.org

Review URL: https://codereview.chromium.org/274043002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21206 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9e1abe4d
...@@ -2050,12 +2050,11 @@ void Debug::EnsureFunctionHasDebugBreakSlots(Handle<JSFunction> function) { ...@@ -2050,12 +2050,11 @@ void Debug::EnsureFunctionHasDebugBreakSlots(Handle<JSFunction> function) {
ForceDebuggerActive force_debugger_active(isolate_); ForceDebuggerActive force_debugger_active(isolate_);
MaybeHandle<Code> code = Compiler::GetCodeForDebugging(function); MaybeHandle<Code> code = Compiler::GetCodeForDebugging(function);
// Recompilation can fail. In that case leave the code as it was. // Recompilation can fail. In that case leave the code as it was.
if (!code.is_null()) if (!code.is_null()) function->ReplaceCode(*code.ToHandleChecked());
function->ReplaceCode(*code.ToHandleChecked()); } else {
} // Simply use shared code if it has debug break slots.
// Keep function code in sync with shared function info.
function->ReplaceCode(function->shared()->code()); function->ReplaceCode(function->shared()->code());
}
} }
...@@ -2152,8 +2151,8 @@ void Debug::PrepareForBreakPoints() { ...@@ -2152,8 +2151,8 @@ void Debug::PrepareForBreakPoints() {
Code::Kind kind = function->code()->kind(); Code::Kind kind = function->code()->kind();
if (kind == Code::FUNCTION && if (kind == Code::FUNCTION &&
!function->code()->has_debug_break_slots()) { !function->code()->has_debug_break_slots()) {
function->set_code(*lazy_compile); function->ReplaceCode(*lazy_compile);
function->shared()->set_code(*lazy_compile); function->shared()->ReplaceCode(*lazy_compile);
} else if (kind == Code::BUILTIN && } else if (kind == Code::BUILTIN &&
(function->IsInOptimizationQueue() || (function->IsInOptimizationQueue() ||
function->IsMarkedForOptimization() || function->IsMarkedForOptimization() ||
...@@ -2162,10 +2161,10 @@ void Debug::PrepareForBreakPoints() { ...@@ -2162,10 +2161,10 @@ void Debug::PrepareForBreakPoints() {
Code* shared_code = function->shared()->code(); Code* shared_code = function->shared()->code();
if (shared_code->kind() == Code::FUNCTION && if (shared_code->kind() == Code::FUNCTION &&
shared_code->has_debug_break_slots()) { shared_code->has_debug_break_slots()) {
function->set_code(shared_code); function->ReplaceCode(shared_code);
} else { } else {
function->set_code(*lazy_compile); function->ReplaceCode(*lazy_compile);
function->shared()->set_code(*lazy_compile); function->shared()->ReplaceCode(*lazy_compile);
} }
} }
} else if (obj->IsJSGeneratorObject()) { } else if (obj->IsJSGeneratorObject()) {
...@@ -2206,8 +2205,8 @@ void Debug::PrepareForBreakPoints() { ...@@ -2206,8 +2205,8 @@ void Debug::PrepareForBreakPoints() {
Handle<JSFunction> &function = generator_functions[i]; Handle<JSFunction> &function = generator_functions[i];
if (function->code()->kind() != Code::FUNCTION) continue; if (function->code()->kind() != Code::FUNCTION) continue;
if (function->code()->has_debug_break_slots()) continue; if (function->code()->has_debug_break_slots()) continue;
function->set_code(*lazy_compile); function->ReplaceCode(*lazy_compile);
function->shared()->set_code(*lazy_compile); function->shared()->ReplaceCode(*lazy_compile);
} }
// Now recompile all functions with activation frames and and // Now recompile all functions with activation frames and and
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment