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/debug.h" | 5 #include "src/debug/debug.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1887 void Debug::OnCompileError(Handle<Script> script) { | 1887 void Debug::OnCompileError(Handle<Script> script) { |
1888 ProcessCompileEvent(v8::CompileError, script); | 1888 ProcessCompileEvent(v8::CompileError, script); |
1889 } | 1889 } |
1890 | 1890 |
1891 | 1891 |
1892 // Handle debugger actions when a new script is compiled. | 1892 // Handle debugger actions when a new script is compiled. |
1893 void Debug::OnAfterCompile(Handle<Script> script) { | 1893 void Debug::OnAfterCompile(Handle<Script> script) { |
1894 ProcessCompileEvent(v8::AfterCompile, script); | 1894 ProcessCompileEvent(v8::AfterCompile, script); |
1895 } | 1895 } |
1896 | 1896 |
1897 void Debug::OnModuleResolved(Handle<Module> referer, Handle<Module> requested, | |
1898 Handle<String> specifier) { | |
1899 if (!debug_delegate_) return; | |
1900 if (!referer->script()->IsScript() || !requested->script()->IsScript()) | |
1901 return; | |
neis
2017/02/01 13:38:55
Should this ever happen? See comment in objects.h.
kozy
2017/02/01 16:39:25
Done.
| |
1902 debug_delegate_->ModuleResolved( | |
1903 ToApiHandle<debug::Script>(handle(Script::cast(referer->script()))), | |
1904 ToApiHandle<debug::Script>(handle(Script::cast(requested->script()))), | |
1905 Utils::ToLocal(specifier)); | |
1906 } | |
1907 | |
1908 void Debug::ReportExistingModules() { | |
1909 if (!debug_delegate_) return; | |
1910 HandleScope handle_scope(isolate_); | |
1911 HeapIterator iterator(isolate_->heap()); | |
1912 HeapObject* obj; | |
1913 while ((obj = iterator.next())) { | |
1914 if (!obj->IsModule()) continue; | |
1915 Handle<Module> module(Module::cast(obj)); | |
1916 if (!module->evaluated()) continue; | |
1917 Handle<FixedArray> requested_modules(module->requested_modules(), isolate_); | |
1918 Handle<FixedArray> module_requests(module->info()->module_requests(), | |
1919 isolate_); | |
1920 for (int j = 0, length = requested_modules->length(); j < length; ++j) { | |
1921 Handle<Module> import(i::Module::cast(requested_modules->get(j)), | |
1922 isolate_); | |
1923 Handle<String> request(i::String::cast(module_requests->get(j)), | |
1924 isolate_); | |
1925 OnModuleResolved(module, import, request); | |
1926 } | |
1927 } | |
1928 } | |
1929 | |
1897 namespace { | 1930 namespace { |
1898 struct CollectedCallbackData { | 1931 struct CollectedCallbackData { |
1899 Object** location; | 1932 Object** location; |
1900 int id; | 1933 int id; |
1901 Debug* debug; | 1934 Debug* debug; |
1902 Isolate* isolate; | 1935 Isolate* isolate; |
1903 | 1936 |
1904 CollectedCallbackData(Object** location, int id, Debug* debug, | 1937 CollectedCallbackData(Object** location, int id, Debug* debug, |
1905 Isolate* isolate) | 1938 Isolate* isolate) |
1906 : location(location), id(id), debug(debug), isolate(isolate) {} | 1939 : location(location), id(id), debug(debug), isolate(isolate) {} |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2428 return v8::Utils::ToLocal(callback_data_); | 2461 return v8::Utils::ToLocal(callback_data_); |
2429 } | 2462 } |
2430 | 2463 |
2431 | 2464 |
2432 v8::Isolate* EventDetailsImpl::GetIsolate() const { | 2465 v8::Isolate* EventDetailsImpl::GetIsolate() const { |
2433 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); | 2466 return reinterpret_cast<v8::Isolate*>(exec_state_->GetIsolate()); |
2434 } | 2467 } |
2435 | 2468 |
2436 } // namespace internal | 2469 } // namespace internal |
2437 } // namespace v8 | 2470 } // namespace v8 |
OLD | NEW |