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); |