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/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 script->set_source(*original_source); | 893 script->set_source(*original_source); |
894 | 894 |
895 if (rethrow_exception.is_null()) { | 895 if (rethrow_exception.is_null()) { |
896 return listener.GetResult(); | 896 return listener.GetResult(); |
897 } else { | 897 } else { |
898 return isolate->Throw<JSArray>(rethrow_exception); | 898 return isolate->Throw<JSArray>(rethrow_exception); |
899 } | 899 } |
900 } | 900 } |
901 | 901 |
902 | 902 |
903 void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) { | |
904 Isolate* isolate = array->GetIsolate(); | |
905 HandleScope scope(isolate); | |
906 int len = GetArrayLength(array); | |
907 for (int i = 0; i < len; i++) { | |
908 Handle<SharedFunctionInfo> info( | |
909 SharedFunctionInfo::cast( | |
910 *Object::GetElement(isolate, array, i).ToHandleChecked())); | |
911 SharedInfoWrapper info_wrapper = SharedInfoWrapper::Create(isolate); | |
912 Handle<String> name_handle(String::cast(info->name())); | |
913 info_wrapper.SetProperties(name_handle, info->start_position(), | |
914 info->end_position(), info); | |
915 SetElementSloppy(array, i, info_wrapper.GetJSArray()); | |
916 } | |
917 } | |
918 | |
919 | |
920 // Visitor that finds all references to a particular code object, | 903 // Visitor that finds all references to a particular code object, |
921 // including "CODE_TARGET" references in other code objects and replaces | 904 // including "CODE_TARGET" references in other code objects and replaces |
922 // them on the fly. | 905 // them on the fly. |
923 class ReplacingVisitor : public ObjectVisitor { | 906 class ReplacingVisitor : public ObjectVisitor { |
924 public: | 907 public: |
925 explicit ReplacingVisitor(Code* original, Code* substitution) | 908 explicit ReplacingVisitor(Code* original, Code* substitution) |
926 : original_(original), substitution_(substitution) { | 909 : original_(original), substitution_(substitution) { |
927 } | 910 } |
928 | 911 |
929 virtual void VisitPointers(Object** start, Object** end) { | 912 virtual void VisitPointers(Object** start, Object** end) { |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 isolate_->active_function_info_listener()->FunctionCode(code); | 2002 isolate_->active_function_info_listener()->FunctionCode(code); |
2020 } | 2003 } |
2021 | 2004 |
2022 | 2005 |
2023 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 2006 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
2024 return isolate->active_function_info_listener() != NULL; | 2007 return isolate->active_function_info_listener() != NULL; |
2025 } | 2008 } |
2026 | 2009 |
2027 } // namespace internal | 2010 } // namespace internal |
2028 } // namespace v8 | 2011 } // namespace v8 |
OLD | NEW |