[maglev] Support Sta(Current)ContextSlot

We don't even need any new IR nodes for it.

Bug: v8:7700
Change-Id: I8c2844f9bc6d21b09799395f817831685be21df7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3757883
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81681}
This commit is contained in:
Leszek Swirski 2022-07-12 15:53:34 +02:00 committed by V8 LUCI CQ
parent 67c951fa12
commit 7cbdde4a70

View File

@ -579,6 +579,29 @@ void MaglevGraphBuilder::VisitLdaImmutableCurrentContextSlot() {
VisitLdaCurrentContextSlot();
}
void MaglevGraphBuilder::VisitStaContextSlot() {
ValueNode* context = LoadRegisterTagged(0);
int slot_index = iterator_.GetIndexOperand(1);
int depth = iterator_.GetUnsignedImmediateOperand(2);
for (int i = 0; i < depth; ++i) {
context = AddNewNode<LoadTaggedField>(
{context}, Context::OffsetOfElementAt(Context::PREVIOUS_INDEX));
}
AddNewNode<StoreTaggedFieldWithWriteBarrier>(
{context, GetAccumulatorTagged()},
Context::OffsetOfElementAt(slot_index));
}
void MaglevGraphBuilder::VisitStaCurrentContextSlot() {
ValueNode* context = GetContext();
int slot_index = iterator_.GetIndexOperand(0);
AddNewNode<StoreTaggedFieldWithWriteBarrier>(
{context, GetAccumulatorTagged()},
Context::OffsetOfElementAt(slot_index));
}
void MaglevGraphBuilder::VisitStar() {
MoveNodeBetweenRegisters(interpreter::Register::virtual_accumulator(),
iterator_.GetRegisterOperand(0));
@ -692,8 +715,6 @@ void MaglevGraphBuilder::VisitLdaGlobal() {
}
MAGLEV_UNIMPLEMENTED_BYTECODE(LdaGlobalInsideTypeof)
MAGLEV_UNIMPLEMENTED_BYTECODE(StaGlobal)
MAGLEV_UNIMPLEMENTED_BYTECODE(StaContextSlot)
MAGLEV_UNIMPLEMENTED_BYTECODE(StaCurrentContextSlot)
MAGLEV_UNIMPLEMENTED_BYTECODE(LdaLookupSlot)
MAGLEV_UNIMPLEMENTED_BYTECODE(LdaLookupContextSlot)
MAGLEV_UNIMPLEMENTED_BYTECODE(LdaLookupGlobalSlot)