Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index b421e06e7d478734307b28d5c140c51f6ed6fd15..ad41d819b7f094ddda7834f5ca57377ae8184f03 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -8946,18 +8946,13 @@ |
PersistentValueVector<DebugInterface::Script>& scripts) { |
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); |
ENTER_V8(isolate); |
- { |
- i::DisallowHeapAllocation no_gc; |
- 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)); |
- } |
- } |
+ 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)); |
} |
} |