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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/scopes.h » ('j') | src/scopes.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 5f321201df4e0f9c76b6b853d446c96586e7d2a8..908674c93aef805d1779369fd2f0b56bbd591556 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -152,11 +152,10 @@ Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) {
builder()->set_parameter_count(info->num_parameters_including_this());
builder()->set_locals_count(scope()->num_stack_slots());
- // TODO(rmcilroy): Set correct context count.
- builder()->set_context_count(info->num_heap_slots() > 0 ? 1 : 0);
+ builder()->set_context_count(scope()->MaxNestedContextChainLength());
adamk 2015/10/15 07:38:44 Is this exercised by any tests (I'm not familiar w
rmcilroy 2015/10/15 09:23:07 This is exercised by test-bytecode-generator.cc::D
adamk 2015/10/15 09:34:32 Capturing a lexical variable from a block will for
rmcilroy 2015/10/15 14:06:16 Great, thanks for the pointer. It turns out this n
// Build function context only if there are context allocated variables.
- if (info->num_heap_slots() > 0) {
+ if (scope()->NeedsContext()) {
adamk 2015/10/15 07:38:45 I'd leave this as num_heap_slots() > 0 (see other
rmcilroy 2015/10/15 09:23:07 Commented on the other comment.
// Push a new inner context scope for the function.
VisitNewLocalFunctionContext();
ContextScope top_context(this, true);
« no previous file with comments | « no previous file | src/scopes.h » ('j') | src/scopes.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698