Index: src/compiler/code-assembler.cc |
diff --git a/src/compiler/code-assembler.cc b/src/compiler/code-assembler.cc |
index d78677e0f55768ca52460cb37d39a8e41169993f..0a90b9e9251130c1b5fe1d872aa9d3d24f73ef8d 100644 |
--- a/src/compiler/code-assembler.cc |
+++ b/src/compiler/code-assembler.cc |
@@ -205,14 +205,10 @@ Node* CodeAssembler::LoadRoot(Heap::RootListIndex root_index) { |
} |
} |
- compiler::Node* roots_array_start = |
+ Node* roots_array_start = |
ExternalConstant(ExternalReference::roots_array_start(isolate())); |
- USE(roots_array_start); |
- |
- // TODO(danno): Implement the root-access case where the root is not constant |
- // and must be loaded from the root array. |
- UNIMPLEMENTED(); |
- return nullptr; |
+ return Load(MachineType::AnyTagged(), roots_array_start, |
+ IntPtrConstant(root_index * kPointerSize)); |
} |
Node* CodeAssembler::Store(MachineRepresentation rep, Node* base, Node* value) { |
@@ -239,6 +235,14 @@ Node* CodeAssembler::AtomicStore(MachineRepresentation rep, Node* base, |
return raw_assembler_->AtomicStore(rep, base, index, value); |
} |
+Node* CodeAssembler::StoreRoot(Heap::RootListIndex root_index, Node* value) { |
+ DCHECK(Heap::RootCanBeWrittenAfterInitialization(root_index)); |
+ Node* roots_array_start = |
+ ExternalConstant(ExternalReference::roots_array_start(isolate())); |
+ return StoreNoWriteBarrier(MachineRepresentation::kTagged, roots_array_start, |
+ IntPtrConstant(root_index * kPointerSize), value); |
+} |
+ |
Node* CodeAssembler::Projection(int index, Node* value) { |
return raw_assembler_->Projection(index, value); |
} |