Create result array of %DebugGetLoadedScripts outside the debug context.
authoryangguo <yangguo@chromium.org>
Wed, 8 Apr 2015 11:14:56 +0000 (04:14 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 8 Apr 2015 11:15:02 +0000 (11:15 +0000)
R=jarin@chromium.org
BUG=chromium:474297
LOG=N

Review URL: https://codereview.chromium.org/1062143002

Cr-Commit-Position: refs/heads/master@{#27659}

src/runtime/runtime-debug.cc
test/mjsunit/regress/regress-crbug-474297.js [new file with mode: 0644]

index a3db178..51e7b70 100644 (file)
@@ -2338,9 +2338,12 @@ RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) {
   HandleScope scope(isolate);
   DCHECK(args.length() == 0);
 
-  DebugScope debug_scope(isolate->debug());
-  // Fill the script objects.
-  Handle<FixedArray> instances = isolate->debug()->GetLoadedScripts();
+  Handle<FixedArray> instances;
+  {
+    DebugScope debug_scope(isolate->debug());
+    // Fill the script objects.
+    instances = isolate->debug()->GetLoadedScripts();
+  }
 
   // Convert the script objects to proper JS objects.
   for (int i = 0; i < instances->length(); i++) {
diff --git a/test/mjsunit/regress/regress-crbug-474297.js b/test/mjsunit/regress/regress-crbug-474297.js
new file mode 100644 (file)
index 0000000..3169c28
--- /dev/null
@@ -0,0 +1,7 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --gc-interval=33 --expose-gc --allow-natives-syntax
+
+%DebugGetLoadedScripts();