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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 } | 709 } |
710 | 710 |
711 void FunctionDone() { | 711 void FunctionDone() { |
712 HandleScope scope(isolate()); | 712 HandleScope scope(isolate()); |
713 FunctionInfoWrapper info = FunctionInfoWrapper::cast( | 713 FunctionInfoWrapper info = FunctionInfoWrapper::cast( |
714 *JSReceiver::GetElement(isolate(), result_, current_parent_index_) | 714 *JSReceiver::GetElement(isolate(), result_, current_parent_index_) |
715 .ToHandleChecked()); | 715 .ToHandleChecked()); |
716 current_parent_index_ = info.GetParentIndex(); | 716 current_parent_index_ = info.GetParentIndex(); |
717 } | 717 } |
718 | 718 |
719 // Saves only function code, because for a script function we | |
720 // may never create a SharedFunctionInfo object. | |
721 void FunctionCode(Handle<Code> function_code) { | |
722 FunctionInfoWrapper info = FunctionInfoWrapper::cast( | |
723 *JSReceiver::GetElement(isolate(), result_, current_parent_index_) | |
724 .ToHandleChecked()); | |
725 info.SetFunctionCode(function_code, | |
726 Handle<HeapObject>(isolate()->heap()->null_value())); | |
727 } | |
728 | |
729 // Saves full information about a function: its code, its scope info | 719 // Saves full information about a function: its code, its scope info |
730 // and a SharedFunctionInfo object. | 720 // and a SharedFunctionInfo object. |
731 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope, | 721 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope, |
732 Zone* zone) { | 722 Zone* zone) { |
733 if (!shared->IsSharedFunctionInfo()) { | 723 if (!shared->IsSharedFunctionInfo()) { |
734 return; | 724 return; |
735 } | 725 } |
736 FunctionInfoWrapper info = FunctionInfoWrapper::cast( | 726 FunctionInfoWrapper info = FunctionInfoWrapper::cast( |
737 *JSReceiver::GetElement(isolate(), result_, current_parent_index_) | 727 *JSReceiver::GetElement(isolate(), result_, current_parent_index_) |
738 .ToHandleChecked()); | 728 .ToHandleChecked()); |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 void LiveEditFunctionTracker::RecordFunctionInfo( | 2013 void LiveEditFunctionTracker::RecordFunctionInfo( |
2024 Handle<SharedFunctionInfo> info, FunctionLiteral* lit, | 2014 Handle<SharedFunctionInfo> info, FunctionLiteral* lit, |
2025 Zone* zone) { | 2015 Zone* zone) { |
2026 if (isolate_->active_function_info_listener() != NULL) { | 2016 if (isolate_->active_function_info_listener() != NULL) { |
2027 isolate_->active_function_info_listener()->FunctionInfo(info, lit->scope(), | 2017 isolate_->active_function_info_listener()->FunctionInfo(info, lit->scope(), |
2028 zone); | 2018 zone); |
2029 } | 2019 } |
2030 } | 2020 } |
2031 | 2021 |
2032 | 2022 |
2033 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { | |
2034 isolate_->active_function_info_listener()->FunctionCode(code); | |
2035 } | |
2036 | |
2037 | |
2038 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2023 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
2039 return isolate->active_function_info_listener() != NULL; | 2024 return isolate->active_function_info_listener() != NULL; |
2040 } | 2025 } |
2041 | 2026 |
2042 } // namespace internal | 2027 } // namespace internal |
2043 } // namespace v8 | 2028 } // namespace v8 |
OLD | NEW |