Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index ad41d819b7f094ddda7834f5ca57377ae8184f03..04f17656f7fade2991fc56959480884b361c6144 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -8946,13 +8946,19 @@ void DebugInterface::GetLoadedScripts( |
PersistentValueVector<DebugInterface::Script>& scripts) { |
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
ENTER_V8(isolate); |
- i::HandleScope handle_scope(isolate); |
- i::Handle<i::FixedArray> instances = isolate->debug()->GetLoadedScripts(); |
- for (int i = 0; i < instances->length(); i++) { |
- i::Handle<i::Script> script = |
- i::Handle<i::Script>(i::Script::cast(instances->get(i))); |
- if (script->type() != i::Script::TYPE_NORMAL) continue; |
- scripts.Append(ToApiHandle<Script>(script)); |
+ i::Factory* factory = isolate->factory(); |
+ { |
+ i::DisallowHeapAllocation no_gc; |
kozy
2016/11/03 01:23:36
I'm just wondering. What this disallow heap alloca
Yang
2016/11/03 07:47:09
The DisallowHeapAllocation scope causes assertion
|
+ i::Script::Iterator iterator(isolate); |
+ i::Script* script; |
+ while ((script = iterator.Next())) { |
+ if (script->type() != i::Script::TYPE_NORMAL) continue; |
+ if (script->HasValidSource()) { |
+ i::HandleScope handle_scope(isolate); |
+ i::Handle<i::Script> script_handle(script, isolate); |
+ scripts.Append(ToApiHandle<Script>(script_handle)); |
+ } |
+ } |
} |
} |