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 | 5 |
6 #include "src/v8.h" | 6 #include "src/v8.h" |
7 | 7 |
8 #include "src/liveedit.h" | 8 #include "src/liveedit.h" |
9 | 9 |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 const char* GetNotFoundMessage() const { | 1741 const char* GetNotFoundMessage() const { |
1742 return NULL; | 1742 return NULL; |
1743 } | 1743 } |
1744 private: | 1744 private: |
1745 Handle<JSArray> m_shared_info_array; | 1745 Handle<JSArray> m_shared_info_array; |
1746 Handle<JSArray> m_result; | 1746 Handle<JSArray> m_result; |
1747 }; | 1747 }; |
1748 | 1748 |
1749 | 1749 |
1750 // Drops all call frame matched by target and all frames above them. | 1750 // Drops all call frame matched by target and all frames above them. |
1751 template<typename TARGET> | 1751 template <typename TARGET> |
1752 static const char* DropActivationsInActiveThreadImpl( | 1752 static const char* DropActivationsInActiveThreadImpl(Isolate* isolate, |
1753 Isolate* isolate, | 1753 TARGET& target, // NOLINT |
1754 TARGET& target, // NOLINT | 1754 bool do_drop) { |
1755 bool do_drop) { | |
1756 Debug* debug = isolate->debug(); | 1755 Debug* debug = isolate->debug(); |
1757 Zone zone(isolate); | 1756 Zone zone; |
1758 Vector<StackFrame*> frames = CreateStackMap(isolate, &zone); | 1757 Vector<StackFrame*> frames = CreateStackMap(isolate, &zone); |
1759 | 1758 |
1760 | 1759 |
1761 int top_frame_index = -1; | 1760 int top_frame_index = -1; |
1762 int frame_index = 0; | 1761 int frame_index = 0; |
1763 for (; frame_index < frames.length(); frame_index++) { | 1762 for (; frame_index < frames.length(); frame_index++) { |
1764 StackFrame* frame = frames[frame_index]; | 1763 StackFrame* frame = frames[frame_index]; |
1765 if (frame->id() == debug->break_frame_id()) { | 1764 if (frame->id() == debug->break_frame_id()) { |
1766 top_frame_index = frame_index; | 1765 top_frame_index = frame_index; |
1767 break; | 1766 break; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 new_id, drop_mode, restarter_frame_function_pointer); | 1850 new_id, drop_mode, restarter_frame_function_pointer); |
1852 return NULL; | 1851 return NULL; |
1853 } | 1852 } |
1854 | 1853 |
1855 | 1854 |
1856 // Fills result array with statuses of functions. Modifies the stack | 1855 // Fills result array with statuses of functions. Modifies the stack |
1857 // removing all listed function if possible and if do_drop is true. | 1856 // removing all listed function if possible and if do_drop is true. |
1858 static const char* DropActivationsInActiveThread( | 1857 static const char* DropActivationsInActiveThread( |
1859 Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop) { | 1858 Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop) { |
1860 MultipleFunctionTarget target(shared_info_array, result); | 1859 MultipleFunctionTarget target(shared_info_array, result); |
| 1860 Isolate* isolate = shared_info_array->GetIsolate(); |
1861 | 1861 |
1862 const char* message = DropActivationsInActiveThreadImpl( | 1862 const char* message = |
1863 shared_info_array->GetIsolate(), target, do_drop); | 1863 DropActivationsInActiveThreadImpl(isolate, target, do_drop); |
1864 if (message) { | 1864 if (message) { |
1865 return message; | 1865 return message; |
1866 } | 1866 } |
1867 | 1867 |
1868 Isolate* isolate = shared_info_array->GetIsolate(); | |
1869 int array_len = GetArrayLength(shared_info_array); | 1868 int array_len = GetArrayLength(shared_info_array); |
1870 | 1869 |
1871 // Replace "blocked on active" with "replaced on active" status. | 1870 // Replace "blocked on active" with "replaced on active" status. |
1872 for (int i = 0; i < array_len; i++) { | 1871 for (int i = 0; i < array_len; i++) { |
1873 Handle<Object> obj = | 1872 Handle<Object> obj = |
1874 Object::GetElement(isolate, result, i).ToHandleChecked(); | 1873 Object::GetElement(isolate, result, i).ToHandleChecked(); |
1875 if (*obj == Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) { | 1874 if (*obj == Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) { |
1876 Handle<Object> replaced( | 1875 Handle<Object> replaced( |
1877 Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK), isolate); | 1876 Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK), isolate); |
1878 SetElementSloppy(result, i, replaced); | 1877 SetElementSloppy(result, i, replaced); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2020 JavaScriptFrame* m_frame; | 2019 JavaScriptFrame* m_frame; |
2021 LiveEdit::FunctionPatchabilityStatus m_saved_status; | 2020 LiveEdit::FunctionPatchabilityStatus m_saved_status; |
2022 }; | 2021 }; |
2023 | 2022 |
2024 | 2023 |
2025 // Finds a drops required frame and all frames above. | 2024 // Finds a drops required frame and all frames above. |
2026 // Returns error message or NULL. | 2025 // Returns error message or NULL. |
2027 const char* LiveEdit::RestartFrame(JavaScriptFrame* frame) { | 2026 const char* LiveEdit::RestartFrame(JavaScriptFrame* frame) { |
2028 SingleFrameTarget target(frame); | 2027 SingleFrameTarget target(frame); |
2029 | 2028 |
2030 const char* result = DropActivationsInActiveThreadImpl( | 2029 const char* result = |
2031 frame->isolate(), target, true); | 2030 DropActivationsInActiveThreadImpl(frame->isolate(), target, true); |
2032 if (result != NULL) { | 2031 if (result != NULL) { |
2033 return result; | 2032 return result; |
2034 } | 2033 } |
2035 if (target.saved_status() == LiveEdit::FUNCTION_BLOCKED_UNDER_NATIVE_CODE) { | 2034 if (target.saved_status() == LiveEdit::FUNCTION_BLOCKED_UNDER_NATIVE_CODE) { |
2036 return "Function is blocked under native code"; | 2035 return "Function is blocked under native code"; |
2037 } | 2036 } |
2038 if (target.saved_status() == LiveEdit::FUNCTION_BLOCKED_UNDER_GENERATOR) { | 2037 if (target.saved_status() == LiveEdit::FUNCTION_BLOCKED_UNDER_GENERATOR) { |
2039 return "Function is blocked under a generator activation"; | 2038 return "Function is blocked under a generator activation"; |
2040 } | 2039 } |
2041 return NULL; | 2040 return NULL; |
(...skipping 29 matching lines...) Expand all Loading... |
2071 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { | 2070 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { |
2072 isolate_->active_function_info_listener()->FunctionCode(code); | 2071 isolate_->active_function_info_listener()->FunctionCode(code); |
2073 } | 2072 } |
2074 | 2073 |
2075 | 2074 |
2076 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2075 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
2077 return isolate->active_function_info_listener() != NULL; | 2076 return isolate->active_function_info_listener() != NULL; |
2078 } | 2077 } |
2079 | 2078 |
2080 } } // namespace v8::internal | 2079 } } // namespace v8::internal |
OLD | NEW |