| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 thread_local_.last_statement_position_ = RelocInfo::kNoPosition; | 1724 thread_local_.last_statement_position_ = RelocInfo::kNoPosition; |
| 1725 thread_local_.last_fp_ = 0; | 1725 thread_local_.last_fp_ = 0; |
| 1726 } | 1726 } |
| 1727 | 1727 |
| 1728 | 1728 |
| 1729 void Debug::PrepareForBreakPoints() { | 1729 void Debug::PrepareForBreakPoints() { |
| 1730 // If preparing for the first break point make sure to deoptimize all | 1730 // If preparing for the first break point make sure to deoptimize all |
| 1731 // functions as debugging does not work with optimized code. | 1731 // functions as debugging does not work with optimized code. |
| 1732 if (!has_break_points_) { | 1732 if (!has_break_points_) { |
| 1733 Deoptimizer::DeoptimizeAll(); | 1733 Deoptimizer::DeoptimizeAll(); |
| 1734 | |
| 1735 AssertNoAllocation no_allocation; | |
| 1736 Builtins* builtins = isolate_->builtins(); | |
| 1737 Code* lazy_compile = builtins->builtin(Builtins::kLazyCompile); | |
| 1738 | |
| 1739 // Find all non-optimized code functions with activation frames on | |
| 1740 // the stack. | |
| 1741 List<JSFunction*> active_functions(100); | |
| 1742 for (JavaScriptFrameIterator it(isolate_); !it.done(); it.Advance()) { | |
| 1743 JavaScriptFrame* frame = it.frame(); | |
| 1744 if (frame->function()->IsJSFunction()) { | |
| 1745 JSFunction* function = JSFunction::cast(frame->function()); | |
| 1746 if (function->code()->kind() == Code::FUNCTION) | |
| 1747 active_functions.Add(function); | |
| 1748 } | |
| 1749 } | |
| 1750 active_functions.Sort(); | |
| 1751 | |
| 1752 // Scan the heap for all non-optimized functions which has no | |
| 1753 // debug break slots. | |
| 1754 HeapIterator iterator; | |
| 1755 HeapObject* obj = NULL; | |
| 1756 while (((obj = iterator.next()) != NULL)) { | |
| 1757 if (obj->IsJSFunction()) { | |
| 1758 JSFunction* function = JSFunction::cast(obj); | |
| 1759 if (function->shared()->allows_lazy_compilation() && | |
| 1760 function->shared()->script()->IsScript() && | |
| 1761 function->code()->kind() == Code::FUNCTION && | |
| 1762 !function->code()->has_debug_break_slots()) { | |
| 1763 bool has_activation = | |
| 1764 SortedListBSearch<JSFunction*>(active_functions, function) != -1; | |
| 1765 if (!has_activation) { | |
| 1766 function->set_code(lazy_compile); | |
| 1767 function->shared()->set_code(lazy_compile); | |
| 1768 } | |
| 1769 } | |
| 1770 } | |
| 1771 } | |
| 1772 } | 1734 } |
| 1773 } | 1735 } |
| 1774 | 1736 |
| 1775 | 1737 |
| 1776 // Ensures the debug information is present for shared. | 1738 // Ensures the debug information is present for shared. |
| 1777 bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared) { | 1739 bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared) { |
| 1778 // Return if we already have the debug info for shared. | 1740 // Return if we already have the debug info for shared. |
| 1779 if (HasDebugInfo(shared)) { | 1741 if (HasDebugInfo(shared)) { |
| 1780 ASSERT(shared->is_compiled()); | 1742 ASSERT(shared->is_compiled()); |
| 1781 return true; | 1743 return true; |
| (...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3224 { | 3186 { |
| 3225 Locker locker; | 3187 Locker locker; |
| 3226 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3188 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
| 3227 } | 3189 } |
| 3228 } | 3190 } |
| 3229 } | 3191 } |
| 3230 | 3192 |
| 3231 #endif // ENABLE_DEBUGGER_SUPPORT | 3193 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3232 | 3194 |
| 3233 } } // namespace v8::internal | 3195 } } // namespace v8::internal |
| OLD | NEW |