Commit 7bc196d2 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[interpreter] Mark known immutable context slots as immutable

BUG=

Change-Id: I85f9619e0ecb7d0ebee9523e3b4c44ab7f091cfb
Reviewed-on: https://chromium-review.googlesource.com/451380Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43644}
parent 040fa762
......@@ -2788,10 +2788,10 @@ void BytecodeGenerator::VisitDelete(UnaryOperation* expr) {
builder()
->LoadContextSlot(execution_context()->reg(),
Context::NATIVE_CONTEXT_INDEX, 0,
BytecodeArrayBuilder::kMutableSlot)
BytecodeArrayBuilder::kImmutableSlot)
.StoreAccumulatorInRegister(native_context)
.LoadContextSlot(native_context, Context::EXTENSION_INDEX, 0,
BytecodeArrayBuilder::kMutableSlot)
BytecodeArrayBuilder::kImmutableSlot)
.StoreAccumulatorInRegister(global_object)
.LoadLiteral(variable->raw_name())
.Delete(global_object, language_mode());
......@@ -3342,17 +3342,17 @@ void BytecodeGenerator::VisitFunctionClosureForContext() {
builder()
->LoadContextSlot(execution_context()->reg(),
Context::NATIVE_CONTEXT_INDEX, 0,
BytecodeArrayBuilder::kMutableSlot)
BytecodeArrayBuilder::kImmutableSlot)
.StoreAccumulatorInRegister(native_context)
.LoadContextSlot(native_context, Context::CLOSURE_INDEX, 0,
BytecodeArrayBuilder::kMutableSlot);
BytecodeArrayBuilder::kImmutableSlot);
} 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,
BytecodeArrayBuilder::kMutableSlot);
BytecodeArrayBuilder::kImmutableSlot);
} else {
DCHECK(closure_scope()->is_function_scope() ||
closure_scope()->is_module_scope());
......
......@@ -71,9 +71,9 @@ parameter count: 1
bytecode array length: 16
bytecodes: [
/* 32 E> */ B(StackCheck),
/* 39 S> */ B(LdaCurrentContextSlot), U8(3),
/* 39 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
B(Star), R(0),
B(LdaContextSlot), R(0), U8(2), U8(0),
B(LdaImmutableContextSlot), R(0), U8(2), U8(0),
B(Star), R(1),
B(LdaConstant), U8(0),
B(DeletePropertySloppy), R(1),
......@@ -98,9 +98,9 @@ parameter count: 1
bytecode array length: 16
bytecodes: [
/* 18 E> */ B(StackCheck),
/* 25 S> */ B(LdaCurrentContextSlot), U8(3),
/* 25 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
B(Star), R(0),
B(LdaContextSlot), R(0), U8(2), U8(0),
B(LdaImmutableContextSlot), R(0), U8(2), U8(0),
B(Star), R(1),
B(LdaConstant), U8(0),
B(DeletePropertySloppy), R(1),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment