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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 Smi::FromInt( | 1620 Smi::FromInt( |
1621 LiveEdit::FUNCTION_BLOCKED_NO_NEW_TARGET_ON_RESTART), | 1621 LiveEdit::FUNCTION_BLOCKED_NO_NEW_TARGET_ON_RESTART), |
1622 isolate)); | 1622 isolate)); |
1623 return true; | 1623 return true; |
1624 } | 1624 } |
1625 return false; | 1625 return false; |
1626 } | 1626 } |
1627 return false; | 1627 return false; |
1628 } | 1628 } |
1629 | 1629 |
| 1630 void set_status(LiveEdit::FunctionPatchabilityStatus status) { |
| 1631 Isolate* isolate = old_shared_array_->GetIsolate(); |
| 1632 int len = GetArrayLength(old_shared_array_); |
| 1633 for (int i = 0; i < len; ++i) { |
| 1634 Handle<Object> old_element = |
| 1635 JSReceiver::GetElement(isolate, result_, i).ToHandleChecked(); |
| 1636 if (!old_element->IsSmi() || |
| 1637 Smi::cast(*old_element)->value() == |
| 1638 LiveEdit::FUNCTION_AVAILABLE_FOR_PATCH) { |
| 1639 SetElementSloppy(result_, i, |
| 1640 Handle<Smi>(Smi::FromInt(status), isolate)); |
| 1641 } |
| 1642 } |
| 1643 } |
| 1644 |
1630 private: | 1645 private: |
1631 Handle<JSArray> old_shared_array_; | 1646 Handle<JSArray> old_shared_array_; |
1632 Handle<JSArray> new_shared_array_; | 1647 Handle<JSArray> new_shared_array_; |
1633 Handle<JSArray> result_; | 1648 Handle<JSArray> result_; |
1634 }; | 1649 }; |
1635 | 1650 |
1636 | 1651 |
1637 // Drops all call frame matched by target and all frames above them. | 1652 // Drops all call frame matched by target and all frames above them. |
1638 template <typename TARGET> | 1653 template <typename TARGET> |
1639 static const char* DropActivationsInActiveThreadImpl(Isolate* isolate, | 1654 static const char* DropActivationsInActiveThreadImpl(Isolate* isolate, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 // There is a C or generator frame on stack. We can't drop C frames, and we | 1712 // There is a C or generator frame on stack. We can't drop C frames, and we |
1698 // can't restart generators. Check that there are no target frames below | 1713 // can't restart generators. Check that there are no target frames below |
1699 // them. | 1714 // them. |
1700 for (; frame_index < frames.length(); frame_index++) { | 1715 for (; frame_index < frames.length(); frame_index++) { |
1701 StackFrame* frame = frames[frame_index]; | 1716 StackFrame* frame = frames[frame_index]; |
1702 if (frame->is_java_script()) { | 1717 if (frame->is_java_script()) { |
1703 if (target.MatchActivation(frame, non_droppable_reason)) { | 1718 if (target.MatchActivation(frame, non_droppable_reason)) { |
1704 // Fail. | 1719 // Fail. |
1705 return NULL; | 1720 return NULL; |
1706 } | 1721 } |
| 1722 if (non_droppable_reason == |
| 1723 LiveEdit::FUNCTION_BLOCKED_UNDER_GENERATOR && |
| 1724 !target_frame_found) { |
| 1725 // Fail. |
| 1726 target.set_status(non_droppable_reason); |
| 1727 return NULL; |
| 1728 } |
1707 } | 1729 } |
1708 } | 1730 } |
1709 } | 1731 } |
1710 | 1732 |
1711 // We cannot restart a frame that uses new.target. | 1733 // We cannot restart a frame that uses new.target. |
1712 if (target.FrameUsesNewTarget(frames[bottom_js_frame_index])) return NULL; | 1734 if (target.FrameUsesNewTarget(frames[bottom_js_frame_index])) return NULL; |
1713 | 1735 |
1714 if (!do_drop) { | 1736 if (!do_drop) { |
1715 // We are in check-only mode. | 1737 // We are in check-only mode. |
1716 return NULL; | 1738 return NULL; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 scope_info_length++; | 2065 scope_info_length++; |
2044 | 2066 |
2045 current_scope = current_scope->outer_scope(); | 2067 current_scope = current_scope->outer_scope(); |
2046 } | 2068 } |
2047 | 2069 |
2048 return scope_info_list; | 2070 return scope_info_list; |
2049 } | 2071 } |
2050 | 2072 |
2051 } // namespace internal | 2073 } // namespace internal |
2052 } // namespace v8 | 2074 } // namespace v8 |
OLD | NEW |