Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Unified Diff: src/runtime/runtime-debug.cc

Issue 2245603002: Handle missing context when getting frame details (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Correctly set local_count Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5279.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-debug.cc
diff --git a/src/runtime/runtime-debug.cc b/src/runtime/runtime-debug.cc
index a47e3215aae027c6c11f24483f7ba2019f34653e..a8c465a38064a6d8da4f2c9fa05393ffc1a0e5c2 100644
--- a/src/runtime/runtime-debug.cc
+++ b/src/runtime/runtime-debug.cc
@@ -606,8 +606,12 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
DCHECK(*scope_info != ScopeInfo::Empty(isolate));
// Get the locals names and values into a temporary array.
- int local_count = scope_info->LocalCount();
- for (int slot = 0; slot < scope_info->LocalCount(); ++slot) {
+ Handle<Object> maybe_context = frame_inspector.GetContext();
+ const int local_count_with_synthetic = maybe_context->IsContext()
+ ? scope_info->LocalCount()
+ : scope_info->StackLocalCount();
+ int local_count = local_count_with_synthetic;
+ for (int slot = 0; slot < local_count_with_synthetic; ++slot) {
// Hide compiler-introduced temporary variables, whether on the stack or on
// the context.
if (ScopeInfo::VariableIsSynthetic(scope_info->LocalName(slot))) {
@@ -633,8 +637,9 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
}
if (locals.length() < local_count * 2) {
// Get the context containing declarations.
- Handle<Context> context(
- Handle<Context>::cast(frame_inspector.GetContext())->closure_context());
+ DCHECK(maybe_context->IsContext());
+ Handle<Context> context(Context::cast(*maybe_context)->closure_context());
+
for (; i < scope_info->LocalCount(); ++i) {
Handle<String> name(scope_info->LocalName(i));
if (ScopeInfo::VariableIsSynthetic(*name)) continue;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5279.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698