| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 shared->code()->kind() == Code::BUILTIN) { | 2045 shared->code()->kind() == Code::BUILTIN) { |
| 2044 continue; | 2046 continue; |
| 2045 } | 2047 } |
| 2046 | 2048 |
| 2047 // Make sure that the shared full code is compiled with debug | 2049 // Make sure that the shared full code is compiled with debug |
| 2048 // break slots. | 2050 // break slots. |
| 2049 if (!shared->code()->has_debug_break_slots()) { | 2051 if (!shared->code()->has_debug_break_slots()) { |
| 2050 // Try to compile the full code with debug break slots. If it | 2052 // Try to compile the full code with debug break slots. If it |
| 2051 // fails just keep the current code. | 2053 // fails just keep the current code. |
| 2052 Handle<Code> current_code(function->shared()->code()); | 2054 Handle<Code> current_code(function->shared()->code()); |
| 2053 ZoneScope zone_scope(isolate_, DELETE_ON_EXIT); | |
| 2054 shared->set_code(*lazy_compile); | 2055 shared->set_code(*lazy_compile); |
| 2055 bool prev_force_debugger_active = | 2056 bool prev_force_debugger_active = |
| 2056 isolate_->debugger()->force_debugger_active(); | 2057 isolate_->debugger()->force_debugger_active(); |
| 2057 isolate_->debugger()->set_force_debugger_active(true); | 2058 isolate_->debugger()->set_force_debugger_active(true); |
| 2058 ASSERT(current_code->kind() == Code::FUNCTION); | 2059 ASSERT(current_code->kind() == Code::FUNCTION); |
| 2059 CompileFullCodeForDebugging(function, current_code); | 2060 CompileFullCodeForDebugging(function, current_code); |
| 2060 isolate_->debugger()->set_force_debugger_active( | 2061 isolate_->debugger()->set_force_debugger_active( |
| 2061 prev_force_debugger_active); | 2062 prev_force_debugger_active); |
| 2062 if (!shared->is_compiled()) { | 2063 if (!shared->is_compiled()) { |
| 2063 shared->set_code(*current_code); | 2064 shared->set_code(*current_code); |
| (...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3638 { | 3639 { |
| 3639 Locker locker; | 3640 Locker locker; |
| 3640 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3641 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
| 3641 } | 3642 } |
| 3642 } | 3643 } |
| 3643 } | 3644 } |
| 3644 | 3645 |
| 3645 #endif // ENABLE_DEBUGGER_SUPPORT | 3646 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3646 | 3647 |
| 3647 } } // namespace v8::internal | 3648 } } // namespace v8::internal |
| OLD | NEW |