Chromium Code Reviews| Index: src/interpreter/bytecode-generator.cc |
| diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
| index 7130d5204fd453af6f4b6c0598ddc71f7a67455b..3c63752b7ec01b92f830e2583bbf7d65e88e0949 100644 |
| --- a/src/interpreter/bytecode-generator.cc |
| +++ b/src/interpreter/bytecode-generator.cc |
| @@ -3002,12 +3002,27 @@ void BytecodeGenerator::BuildNewLocalActivationContext() { |
| .StoreAccumulatorInRegister(args[2]) |
| .CallRuntime(Runtime::kPushModuleContext, args); |
| } else { |
| + DCHECK(scope->is_function_scope() || scope->is_eval_scope()); |
| int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| - if (slot_count <= FastNewFunctionContextStub::kMaximumSlots) { |
| - builder()->CreateFunctionContext(slot_count); |
| + if (slot_count <= FastNewFunctionContextStub::MaximumSlots()) { |
| + switch (scope->scope_type()) { |
| + case EVAL_SCOPE: |
| + builder()->CreateEvalContext(slot_count); |
| + break; |
| + case FUNCTION_SCOPE: |
| + builder()->CreateFunctionContext(slot_count); |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + } |
| } else { |
| - builder()->CallRuntime(Runtime::kNewFunctionContext, |
| - Register::function_closure()); |
| + RegisterList args = register_allocator()->NewRegisterList(2); |
| + builder() |
| + ->LoadAccumulatorWithRegister(Register::function_closure()) |
|
Michael Starzinger
2016/12/15 09:42:59
nit: Would MoveRegister(Register::function_closure
Dan Ehrenberg
2016/12/15 23:51:50
Done.
|
| + .StoreAccumulatorInRegister(args[0]) |
| + .LoadLiteral(Smi::FromInt(scope->scope_type())) |
| + .StoreAccumulatorInRegister(args[1]) |
| + .CallRuntime(Runtime::kNewFunctionContext, args); |
| } |
| } |
| } |