| 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 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 // function is still activated on the stack. It will also make sure that | 1833 // function is still activated on the stack. It will also make sure that |
| 1834 // the full code is compiled with the same flags as the previous version, | 1834 // the full code is compiled with the same flags as the previous version, |
| 1835 // that is flags which can change the code generated. The current method | 1835 // that is flags which can change the code generated. The current method |
| 1836 // of mapping from already compiled full code without debug break slots | 1836 // of mapping from already compiled full code without debug break slots |
| 1837 // to full code with debug break slots depends on the generated code is | 1837 // to full code with debug break slots depends on the generated code is |
| 1838 // otherwise exactly the same. | 1838 // otherwise exactly the same. |
| 1839 static bool CompileFullCodeForDebugging(Handle<JSFunction> function, | 1839 static bool CompileFullCodeForDebugging(Handle<JSFunction> function, |
| 1840 Handle<Code> current_code) { | 1840 Handle<Code> current_code) { |
| 1841 ASSERT(!current_code->has_debug_break_slots()); | 1841 ASSERT(!current_code->has_debug_break_slots()); |
| 1842 | 1842 |
| 1843 CompilationInfo info(function); | 1843 CompilationInfoWithZone info(function); |
| 1844 info.MarkCompilingForDebugging(current_code); | 1844 info.MarkCompilingForDebugging(current_code); |
| 1845 ASSERT(!info.shared_info()->is_compiled()); | 1845 ASSERT(!info.shared_info()->is_compiled()); |
| 1846 ASSERT(!info.isolate()->has_pending_exception()); | 1846 ASSERT(!info.isolate()->has_pending_exception()); |
| 1847 | 1847 |
| 1848 // Use compile lazy which will end up compiling the full code in the | 1848 // Use compile lazy which will end up compiling the full code in the |
| 1849 // configuration configured above. | 1849 // configuration configured above. |
| 1850 bool result = Compiler::CompileLazy(&info); | 1850 bool result = Compiler::CompileLazy(&info); |
| 1851 ASSERT(result != Isolate::Current()->has_pending_exception()); | 1851 ASSERT(result != Isolate::Current()->has_pending_exception()); |
| 1852 info.isolate()->clear_pending_exception(); | 1852 info.isolate()->clear_pending_exception(); |
| 1853 #if DEBUG | 1853 #if DEBUG |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2090 shared->code()->kind() == Code::BUILTIN) { | 2090 shared->code()->kind() == Code::BUILTIN) { |
| 2091 continue; | 2091 continue; |
| 2092 } | 2092 } |
| 2093 | 2093 |
| 2094 // Make sure that the shared full code is compiled with debug | 2094 // Make sure that the shared full code is compiled with debug |
| 2095 // break slots. | 2095 // break slots. |
| 2096 if (!shared->code()->has_debug_break_slots()) { | 2096 if (!shared->code()->has_debug_break_slots()) { |
| 2097 // Try to compile the full code with debug break slots. If it | 2097 // Try to compile the full code with debug break slots. If it |
| 2098 // fails just keep the current code. | 2098 // fails just keep the current code. |
| 2099 Handle<Code> current_code(function->shared()->code()); | 2099 Handle<Code> current_code(function->shared()->code()); |
| 2100 ZoneScope zone_scope(isolate_, DELETE_ON_EXIT); | |
| 2101 shared->set_code(*lazy_compile); | 2100 shared->set_code(*lazy_compile); |
| 2102 bool prev_force_debugger_active = | 2101 bool prev_force_debugger_active = |
| 2103 isolate_->debugger()->force_debugger_active(); | 2102 isolate_->debugger()->force_debugger_active(); |
| 2104 isolate_->debugger()->set_force_debugger_active(true); | 2103 isolate_->debugger()->set_force_debugger_active(true); |
| 2105 ASSERT(current_code->kind() == Code::FUNCTION); | 2104 ASSERT(current_code->kind() == Code::FUNCTION); |
| 2106 CompileFullCodeForDebugging(function, current_code); | 2105 CompileFullCodeForDebugging(function, current_code); |
| 2107 isolate_->debugger()->set_force_debugger_active( | 2106 isolate_->debugger()->set_force_debugger_active( |
| 2108 prev_force_debugger_active); | 2107 prev_force_debugger_active); |
| 2109 if (!shared->is_compiled()) { | 2108 if (!shared->is_compiled()) { |
| 2110 shared->set_code(*current_code); | 2109 shared->set_code(*current_code); |
| (...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3687 { | 3686 { |
| 3688 Locker locker; | 3687 Locker locker; |
| 3689 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3688 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
| 3690 } | 3689 } |
| 3691 } | 3690 } |
| 3692 } | 3691 } |
| 3693 | 3692 |
| 3694 #endif // ENABLE_DEBUGGER_SUPPORT | 3693 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3695 | 3694 |
| 3696 } } // namespace v8::internal | 3695 } } // namespace v8::internal |
| OLD | NEW |