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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 1404793004: Add support for calculating a scopes maximum nested context chain. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/scopes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/interpreter/control-flow-builders.h" 10 #include "src/interpreter/control-flow-builders.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 BytecodeGenerator::~BytecodeGenerator() {} 147 BytecodeGenerator::~BytecodeGenerator() {}
148 148
149 149
150 Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) { 150 Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) {
151 set_info(info); 151 set_info(info);
152 set_scope(info->scope()); 152 set_scope(info->scope());
153 153
154 builder()->set_parameter_count(info->num_parameters_including_this()); 154 builder()->set_parameter_count(info->num_parameters_including_this());
155 builder()->set_locals_count(scope()->num_stack_slots()); 155 builder()->set_locals_count(scope()->num_stack_slots());
156 // TODO(rmcilroy): Set correct context count. 156 builder()->set_context_count(scope()->MaxNestedContextChainLength());
157 builder()->set_context_count(info->num_heap_slots() > 0 ? 1 : 0);
158 157
159 // Build function context only if there are context allocated variables. 158 // Build function context only if there are context allocated variables.
160 if (info->num_heap_slots() > 0) { 159 if (scope()->NeedsContext()) {
161 // Push a new inner context scope for the function. 160 // Push a new inner context scope for the function.
162 VisitNewLocalFunctionContext(); 161 VisitNewLocalFunctionContext();
163 ContextScope top_context(this, true); 162 ContextScope top_context(this, true);
164 MakeBytecodeBody(); 163 MakeBytecodeBody();
165 } else { 164 } else {
166 MakeBytecodeBody(); 165 MakeBytecodeBody();
167 } 166 }
168 167
169 set_scope(nullptr); 168 set_scope(nullptr);
170 set_info(nullptr); 169 set_info(nullptr);
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 } 1264 }
1266 1265
1267 1266
1268 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 1267 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
1269 return info()->feedback_vector()->GetIndex(slot); 1268 return info()->feedback_vector()->GetIndex(slot);
1270 } 1269 }
1271 1270
1272 } // namespace interpreter 1271 } // namespace interpreter
1273 } // namespace internal 1272 } // namespace internal
1274 } // namespace v8 1273 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698