| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/debug/liveedit.h" | 5 #include "src/debug/liveedit.h" |
| 6 | 6 |
| 7 #include "src/ast/scopeinfo.h" | 7 #include "src/ast/scopeinfo.h" |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 Handle<Code> old_code(shared_info->code()); | 1114 Handle<Code> old_code(shared_info->code()); |
| 1115 if (shared_info->HasBytecodeArray()) { | 1115 if (shared_info->HasBytecodeArray()) { |
| 1116 // The old code is interpreted. If we clear the bytecode array, the | 1116 // The old code is interpreted. If we clear the bytecode array, the |
| 1117 // interpreter entry trampoline will self-heal and go to compiled code. | 1117 // interpreter entry trampoline will self-heal and go to compiled code. |
| 1118 shared_info->ClearBytecodeArray(); | 1118 shared_info->ClearBytecodeArray(); |
| 1119 shared_info->ReplaceCode(*new_code); | 1119 shared_info->ReplaceCode(*new_code); |
| 1120 } else { | 1120 } else { |
| 1121 DCHECK(old_code->kind() == Code::FUNCTION); | 1121 DCHECK(old_code->kind() == Code::FUNCTION); |
| 1122 ReplaceCodeObject(old_code, new_code); | 1122 ReplaceCodeObject(old_code, new_code); |
| 1123 } | 1123 } |
| 1124 if (shared_info->HasDebugInfo()) { |
| 1125 // Existing break points will be re-applied. Reset the debug info here. |
| 1126 isolate->debug()->RemoveDebugInfoAndClearFromShared( |
| 1127 handle(shared_info->GetDebugInfo())); |
| 1128 } |
| 1124 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); | 1129 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); |
| 1125 if (code_scope_info->IsFixedArray()) { | 1130 if (code_scope_info->IsFixedArray()) { |
| 1126 shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info)); | 1131 shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info)); |
| 1127 } | 1132 } |
| 1128 shared_info->DisableOptimization(kLiveEdit); | 1133 shared_info->DisableOptimization(kLiveEdit); |
| 1129 // Update the type feedback vector, if needed. | 1134 // Update the type feedback vector, if needed. |
| 1130 MaybeHandle<TypeFeedbackVector> feedback_vector = | 1135 MaybeHandle<TypeFeedbackVector> feedback_vector = |
| 1131 compile_info_wrapper.GetFeedbackVector(); | 1136 compile_info_wrapper.GetFeedbackVector(); |
| 1132 if (!feedback_vector.is_null()) { | 1137 if (!feedback_vector.is_null()) { |
| 1133 shared_info->set_feedback_vector(*feedback_vector.ToHandleChecked()); | 1138 shared_info->set_feedback_vector(*feedback_vector.ToHandleChecked()); |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1813 const char* error_message = | 1818 const char* error_message = |
| 1814 DropFrames(frames, top_frame_index, bottom_js_frame_index, &drop_mode); | 1819 DropFrames(frames, top_frame_index, bottom_js_frame_index, &drop_mode); |
| 1815 | 1820 |
| 1816 if (error_message != NULL) { | 1821 if (error_message != NULL) { |
| 1817 return error_message; | 1822 return error_message; |
| 1818 } | 1823 } |
| 1819 | 1824 |
| 1820 // Adjust break_frame after some frames has been dropped. | 1825 // Adjust break_frame after some frames has been dropped. |
| 1821 StackFrame::Id new_id = StackFrame::NO_ID; | 1826 StackFrame::Id new_id = StackFrame::NO_ID; |
| 1822 for (int i = bottom_js_frame_index + 1; i < frames.length(); i++) { | 1827 for (int i = bottom_js_frame_index + 1; i < frames.length(); i++) { |
| 1823 if (frames[i]->type() == StackFrame::JAVA_SCRIPT) { | 1828 if (frames[i]->type() == StackFrame::JAVA_SCRIPT || |
| 1829 frames[i]->type() == StackFrame::INTERPRETED) { |
| 1824 new_id = frames[i]->id(); | 1830 new_id = frames[i]->id(); |
| 1825 break; | 1831 break; |
| 1826 } | 1832 } |
| 1827 } | 1833 } |
| 1828 debug->FramesHaveBeenDropped(new_id, drop_mode); | 1834 debug->FramesHaveBeenDropped(new_id, drop_mode); |
| 1829 return NULL; | 1835 return NULL; |
| 1830 } | 1836 } |
| 1831 | 1837 |
| 1832 | 1838 |
| 1833 // Fills result array with statuses of functions. Modifies the stack | 1839 // Fills result array with statuses of functions. Modifies the stack |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 } | 2064 } |
| 2059 } | 2065 } |
| 2060 | 2066 |
| 2061 | 2067 |
| 2062 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2068 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
| 2063 return isolate->active_function_info_listener() != NULL; | 2069 return isolate->active_function_info_listener() != NULL; |
| 2064 } | 2070 } |
| 2065 | 2071 |
| 2066 } // namespace internal | 2072 } // namespace internal |
| 2067 } // namespace v8 | 2073 } // namespace v8 |
| OLD | NEW |