| 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 i::HandleScope handle_scope(isolate); | 8949 // TODO(kozyatinskiy): remove this GC once tests are dealt with. |
| 8950 i::Handle<i::FixedArray> instances = isolate->debug()->GetLoadedScripts(); | 8950 isolate->heap()->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, |
| 8951 for (int i = 0; i < instances->length(); i++) { | 8951 i::GarbageCollectionReason::kDebugger); |
| 8952 i::Handle<i::Script> script = | 8952 { |
| 8953 i::Handle<i::Script>(i::Script::cast(instances->get(i))); | 8953 i::DisallowHeapAllocation no_gc; |
| 8954 if (script->type() != i::Script::TYPE_NORMAL) continue; | 8954 i::Script::Iterator iterator(isolate); |
| 8955 scripts.Append(ToApiHandle<Script>(script)); | 8955 i::Script* script; |
| 8956 while ((script = iterator.Next())) { |
| 8957 if (script->type() != i::Script::TYPE_NORMAL) continue; |
| 8958 if (script->HasValidSource()) { |
| 8959 i::HandleScope handle_scope(isolate); |
| 8960 i::Handle<i::Script> script_handle(script, isolate); |
| 8961 scripts.Append(ToApiHandle<Script>(script_handle)); |
| 8962 } |
| 8963 } |
| 8956 } | 8964 } |
| 8957 } | 8965 } |
| 8958 | 8966 |
| 8959 Local<String> CpuProfileNode::GetFunctionName() const { | 8967 Local<String> CpuProfileNode::GetFunctionName() const { |
| 8960 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 8968 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
| 8961 i::Isolate* isolate = node->isolate(); | 8969 i::Isolate* isolate = node->isolate(); |
| 8962 const i::CodeEntry* entry = node->entry(); | 8970 const i::CodeEntry* entry = node->entry(); |
| 8963 i::Handle<i::String> name = | 8971 i::Handle<i::String> name = |
| 8964 isolate->factory()->InternalizeUtf8String(entry->name()); | 8972 isolate->factory()->InternalizeUtf8String(entry->name()); |
| 8965 if (!entry->has_name_prefix()) { | 8973 if (!entry->has_name_prefix()) { |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9637 Address callback_address = | 9645 Address callback_address = |
| 9638 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9646 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 9639 VMState<EXTERNAL> state(isolate); | 9647 VMState<EXTERNAL> state(isolate); |
| 9640 ExternalCallbackScope call_scope(isolate, callback_address); | 9648 ExternalCallbackScope call_scope(isolate, callback_address); |
| 9641 callback(info); | 9649 callback(info); |
| 9642 } | 9650 } |
| 9643 | 9651 |
| 9644 | 9652 |
| 9645 } // namespace internal | 9653 } // namespace internal |
| 9646 } // namespace v8 | 9654 } // namespace v8 |
| OLD | NEW |