Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index c28d4687d8a8cf5b742626739d8cbeb50ee9dc54..75497cf2c16738f53ac9c24a8b01c94ea90ec75f 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -1942,7 +1942,13 @@ |
context_reg = execution_context()->reg(); |
} |
- builder()->LoadContextSlot(context_reg, variable->index(), depth); |
+ BytecodeArrayBuilder::ContextSlotMutability immutable = |
+ (variable->maybe_assigned() == kNotAssigned) |
+ ? BytecodeArrayBuilder::kImmutableSlot |
+ : BytecodeArrayBuilder::kMutableSlot; |
+ |
+ builder()->LoadContextSlot(context_reg, variable->index(), depth, |
+ immutable); |
if (hole_check_mode == HoleCheckMode::kRequired) { |
BuildThrowIfHole(variable->name()); |
} |
@@ -2106,7 +2112,8 @@ |
Register value_temp = register_allocator()->NewRegister(); |
builder() |
->StoreAccumulatorInRegister(value_temp) |
- .LoadContextSlot(context_reg, variable->index(), depth); |
+ .LoadContextSlot(context_reg, variable->index(), depth, |
+ BytecodeArrayBuilder::kMutableSlot); |
BuildHoleCheckForVariableAssignment(variable, op); |
builder()->LoadAccumulatorWithRegister(value_temp); |
@@ -2737,9 +2744,11 @@ |
Register global_object = register_allocator()->NewRegister(); |
builder() |
->LoadContextSlot(execution_context()->reg(), |
- Context::NATIVE_CONTEXT_INDEX, 0) |
+ Context::NATIVE_CONTEXT_INDEX, 0, |
+ BytecodeArrayBuilder::kMutableSlot) |
.StoreAccumulatorInRegister(native_context) |
- .LoadContextSlot(native_context, Context::EXTENSION_INDEX, 0) |
+ .LoadContextSlot(native_context, Context::EXTENSION_INDEX, 0, |
+ BytecodeArrayBuilder::kMutableSlot) |
.StoreAccumulatorInRegister(global_object) |
.LoadLiteral(variable->name()) |
.Delete(global_object, language_mode()); |
@@ -3251,15 +3260,18 @@ |
Register native_context = register_allocator()->NewRegister(); |
builder() |
->LoadContextSlot(execution_context()->reg(), |
- Context::NATIVE_CONTEXT_INDEX, 0) |
+ Context::NATIVE_CONTEXT_INDEX, 0, |
+ BytecodeArrayBuilder::kMutableSlot) |
.StoreAccumulatorInRegister(native_context) |
- .LoadContextSlot(native_context, Context::CLOSURE_INDEX, 0); |
+ .LoadContextSlot(native_context, Context::CLOSURE_INDEX, 0, |
+ BytecodeArrayBuilder::kMutableSlot); |
} else if (closure_scope->is_eval_scope()) { |
// Contexts created by a call to eval have the same closure as the |
// context calling eval, not the anonymous closure containing the eval |
// code. Fetch it from the context. |
builder()->LoadContextSlot(execution_context()->reg(), |
- Context::CLOSURE_INDEX, 0); |
+ Context::CLOSURE_INDEX, 0, |
+ BytecodeArrayBuilder::kMutableSlot); |
} else { |
DCHECK(closure_scope->is_function_scope() || |
closure_scope->is_module_scope()); |