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

Side by Side Diff: src/ast/scopes.cc

Issue 2577043004: Include temporary variables in --print-scopes output (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 Indent(n1, "// "); 1532 Indent(n1, "// ");
1533 PrintF("%d heap slots\n", num_heap_slots_); 1533 PrintF("%d heap slots\n", num_heap_slots_);
1534 } 1534 }
1535 1535
1536 // Print locals. 1536 // Print locals.
1537 if (function != nullptr) { 1537 if (function != nullptr) {
1538 Indent(n1, "// function var:\n"); 1538 Indent(n1, "// function var:\n");
1539 PrintVar(n1, function); 1539 PrintVar(n1, function);
1540 } 1540 }
1541 1541
1542 // Print temporaries.
1543 {
1544 bool printed_header = false;
1545 for (Variable* local : locals_) {
1546 if (local->mode() != TEMPORARY) continue;
1547 if (!printed_header) {
1548 printed_header = true;
1549 Indent(n1, "// temporary vars:\n");
1550 }
1551 PrintVar(n1, local);
1552 }
1553 }
1554
1542 if (variables_.occupancy() > 0) { 1555 if (variables_.occupancy() > 0) {
1543 PrintMap(n1, "// local vars:\n", &variables_, true, function); 1556 PrintMap(n1, "// local vars:\n", &variables_, true, function);
1544 PrintMap(n1, "// dynamic vars:\n", &variables_, false, function); 1557 PrintMap(n1, "// dynamic vars:\n", &variables_, false, function);
1545 } 1558 }
1546 1559
1547 // Print inner scopes (disable by providing negative n). 1560 // Print inner scopes (disable by providing negative n).
1548 if (n >= 0) { 1561 if (n >= 0) {
1549 for (Scope* scope = inner_scope_; scope != nullptr; 1562 for (Scope* scope = inner_scope_; scope != nullptr;
1550 scope = scope->sibling_) { 1563 scope = scope->sibling_) {
1551 PrintF("\n"); 1564 PrintF("\n");
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 Variable* function = 2125 Variable* function =
2113 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 2126 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
2114 bool is_function_var_in_context = 2127 bool is_function_var_in_context =
2115 function != nullptr && function->IsContextSlot(); 2128 function != nullptr && function->IsContextSlot();
2116 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 2129 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
2117 (is_function_var_in_context ? 1 : 0); 2130 (is_function_var_in_context ? 1 : 0);
2118 } 2131 }
2119 2132
2120 } // namespace internal 2133 } // namespace internal
2121 } // namespace v8 2134 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698