Fix CompileFullCodeForDebugging to compile closure.

This compiles against a given closure instead of the shared function
info, which is a prerequisite for enabling lazy compilation of inner
functions within a closure with non-trivial context.

R=ulan@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10543026

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11731 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 089cb3ae
...@@ -1784,20 +1784,19 @@ void Debug::ClearStepNext() { ...@@ -1784,20 +1784,19 @@ void Debug::ClearStepNext() {
// Helper function to compile full code for debugging. This code will // Helper function to compile full code for debugging. This code will
// have debug break slots and deoptimization // have debug break slots and deoptimization information. Deoptimization
// information. Deoptimization information is required in case that an // information is required in case that an optimized version of this
// optimized version of this function is still activated on the // function is still activated on the stack. It will also make sure that
// stack. It will also make sure that the full code is compiled with // the full code is compiled with the same flags as the previous version,
// the same flags as the previous version - that is flags which can // that is flags which can change the code generated. The current method
// change the code generated. The current method of mapping from // of mapping from already compiled full code without debug break slots
// already compiled full code without debug break slots to full code // to full code with debug break slots depends on the generated code is
// with debug break slots depends on the generated code is otherwise // otherwise exactly the same.
// exactly the same. static bool CompileFullCodeForDebugging(Handle<JSFunction> function,
static bool CompileFullCodeForDebugging(Handle<SharedFunctionInfo> shared,
Handle<Code> current_code) { Handle<Code> current_code) {
ASSERT(!current_code->has_debug_break_slots()); ASSERT(!current_code->has_debug_break_slots());
CompilationInfo info(shared); CompilationInfo info(function);
info.MarkCompilingForDebugging(current_code); info.MarkCompilingForDebugging(current_code);
ASSERT(!info.shared_info()->is_compiled()); ASSERT(!info.shared_info()->is_compiled());
ASSERT(!info.isolate()->has_pending_exception()); ASSERT(!info.isolate()->has_pending_exception());
...@@ -1809,7 +1808,7 @@ static bool CompileFullCodeForDebugging(Handle<SharedFunctionInfo> shared, ...@@ -1809,7 +1808,7 @@ static bool CompileFullCodeForDebugging(Handle<SharedFunctionInfo> shared,
info.isolate()->clear_pending_exception(); info.isolate()->clear_pending_exception();
#if DEBUG #if DEBUG
if (result) { if (result) {
Handle<Code> new_code(shared->code()); Handle<Code> new_code(function->shared()->code());
ASSERT(new_code->has_debug_break_slots()); ASSERT(new_code->has_debug_break_slots());
ASSERT(current_code->is_compiled_optimizable() == ASSERT(current_code->is_compiled_optimizable() ==
new_code->is_compiled_optimizable()); new_code->is_compiled_optimizable());
...@@ -2013,6 +2012,7 @@ void Debug::PrepareForBreakPoints() { ...@@ -2013,6 +2012,7 @@ void Debug::PrepareForBreakPoints() {
// patch the return address to run in the new compiled code. // patch the return address to run in the new compiled code.
for (int i = 0; i < active_functions.length(); i++) { for (int i = 0; i < active_functions.length(); i++) {
Handle<JSFunction> function = active_functions[i]; Handle<JSFunction> function = active_functions[i];
Handle<SharedFunctionInfo> shared(function->shared());
if (function->code()->kind() == Code::FUNCTION && if (function->code()->kind() == Code::FUNCTION &&
function->code()->has_debug_break_slots()) { function->code()->has_debug_break_slots()) {
...@@ -2020,7 +2020,6 @@ void Debug::PrepareForBreakPoints() { ...@@ -2020,7 +2020,6 @@ void Debug::PrepareForBreakPoints() {
continue; continue;
} }
Handle<SharedFunctionInfo> shared(function->shared());
// If recompilation is not possible just skip it. // If recompilation is not possible just skip it.
if (shared->is_toplevel() || if (shared->is_toplevel() ||
!shared->allows_lazy_compilation() || !shared->allows_lazy_compilation() ||
...@@ -2040,7 +2039,7 @@ void Debug::PrepareForBreakPoints() { ...@@ -2040,7 +2039,7 @@ void Debug::PrepareForBreakPoints() {
isolate_->debugger()->force_debugger_active(); isolate_->debugger()->force_debugger_active();
isolate_->debugger()->set_force_debugger_active(true); isolate_->debugger()->set_force_debugger_active(true);
ASSERT(current_code->kind() == Code::FUNCTION); ASSERT(current_code->kind() == Code::FUNCTION);
CompileFullCodeForDebugging(shared, current_code); CompileFullCodeForDebugging(function, current_code);
isolate_->debugger()->set_force_debugger_active( isolate_->debugger()->set_force_debugger_active(
prev_force_debugger_active); prev_force_debugger_active);
if (!shared->is_compiled()) { if (!shared->is_compiled()) {
......
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