Index: src/runtime/runtime-debug.cc |
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc |
index b65757b2de4957df4070fb4dee50359b995fec1b..c7a8f7f70fbd8114c93672259227059b523f9466 100644 |
--- a/src/runtime/runtime-debug.cc |
+++ b/src/runtime/runtime-debug.cc |
@@ -921,6 +921,11 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeCount) { |
// Check arguments. |
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0); |
+ // Only inspect suspended generator scopes. |
+ if (!gen->is_suspended()) { |
+ return Smi::kZero; |
+ } |
+ |
// Count the visible scopes. |
int n = 0; |
for (ScopeIterator it(isolate, gen); !it.Done(); it.Next()) { |
@@ -942,6 +947,11 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) { |
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0); |
CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); |
+ // Only inspect suspended generator scopes. |
+ if (!gen->is_suspended()) { |
+ return isolate->heap()->undefined_value(); |
+ } |
+ |
// Find the requested scope. |
int n = 0; |
ScopeIterator it(isolate, gen); |