| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 // function is still activated on the stack. It will also make sure that | 1789 // function is still activated on the stack. It will also make sure that |
| 1790 // the full code is compiled with the same flags as the previous version, | 1790 // the full code is compiled with the same flags as the previous version, |
| 1791 // that is flags which can change the code generated. The current method | 1791 // that is flags which can change the code generated. The current method |
| 1792 // of mapping from already compiled full code without debug break slots | 1792 // of mapping from already compiled full code without debug break slots |
| 1793 // to full code with debug break slots depends on the generated code is | 1793 // to full code with debug break slots depends on the generated code is |
| 1794 // otherwise exactly the same. | 1794 // otherwise exactly the same. |
| 1795 static bool CompileFullCodeForDebugging(Handle<JSFunction> function, | 1795 static bool CompileFullCodeForDebugging(Handle<JSFunction> function, |
| 1796 Handle<Code> current_code) { | 1796 Handle<Code> current_code) { |
| 1797 ASSERT(!current_code->has_debug_break_slots()); | 1797 ASSERT(!current_code->has_debug_break_slots()); |
| 1798 | 1798 |
| 1799 CompilationInfo info(function); | 1799 Zone zone(function->GetIsolate()); |
| 1800 CompilationInfo info(function, &zone); |
| 1801 ZoneScope scope(&zone, DELETE_ON_EXIT); |
| 1800 info.MarkCompilingForDebugging(current_code); | 1802 info.MarkCompilingForDebugging(current_code); |
| 1801 ASSERT(!info.shared_info()->is_compiled()); | 1803 ASSERT(!info.shared_info()->is_compiled()); |
| 1802 ASSERT(!info.isolate()->has_pending_exception()); | 1804 ASSERT(!info.isolate()->has_pending_exception()); |
| 1803 | 1805 |
| 1804 // Use compile lazy which will end up compiling the full code in the | 1806 // Use compile lazy which will end up compiling the full code in the |
| 1805 // configuration configured above. | 1807 // configuration configured above. |
| 1806 bool result = Compiler::CompileLazy(&info); | 1808 bool result = Compiler::CompileLazy(&info); |
| 1807 ASSERT(result != Isolate::Current()->has_pending_exception()); | 1809 ASSERT(result != Isolate::Current()->has_pending_exception()); |
| 1808 info.isolate()->clear_pending_exception(); | 1810 info.isolate()->clear_pending_exception(); |
| 1809 #if DEBUG | 1811 #if DEBUG |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 shared->code()->kind() == Code::BUILTIN) { | 2028 shared->code()->kind() == Code::BUILTIN) { |
| 2027 continue; | 2029 continue; |
| 2028 } | 2030 } |
| 2029 | 2031 |
| 2030 // Make sure that the shared full code is compiled with debug | 2032 // Make sure that the shared full code is compiled with debug |
| 2031 // break slots. | 2033 // break slots. |
| 2032 if (!shared->code()->has_debug_break_slots()) { | 2034 if (!shared->code()->has_debug_break_slots()) { |
| 2033 // Try to compile the full code with debug break slots. If it | 2035 // Try to compile the full code with debug break slots. If it |
| 2034 // fails just keep the current code. | 2036 // fails just keep the current code. |
| 2035 Handle<Code> current_code(function->shared()->code()); | 2037 Handle<Code> current_code(function->shared()->code()); |
| 2036 ZoneScope zone_scope(isolate_, DELETE_ON_EXIT); | |
| 2037 shared->set_code(*lazy_compile); | 2038 shared->set_code(*lazy_compile); |
| 2038 bool prev_force_debugger_active = | 2039 bool prev_force_debugger_active = |
| 2039 isolate_->debugger()->force_debugger_active(); | 2040 isolate_->debugger()->force_debugger_active(); |
| 2040 isolate_->debugger()->set_force_debugger_active(true); | 2041 isolate_->debugger()->set_force_debugger_active(true); |
| 2041 ASSERT(current_code->kind() == Code::FUNCTION); | 2042 ASSERT(current_code->kind() == Code::FUNCTION); |
| 2042 CompileFullCodeForDebugging(function, current_code); | 2043 CompileFullCodeForDebugging(function, current_code); |
| 2043 isolate_->debugger()->set_force_debugger_active( | 2044 isolate_->debugger()->set_force_debugger_active( |
| 2044 prev_force_debugger_active); | 2045 prev_force_debugger_active); |
| 2045 if (!shared->is_compiled()) { | 2046 if (!shared->is_compiled()) { |
| 2046 shared->set_code(*current_code); | 2047 shared->set_code(*current_code); |
| (...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3621 { | 3622 { |
| 3622 Locker locker; | 3623 Locker locker; |
| 3623 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3624 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
| 3624 } | 3625 } |
| 3625 } | 3626 } |
| 3626 } | 3627 } |
| 3627 | 3628 |
| 3628 #endif // ENABLE_DEBUGGER_SUPPORT | 3629 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3629 | 3630 |
| 3630 } } // namespace v8::internal | 3631 } } // namespace v8::internal |
| OLD | NEW |