From 74aa15bfa0dba720e6af92434bdd45e23efb0159 Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Mon, 3 Sep 2012 14:23:00 +0000 Subject: [PATCH] Fix FindSharedFunctionInfoInScript to not optimize. This prevents a corner case in FindSharedFunctionInfoInScript that would cause functions to be optimized because an intermittent GC would clear the flag indicating whether breakpoints are present. Above method was also moved into the Debug class because it is only used by the debugger. R=verwaest@chromium.org Review URL: https://chromiumcodereview.appspot.com/10914065 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12428 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler.cc | 2 +- src/debug.cc | 120 ++++++++++++++++++++++++++++++-- src/debug.h | 3 + src/runtime.cc | 109 ----------------------------- src/runtime.h | 5 -- test/cctest/test-func-name-inference.cc | 7 +- 6 files changed, 122 insertions(+), 124 deletions(-) diff --git a/src/compiler.cc b/src/compiler.cc index 6153f3a..e4a30db 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -936,7 +936,7 @@ Handle Compiler::BuildFunctionInfo(FunctionLiteral* literal, // If the debugger requests compilation for break points, we cannot be // aggressive about lazy compilation, because it might trigger compilation // of functions without an outer context when setting a breakpoint through - // Runtime::FindSharedFunctionInfoInScript. + // Debug::FindSharedFunctionInfoInScript. bool allow_lazy_without_ctx = literal->AllowsLazyCompilationWithoutContext(); bool allow_lazy = literal->AllowsLazyCompilation() && !LiveEditFunctionTracker::IsActive(info.isolate()) && diff --git a/src/debug.cc b/src/debug.cc index c70b834..4ebdd88 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -698,7 +698,7 @@ void Debug::HandleWeakDebugInfo(v8::Persistent obj, void* data) { // We need to clear all breakpoints associated with the function to restore // original code and avoid patching the code twice later because // the function will live in the heap until next gc, and can be found by - // Runtime::FindSharedFunctionInfoInScript. + // Debug::FindSharedFunctionInfoInScript. BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS); it.ClearAllDebugBreak(); debug->RemoveDebugInfo(node->debug_info()); @@ -1172,11 +1172,10 @@ bool Debug::SetBreakPointForScript(Handle