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/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 8928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8939 if (script_obj->type() != i::Script::TYPE_NORMAL) return MaybeLocal<Script>(); | 8939 if (script_obj->type() != i::Script::TYPE_NORMAL) return MaybeLocal<Script>(); |
8940 return ToApiHandle<DebugInterface::Script>( | 8940 return ToApiHandle<DebugInterface::Script>( |
8941 handle_scope.CloseAndEscape(script_obj)); | 8941 handle_scope.CloseAndEscape(script_obj)); |
8942 } | 8942 } |
8943 | 8943 |
8944 void DebugInterface::GetLoadedScripts( | 8944 void DebugInterface::GetLoadedScripts( |
8945 v8::Isolate* v8_isolate, | 8945 v8::Isolate* v8_isolate, |
8946 PersistentValueVector<DebugInterface::Script>& scripts) { | 8946 PersistentValueVector<DebugInterface::Script>& scripts) { |
8947 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); | 8947 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
8948 ENTER_V8(isolate); | 8948 ENTER_V8(isolate); |
8949 { | 8949 i::HandleScope handle_scope(isolate); |
8950 i::DisallowHeapAllocation no_gc; | 8950 i::Handle<i::FixedArray> instances = isolate->debug()->GetLoadedScripts(); |
8951 i::Script::Iterator iterator(isolate); | 8951 for (int i = 0; i < instances->length(); i++) { |
8952 i::Script* script; | 8952 i::Handle<i::Script> script = |
8953 while ((script = iterator.Next())) { | 8953 i::Handle<i::Script>(i::Script::cast(instances->get(i))); |
8954 if (script->type() != i::Script::TYPE_NORMAL) continue; | 8954 if (script->type() != i::Script::TYPE_NORMAL) continue; |
8955 if (script->HasValidSource()) { | 8955 scripts.Append(ToApiHandle<Script>(script)); |
8956 i::HandleScope handle_scope(isolate); | |
8957 i::Handle<i::Script> script_handle(script, isolate); | |
8958 scripts.Append(ToApiHandle<Script>(script_handle)); | |
8959 } | |
8960 } | |
8961 } | 8956 } |
8962 } | 8957 } |
8963 | 8958 |
8964 Local<String> CpuProfileNode::GetFunctionName() const { | 8959 Local<String> CpuProfileNode::GetFunctionName() const { |
8965 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 8960 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
8966 i::Isolate* isolate = node->isolate(); | 8961 i::Isolate* isolate = node->isolate(); |
8967 const i::CodeEntry* entry = node->entry(); | 8962 const i::CodeEntry* entry = node->entry(); |
8968 i::Handle<i::String> name = | 8963 i::Handle<i::String> name = |
8969 isolate->factory()->InternalizeUtf8String(entry->name()); | 8964 isolate->factory()->InternalizeUtf8String(entry->name()); |
8970 if (!entry->has_name_prefix()) { | 8965 if (!entry->has_name_prefix()) { |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9642 Address callback_address = | 9637 Address callback_address = |
9643 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9638 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9644 VMState<EXTERNAL> state(isolate); | 9639 VMState<EXTERNAL> state(isolate); |
9645 ExternalCallbackScope call_scope(isolate, callback_address); | 9640 ExternalCallbackScope call_scope(isolate, callback_address); |
9646 callback(info); | 9641 callback(info); |
9647 } | 9642 } |
9648 | 9643 |
9649 | 9644 |
9650 } // namespace internal | 9645 } // namespace internal |
9651 } // namespace v8 | 9646 } // namespace v8 |
OLD | NEW |