Index: src/code-stub-assembler.cc |
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc |
index 660d57d61541535fb4fc9ce28dc427dda4a2e945..d7820d4662ee841d2199f4af13d48e5410fdab86 100644 |
--- a/src/code-stub-assembler.cc |
+++ b/src/code-stub-assembler.cc |
@@ -1264,6 +1264,13 @@ Node* CodeStubAssembler::LoadContextElement(Node* context, int slot_index) { |
return Load(MachineType::AnyTagged(), context, IntPtrConstant(offset)); |
} |
+Node* CodeStubAssembler::LoadContextElement(Node* context, Node* slot_index) { |
+ Node* offset = |
+ IntPtrAdd(WordShl(slot_index, kPointerSizeLog2), |
+ IntPtrConstant(Context::kHeaderSize - kHeapObjectTag)); |
+ return Load(MachineType::AnyTagged(), context, offset); |
+} |
+ |
Node* CodeStubAssembler::StoreContextElement(Node* context, int slot_index, |
Node* value) { |
int offset = Context::SlotOffset(slot_index); |
@@ -1271,6 +1278,14 @@ Node* CodeStubAssembler::StoreContextElement(Node* context, int slot_index, |
value); |
} |
+Node* CodeStubAssembler::StoreContextElement(Node* context, Node* slot_index, |
+ Node* value) { |
+ Node* offset = |
+ IntPtrAdd(WordShl(slot_index, kPointerSizeLog2), |
+ IntPtrConstant(Context::kHeaderSize - kHeapObjectTag)); |
+ return Store(MachineRepresentation::kTagged, context, offset, value); |
+} |
+ |
Node* CodeStubAssembler::LoadNativeContext(Node* context) { |
return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX); |
} |