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 8929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 i::HandleScope handle_scope(isolate); |
8950 i::Handle<i::FixedArray> instances = isolate->debug()->GetLoadedScripts(); | 8950 i::Factory* factory = isolate->factory(); |
8951 for (int i = 0; i < instances->length(); i++) { | 8951 if (!factory->script_list()->IsWeakFixedArray()) return; |
8952 i::Handle<i::Script> script = | 8952 i::Handle<i::WeakFixedArray> array = |
8953 i::Handle<i::Script>(i::Script::cast(instances->get(i))); | 8953 i::Handle<i::WeakFixedArray>::cast(factory->script_list()); |
8954 if (script->type() != i::Script::TYPE_NORMAL) continue; | 8954 { |
8955 scripts.Append(ToApiHandle<Script>(script)); | 8955 i::Script::Iterator iterator(isolate); |
8956 i::Handle<i::Script> script; | |
8957 while (!(script = i::Handle<i::Script>(iterator.Next())).is_null()) { | |
kozy
2016/10/31 14:59:11
I think that i::Handle<i::Script>(Object*) tries t
Yang
2016/11/02 12:25:55
Good point. I changed the code after running tests
| |
8958 if (script->type() != i::Script::TYPE_NORMAL) continue; | |
8959 if (script->HasValidSource()) scripts.Append(ToApiHandle<Script>(script)); | |
8960 } | |
8956 } | 8961 } |
8957 } | 8962 } |
8958 | 8963 |
8959 Local<String> CpuProfileNode::GetFunctionName() const { | 8964 Local<String> CpuProfileNode::GetFunctionName() const { |
8960 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 8965 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
8961 i::Isolate* isolate = node->isolate(); | 8966 i::Isolate* isolate = node->isolate(); |
8962 const i::CodeEntry* entry = node->entry(); | 8967 const i::CodeEntry* entry = node->entry(); |
8963 i::Handle<i::String> name = | 8968 i::Handle<i::String> name = |
8964 isolate->factory()->InternalizeUtf8String(entry->name()); | 8969 isolate->factory()->InternalizeUtf8String(entry->name()); |
8965 if (!entry->has_name_prefix()) { | 8970 if (!entry->has_name_prefix()) { |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9637 Address callback_address = | 9642 Address callback_address = |
9638 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9643 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9639 VMState<EXTERNAL> state(isolate); | 9644 VMState<EXTERNAL> state(isolate); |
9640 ExternalCallbackScope call_scope(isolate, callback_address); | 9645 ExternalCallbackScope call_scope(isolate, callback_address); |
9641 callback(info); | 9646 callback(info); |
9642 } | 9647 } |
9643 | 9648 |
9644 | 9649 |
9645 } // namespace internal | 9650 } // namespace internal |
9646 } // namespace v8 | 9651 } // namespace v8 |
OLD | NEW |