Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index 5d8857440975f6684cf69d732985963449e2aaa1..c1f946d75880281b6fd7ee18e19b14f373b83b59 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -2156,8 +2156,12 @@ void BytecodeGenerator::VisitFunctionClosureForContext() { |
closure_scope->is_module_scope()) { |
// Contexts nested in the native context have a canonical empty function as |
// their closure, not the anonymous closure containing the global code. |
- // Pass a SMI sentinel and let the runtime look up the empty function. |
- builder()->LoadLiteral(Smi::FromInt(0)); |
+ Register native_context = execution_result()->NewRegister(); |
+ builder() |
+ ->LoadContextSlot(execution_context()->reg(), |
+ Context::NATIVE_CONTEXT_INDEX) |
+ .StoreAccumulatorInRegister(native_context) |
+ .LoadContextSlot(native_context, Context::CLOSURE_INDEX); |
} else { |
DCHECK(closure_scope->is_function_scope()); |
builder()->LoadAccumulatorWithRegister(Register::function_closure()); |