[memory] Replace Memory class with templated Memory functions.

Change-Id: I0870a13fd257e014a3b6dca8ee7ccb3aa5485066
Reviewed-on: https://chromium-review.googlesource.com/1183525
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55359}
diff --git a/src/arm/assembler-arm-inl.h b/src/arm/assembler-arm-inl.h
index 8f7a6ee..68ea6f3 100644
--- a/src/arm/assembler-arm-inl.h
+++ b/src/arm/assembler-arm-inl.h
@@ -78,10 +78,10 @@
   DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) || IsWasmCall(rmode_) ||
          IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) ||
          IsOffHeapTarget(rmode_));
-  if (Assembler::IsMovW(Memory::int32_at(pc_))) {
+  if (Assembler::IsMovW(Memory<int32_t>(pc_))) {
     return pc_;
   } else {
-    DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(pc_)));
+    DCHECK(Assembler::IsLdrPcImmediateOffset(Memory<int32_t>(pc_)));
     return constant_pool_entry_address();
   }
 }
@@ -139,7 +139,7 @@
 
 Address RelocInfo::target_internal_reference() {
   DCHECK(rmode_ == INTERNAL_REFERENCE);
-  return Memory::Address_at(pc_);
+  return Memory<Address>(pc_);
 }
 
 
@@ -171,7 +171,7 @@
          IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
          IsInternalReference(rmode_) || IsOffHeapTarget(rmode_));
   if (IsInternalReference(rmode_)) {
-    Memory::Address_at(pc_) = kNullAddress;
+    Memory<Address>(pc_) = kNullAddress;
   } else {
     Assembler::set_target_address_at(pc_, constant_pool_, kNullAddress);
   }
@@ -255,20 +255,20 @@
   //  blx   ip
   //                      @ return address
   Address candidate = pc - 2 * kInstrSize;
-  Instr candidate_instr(Memory::int32_at(candidate));
+  Instr candidate_instr(Memory<int32_t>(candidate));
   if (IsLdrPcImmediateOffset(candidate_instr)) {
     return candidate;
   } else {
     if (CpuFeatures::IsSupported(ARMv7)) {
       candidate -= 1 * kInstrSize;
-      DCHECK(IsMovW(Memory::int32_at(candidate)) &&
-             IsMovT(Memory::int32_at(candidate + kInstrSize)));
+      DCHECK(IsMovW(Memory<int32_t>(candidate)) &&
+             IsMovT(Memory<int32_t>(candidate + kInstrSize)));
     } else {
       candidate -= 3 * kInstrSize;
-      DCHECK(IsMovImmed(Memory::int32_at(candidate)) &&
-             IsOrrImmed(Memory::int32_at(candidate + kInstrSize)) &&
-             IsOrrImmed(Memory::int32_at(candidate + 2 * kInstrSize)) &&
-             IsOrrImmed(Memory::int32_at(candidate + 3 * kInstrSize)));
+      DCHECK(IsMovImmed(Memory<int32_t>(candidate)) &&
+             IsOrrImmed(Memory<int32_t>(candidate + kInstrSize)) &&
+             IsOrrImmed(Memory<int32_t>(candidate + 2 * kInstrSize)) &&
+             IsOrrImmed(Memory<int32_t>(candidate + 3 * kInstrSize)));
     }
     return candidate;
   }
@@ -276,20 +276,20 @@
 
 
 Address Assembler::return_address_from_call_start(Address pc) {
-  if (IsLdrPcImmediateOffset(Memory::int32_at(pc))) {
+  if (IsLdrPcImmediateOffset(Memory<int32_t>(pc))) {
     // Load from constant pool, small section.
     return pc + kInstrSize * 2;
   } else {
     if (CpuFeatures::IsSupported(ARMv7)) {
-      DCHECK(IsMovW(Memory::int32_at(pc)));
-      DCHECK(IsMovT(Memory::int32_at(pc + kInstrSize)));
+      DCHECK(IsMovW(Memory<int32_t>(pc)));
+      DCHECK(IsMovT(Memory<int32_t>(pc + kInstrSize)));
       // A movw / movt load immediate.
       return pc + kInstrSize * 3;
     } else {
-      DCHECK(IsMovImmed(Memory::int32_at(pc)));
-      DCHECK(IsOrrImmed(Memory::int32_at(pc + kInstrSize)));
-      DCHECK(IsOrrImmed(Memory::int32_at(pc + 2 * kInstrSize)));
-      DCHECK(IsOrrImmed(Memory::int32_at(pc + 3 * kInstrSize)));
+      DCHECK(IsMovImmed(Memory<int32_t>(pc)));
+      DCHECK(IsOrrImmed(Memory<int32_t>(pc + kInstrSize)));
+      DCHECK(IsOrrImmed(Memory<int32_t>(pc + 2 * kInstrSize)));
+      DCHECK(IsOrrImmed(Memory<int32_t>(pc + 3 * kInstrSize)));
       // A mov / orr load immediate.
       return pc + kInstrSize * 5;
     }
@@ -298,7 +298,7 @@
 
 void Assembler::deserialization_set_special_target_at(
     Address constant_pool_entry, Code* code, Address target) {
-  Memory::Address_at(constant_pool_entry) = target;
+  Memory<Address>(constant_pool_entry) = target;
 }
 
 int Assembler::deserialization_special_target_size(Address location) {
@@ -307,19 +307,19 @@
 
 void Assembler::deserialization_set_target_internal_reference_at(
     Address pc, Address target, RelocInfo::Mode mode) {
-  Memory::Address_at(pc) = target;
+  Memory<Address>(pc) = target;
 }
 
 
 bool Assembler::is_constant_pool_load(Address pc) {
-  return IsLdrPcImmediateOffset(Memory::int32_at(pc));
+  return IsLdrPcImmediateOffset(Memory<int32_t>(pc));
 }
 
 
 Address Assembler::constant_pool_entry_address(Address pc,
                                                Address constant_pool) {
-  DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(pc)));
-  Instr instr = Memory::int32_at(pc);
+  DCHECK(Assembler::IsLdrPcImmediateOffset(Memory<int32_t>(pc)));
+  Instr instr = Memory<int32_t>(pc);
   return pc + GetLdrRegisterImmediateOffset(instr) + Instruction::kPcLoadDelta;
 }
 
@@ -327,21 +327,21 @@
 Address Assembler::target_address_at(Address pc, Address constant_pool) {
   if (is_constant_pool_load(pc)) {
     // This is a constant pool lookup. Return the value in the constant pool.
-    return Memory::Address_at(constant_pool_entry_address(pc, constant_pool));
-  } else if (CpuFeatures::IsSupported(ARMv7) && IsMovW(Memory::int32_at(pc))) {
+    return Memory<Address>(constant_pool_entry_address(pc, constant_pool));
+  } else if (CpuFeatures::IsSupported(ARMv7) && IsMovW(Memory<int32_t>(pc))) {
     // This is an movw / movt immediate load. Return the immediate.
-    DCHECK(IsMovW(Memory::int32_at(pc)) &&
-           IsMovT(Memory::int32_at(pc + kInstrSize)));
+    DCHECK(IsMovW(Memory<int32_t>(pc)) &&
+           IsMovT(Memory<int32_t>(pc + kInstrSize)));
     Instruction* movw_instr = Instruction::At(pc);
     Instruction* movt_instr = Instruction::At(pc + kInstrSize);
     return static_cast<Address>((movt_instr->ImmedMovwMovtValue() << 16) |
                                 movw_instr->ImmedMovwMovtValue());
-  } else if (IsMovImmed(Memory::int32_at(pc))) {
+  } else if (IsMovImmed(Memory<int32_t>(pc))) {
     // This is an mov / orr immediate load. Return the immediate.
-    DCHECK(IsMovImmed(Memory::int32_at(pc)) &&
-           IsOrrImmed(Memory::int32_at(pc + kInstrSize)) &&
-           IsOrrImmed(Memory::int32_at(pc + 2 * kInstrSize)) &&
-           IsOrrImmed(Memory::int32_at(pc + 3 * kInstrSize)));
+    DCHECK(IsMovImmed(Memory<int32_t>(pc)) &&
+           IsOrrImmed(Memory<int32_t>(pc + kInstrSize)) &&
+           IsOrrImmed(Memory<int32_t>(pc + 2 * kInstrSize)) &&
+           IsOrrImmed(Memory<int32_t>(pc + 3 * kInstrSize)));
     Instr mov_instr = instr_at(pc);
     Instr orr_instr_1 = instr_at(pc + kInstrSize);
     Instr orr_instr_2 = instr_at(pc + 2 * kInstrSize);
@@ -362,7 +362,7 @@
                                       ICacheFlushMode icache_flush_mode) {
   if (is_constant_pool_load(pc)) {
     // This is a constant pool lookup. Update the entry in the constant pool.
-    Memory::Address_at(constant_pool_entry_address(pc, constant_pool)) = target;
+    Memory<Address>(constant_pool_entry_address(pc, constant_pool)) = target;
     // Intuitively, we would think it is necessary to always flush the
     // instruction cache after patching a target address in the code as follows:
     //   Assembler::FlushICache(pc, sizeof(target));
@@ -371,37 +371,37 @@
     // ldr   ip, [pp, #...]
     // since the instruction accessing this address in the constant pool remains
     // unchanged.
-  } else if (CpuFeatures::IsSupported(ARMv7) && IsMovW(Memory::int32_at(pc))) {
+  } else if (CpuFeatures::IsSupported(ARMv7) && IsMovW(Memory<int32_t>(pc))) {
     // This is an movw / movt immediate load. Patch the immediate embedded in
     // the instructions.
-    DCHECK(IsMovW(Memory::int32_at(pc)));
-    DCHECK(IsMovT(Memory::int32_at(pc + kInstrSize)));
+    DCHECK(IsMovW(Memory<int32_t>(pc)));
+    DCHECK(IsMovT(Memory<int32_t>(pc + kInstrSize)));
     uint32_t* instr_ptr = reinterpret_cast<uint32_t*>(pc);
     uint32_t immediate = static_cast<uint32_t>(target);
     instr_ptr[0] = PatchMovwImmediate(instr_ptr[0], immediate & 0xFFFF);
     instr_ptr[1] = PatchMovwImmediate(instr_ptr[1], immediate >> 16);
-    DCHECK(IsMovW(Memory::int32_at(pc)));
-    DCHECK(IsMovT(Memory::int32_at(pc + kInstrSize)));
+    DCHECK(IsMovW(Memory<int32_t>(pc)));
+    DCHECK(IsMovT(Memory<int32_t>(pc + kInstrSize)));
     if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
       Assembler::FlushICache(pc, 2 * kInstrSize);
     }
-  } else if (IsMovImmed(Memory::int32_at(pc))) {
+  } else if (IsMovImmed(Memory<int32_t>(pc))) {
     // This is an mov / orr immediate load. Patch the immediate embedded in
     // the instructions.
-    DCHECK(IsMovImmed(Memory::int32_at(pc)) &&
-           IsOrrImmed(Memory::int32_at(pc + kInstrSize)) &&
-           IsOrrImmed(Memory::int32_at(pc + 2 * kInstrSize)) &&
-           IsOrrImmed(Memory::int32_at(pc + 3 * kInstrSize)));
+    DCHECK(IsMovImmed(Memory<int32_t>(pc)) &&
+           IsOrrImmed(Memory<int32_t>(pc + kInstrSize)) &&
+           IsOrrImmed(Memory<int32_t>(pc + 2 * kInstrSize)) &&
+           IsOrrImmed(Memory<int32_t>(pc + 3 * kInstrSize)));
     uint32_t* instr_ptr = reinterpret_cast<uint32_t*>(pc);
     uint32_t immediate = static_cast<uint32_t>(target);
     instr_ptr[0] = PatchShiftImm(instr_ptr[0], immediate & kImm8Mask);
     instr_ptr[1] = PatchShiftImm(instr_ptr[1], immediate & (kImm8Mask << 8));
     instr_ptr[2] = PatchShiftImm(instr_ptr[2], immediate & (kImm8Mask << 16));
     instr_ptr[3] = PatchShiftImm(instr_ptr[3], immediate & (kImm8Mask << 24));
-    DCHECK(IsMovImmed(Memory::int32_at(pc)) &&
-           IsOrrImmed(Memory::int32_at(pc + kInstrSize)) &&
-           IsOrrImmed(Memory::int32_at(pc + 2 * kInstrSize)) &&
-           IsOrrImmed(Memory::int32_at(pc + 3 * kInstrSize)));
+    DCHECK(IsMovImmed(Memory<int32_t>(pc)) &&
+           IsOrrImmed(Memory<int32_t>(pc + kInstrSize)) &&
+           IsOrrImmed(Memory<int32_t>(pc + 2 * kInstrSize)) &&
+           IsOrrImmed(Memory<int32_t>(pc + 3 * kInstrSize)));
     if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
       Assembler::FlushICache(pc, 4 * kInstrSize);
     }
diff --git a/src/arm/assembler-arm.cc b/src/arm/assembler-arm.cc
index 1633788..2e2909f 100644
--- a/src/arm/assembler-arm.cc
+++ b/src/arm/assembler-arm.cc
@@ -485,7 +485,7 @@
         break;
     }
     Address pc = reinterpret_cast<Address>(buffer_) + request.offset();
-    Memory::Address_at(constant_pool_entry_address(pc, 0 /* unused */)) =
+    Memory<Address>(constant_pool_entry_address(pc, 0 /* unused */)) =
         object.address();
   }
 }
diff --git a/src/arm64/assembler-arm64-inl.h b/src/arm64/assembler-arm64-inl.h
index ccd00ca..52df814 100644
--- a/src/arm64/assembler-arm64-inl.h
+++ b/src/arm64/assembler-arm64-inl.h
@@ -535,7 +535,7 @@
 Address Assembler::target_address_at(Address pc, Address constant_pool) {
   Instruction* instr = reinterpret_cast<Instruction*>(pc);
   if (instr->IsLdrLiteralX()) {
-    return Memory::Address_at(target_pointer_address_at(pc));
+    return Memory<Address>(target_pointer_address_at(pc));
   } else {
     DCHECK(instr->IsBranchAndLink() || instr->IsUnconditionalBranch());
     return reinterpret_cast<Address>(instr->ImmPCOffsetTarget());
@@ -601,7 +601,7 @@
     Assembler::FlushICache(location, kInstrSize);
   } else {
     DCHECK_EQ(instr->InstructionBits(), 0);
-    Memory::Address_at(location) = target;
+    Memory<Address>(location) = target;
     // Intuitively, we would think it is necessary to always flush the
     // instruction cache after patching a target address in the code. However,
     // in this case, only the constant pool contents change. The instruction
@@ -612,7 +612,7 @@
 
 void Assembler::deserialization_set_target_internal_reference_at(
     Address pc, Address target, RelocInfo::Mode mode) {
-  Memory::Address_at(pc) = target;
+  Memory<Address>(pc) = target;
 }
 
 void Assembler::set_target_address_at(Address pc, Address constant_pool,
@@ -620,7 +620,7 @@
                                       ICacheFlushMode icache_flush_mode) {
   Instruction* instr = reinterpret_cast<Instruction*>(pc);
   if (instr->IsLdrLiteralX()) {
-    Memory::Address_at(target_pointer_address_at(pc)) = target;
+    Memory<Address>(target_pointer_address_at(pc)) = target;
     // Intuitively, we would think it is necessary to always flush the
     // instruction cache after patching a target address in the code. However,
     // in this case, only the constant pool contents change. The instruction
@@ -730,7 +730,7 @@
 
 Address RelocInfo::target_internal_reference() {
   DCHECK(rmode_ == INTERNAL_REFERENCE);
-  return Memory::Address_at(pc_);
+  return Memory<Address>(pc_);
 }
 
 
@@ -763,7 +763,7 @@
          IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
          IsInternalReference(rmode_) || IsOffHeapTarget(rmode_));
   if (IsInternalReference(rmode_)) {
-    Memory::Address_at(pc_) = kNullAddress;
+    Memory<Address>(pc_) = kNullAddress;
   } else {
     Assembler::set_target_address_at(pc_, constant_pool_, kNullAddress);
   }
diff --git a/src/arm64/assembler-arm64.cc b/src/arm64/assembler-arm64.cc
index 3cf5dbd..d41b1a7 100644
--- a/src/arm64/assembler-arm64.cc
+++ b/src/arm64/assembler-arm64.cc
@@ -208,7 +208,7 @@
   Instruction* instr = reinterpret_cast<Instruction*>(pc_);
   if (instr->IsLdrLiteralX()) {
     return static_cast<uint32_t>(
-        Memory::Address_at(Assembler::target_pointer_address_at(pc_)));
+        Memory<Address>(Assembler::target_pointer_address_at(pc_)));
   } else {
     DCHECK(instr->IsBranchAndLink() || instr->IsUnconditionalBranch());
     return static_cast<uint32_t>(instr->ImmPCOffset() / kInstrSize);
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
index 2f8eb0f..a2e59ca 100644
--- a/src/deoptimizer.cc
+++ b/src/deoptimizer.cc
@@ -702,14 +702,14 @@
     caller_frame_top_ = stack_fp_ + ComputeInputFrameAboveFpFixedSize();
 
     Address fp_address = input_->GetFramePointerAddress();
-    caller_fp_ = Memory::intptr_at(fp_address);
+    caller_fp_ = Memory<intptr_t>(fp_address);
     caller_pc_ =
-        Memory::intptr_at(fp_address + CommonFrameConstants::kCallerPCOffset);
-    input_frame_context_ = Memory::intptr_at(
+        Memory<intptr_t>(fp_address + CommonFrameConstants::kCallerPCOffset);
+    input_frame_context_ = Memory<intptr_t>(
         fp_address + CommonFrameConstants::kContextOrFrameTypeOffset);
 
     if (FLAG_enable_embedded_constant_pool) {
-      caller_constant_pool_ = Memory::intptr_at(
+      caller_constant_pool_ = Memory<intptr_t>(
           fp_address + CommonFrameConstants::kConstantPoolOffset);
     }
   }
@@ -2596,9 +2596,9 @@
 uint32_t TranslatedState::GetUInt32Slot(Address fp, int slot_offset) {
   Address address = fp + slot_offset;
 #if V8_TARGET_BIG_ENDIAN && V8_HOST_ARCH_64_BIT
-  return Memory::uint32_at(address + kIntSize);
+  return Memory<uint32_t>(address + kIntSize);
 #else
-  return Memory::uint32_at(address);
+  return Memory<uint32_t>(address);
 #endif
 }
 
@@ -2606,12 +2606,12 @@
 #if !V8_TARGET_ARCH_S390X && !V8_TARGET_ARCH_PPC64
   return Float32::FromBits(GetUInt32Slot(fp, slot_offset));
 #else
-  return Float32::FromBits(Memory::uint32_at(fp + slot_offset));
+  return Float32::FromBits(Memory<uint32_t>(fp + slot_offset));
 #endif
 }
 
 Float64 TranslatedState::GetDoubleSlot(Address fp, int slot_offset) {
-  return Float64::FromBits(Memory::uint64_at(fp + slot_offset));
+  return Float64::FromBits(Memory<uint64_t>(fp + slot_offset));
 }
 
 void TranslatedValue::Handlify() {
@@ -2851,7 +2851,7 @@
                                                   int* length) {
   Address parent_frame_pointer = *reinterpret_cast<Address*>(
       input_frame_pointer + StandardFrameConstants::kCallerFPOffset);
-  intptr_t parent_frame_type = Memory::intptr_at(
+  intptr_t parent_frame_type = Memory<intptr_t>(
       parent_frame_pointer + CommonFrameConstants::kContextOrFrameTypeOffset);
 
   Address arguments_frame;
diff --git a/src/frames-inl.h b/src/frames-inl.h
index a64404c..419adbf 100644
--- a/src/frames-inl.h
+++ b/src/frames-inl.h
@@ -21,7 +21,7 @@
 
 inline StackHandler* StackHandler::next() const {
   const int offset = StackHandlerConstants::kNextOffset;
-  return FromAddress(Memory::Address_at(address() + offset));
+  return FromAddress(Memory<Address>(address() + offset));
 }
 
 
@@ -82,19 +82,19 @@
 
   const int receiverOffset =
       BuiltinExitFrameConstants::kNewTargetOffset + (argc - 1) * kPointerSize;
-  return Memory::Object_at(fp() + receiverOffset);
+  return Memory<Object*>(fp() + receiverOffset);
 }
 
 inline Object* BuiltinExitFrame::argc_slot_object() const {
-  return Memory::Object_at(fp() + BuiltinExitFrameConstants::kArgcOffset);
+  return Memory<Object*>(fp() + BuiltinExitFrameConstants::kArgcOffset);
 }
 
 inline Object* BuiltinExitFrame::target_slot_object() const {
-  return Memory::Object_at(fp() + BuiltinExitFrameConstants::kTargetOffset);
+  return Memory<Object*>(fp() + BuiltinExitFrameConstants::kTargetOffset);
 }
 
 inline Object* BuiltinExitFrame::new_target_slot_object() const {
-  return Memory::Object_at(fp() + BuiltinExitFrameConstants::kNewTargetOffset);
+  return Memory<Object*>(fp() + BuiltinExitFrameConstants::kNewTargetOffset);
 }
 
 inline StandardFrame::StandardFrame(StackFrameIteratorBase* iterator)
@@ -103,22 +103,22 @@
 
 
 inline Object* StandardFrame::GetExpression(int index) const {
-  return Memory::Object_at(GetExpressionAddress(index));
+  return Memory<Object*>(GetExpressionAddress(index));
 }
 
 
 inline void StandardFrame::SetExpression(int index, Object* value) {
-  Memory::Object_at(GetExpressionAddress(index)) = value;
+  Memory<Object*>(GetExpressionAddress(index)) = value;
 }
 
 
 inline Address StandardFrame::caller_fp() const {
-  return Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset);
+  return Memory<Address>(fp() + StandardFrameConstants::kCallerFPOffset);
 }
 
 
 inline Address StandardFrame::caller_pc() const {
-  return Memory::Address_at(ComputePCAddress(fp()));
+  return Memory<Address>(ComputePCAddress(fp()));
 }
 
 
@@ -134,14 +134,14 @@
 
 inline bool StandardFrame::IsArgumentsAdaptorFrame(Address fp) {
   intptr_t frame_type =
-      Memory::intptr_at(fp + TypedFrameConstants::kFrameTypeOffset);
+      Memory<intptr_t>(fp + TypedFrameConstants::kFrameTypeOffset);
   return frame_type == StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR);
 }
 
 
 inline bool StandardFrame::IsConstructFrame(Address fp) {
   intptr_t frame_type =
-      Memory::intptr_at(fp + TypedFrameConstants::kFrameTypeOffset);
+      Memory<intptr_t>(fp + TypedFrameConstants::kFrameTypeOffset);
   return frame_type == StackFrame::TypeToMarker(StackFrame::CONSTRUCT);
 }
 
@@ -158,7 +158,7 @@
 }
 
 inline void JavaScriptFrame::set_receiver(Object* value) {
-  Memory::Object_at(GetParameterSlot(-1)) = value;
+  Memory<Object*>(GetParameterSlot(-1)) = value;
 }
 
 
@@ -169,7 +169,7 @@
 
 inline Object* JavaScriptFrame::function_slot_object() const {
   const int offset = JavaScriptFrameConstants::kFunctionOffset;
-  return Memory::Object_at(fp() + offset);
+  return Memory<Object*>(fp() + offset);
 }
 
 inline StubFrame::StubFrame(StackFrameIteratorBase* iterator)
diff --git a/src/frames.cc b/src/frames.cc
index 96930e6..e5751e2 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -183,12 +183,12 @@
       interpreter_bytecode_dispatch->contains(pc)) {
     return true;
   } else if (FLAG_interpreted_frames_native_stack) {
-    intptr_t marker = Memory::intptr_at(
+    intptr_t marker = Memory<intptr_t>(
         state->fp + CommonFrameConstants::kContextOrFrameTypeOffset);
     MSAN_MEMORY_IS_INITIALIZED(
         state->fp + StandardFrameConstants::kFunctionOffset, kPointerSize);
     Object* maybe_function =
-        Memory::Object_at(state->fp + StandardFrameConstants::kFunctionOffset);
+        Memory<Object*>(state->fp + StandardFrameConstants::kFunctionOffset);
     // There's no need to run a full ContainsSlow if we know the frame can't be
     // an InterpretedFrame,  so we do these fast checks first
     if (StackFrame::IsTypeMarker(marker) || maybe_function->IsSmi()) {
@@ -205,7 +205,7 @@
 }
 
 DISABLE_ASAN Address ReadMemoryAt(Address address) {
-  return Memory::Address_at(address);
+  return Memory<Address>(address);
 }
 
 }  // namespace
@@ -323,8 +323,8 @@
     // See EntryFrame::GetCallerState. It computes the caller FP address
     // and calls ExitFrame::GetStateForFramePointer on it. We need to be
     // sure that caller FP address is valid.
-    Address caller_fp = Memory::Address_at(
-        frame->fp() + EntryFrameConstants::kCallerFPOffset);
+    Address caller_fp =
+        Memory<Address>(frame->fp() + EntryFrameConstants::kCallerFPOffset);
     if (!IsValidExitFrame(caller_fp)) return false;
   } else if (frame->is_arguments_adaptor()) {
     // See ArgumentsAdaptorFrame::GetCallerStackPointer. It assumes that
@@ -430,7 +430,7 @@
   MSAN_MEMORY_IS_INITIALIZED(
       state->fp + CommonFrameConstants::kContextOrFrameTypeOffset,
       kPointerSize);
-  intptr_t marker = Memory::intptr_at(
+  intptr_t marker = Memory<intptr_t>(
       state->fp + CommonFrameConstants::kContextOrFrameTypeOffset);
   if (!iterator->can_access_heap_objects_) {
     // TODO(titzer): "can_access_heap_objects" is kind of bogus. It really
@@ -441,7 +441,7 @@
     MSAN_MEMORY_IS_INITIALIZED(
         state->fp + StandardFrameConstants::kFunctionOffset, kPointerSize);
     Object* maybe_function =
-        Memory::Object_at(state->fp + StandardFrameConstants::kFunctionOffset);
+        Memory<Object*>(state->fp + StandardFrameConstants::kFunctionOffset);
     if (!StackFrame::IsTypeMarker(marker)) {
       if (maybe_function->IsSmi()) {
         return NATIVE;
@@ -561,7 +561,7 @@
 
 void NativeFrame::ComputeCallerState(State* state) const {
   state->sp = caller_sp();
-  state->fp = Memory::Address_at(fp() + CommonFrameConstants::kCallerFPOffset);
+  state->fp = Memory<Address>(fp() + CommonFrameConstants::kCallerFPOffset);
   state->pc_address = ResolveReturnAddressLocation(
       reinterpret_cast<Address*>(fp() + CommonFrameConstants::kCallerPCOffset));
   state->callee_pc_address = nullptr;
@@ -580,7 +580,7 @@
 
 StackFrame::Type EntryFrame::GetCallerState(State* state) const {
   const int offset = EntryFrameConstants::kCallerFPOffset;
-  Address fp = Memory::Address_at(this->fp() + offset);
+  Address fp = Memory<Address>(this->fp() + offset);
   return ExitFrame::GetStateForFramePointer(fp, state);
 }
 
@@ -591,7 +591,7 @@
 
 Object*& ExitFrame::code_slot() const {
   const int offset = ExitFrameConstants::kCodeOffset;
-  return Memory::Object_at(fp() + offset);
+  return Memory<Object*>(fp() + offset);
 }
 
 Code* ExitFrame::unchecked_code() const {
@@ -602,7 +602,7 @@
 void ExitFrame::ComputeCallerState(State* state) const {
   // Set up the caller state.
   state->sp = caller_sp();
-  state->fp = Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset);
+  state->fp = Memory<Address>(fp() + ExitFrameConstants::kCallerFPOffset);
   state->pc_address = ResolveReturnAddressLocation(
       reinterpret_cast<Address*>(fp() + ExitFrameConstants::kCallerPCOffset));
   state->callee_pc_address = nullptr;
@@ -639,7 +639,7 @@
   // Distinguish between between regular and builtin exit frames.
   // Default to EXIT in all hairy cases (e.g., when called from profiler).
   const int offset = ExitFrameConstants::kFrameTypeOffset;
-  Object* marker = Memory::Object_at(fp + offset);
+  Object* marker = Memory<Object*>(fp + offset);
 
   if (!marker->IsSmi()) {
     return EXIT;
@@ -657,7 +657,7 @@
 
 Address ExitFrame::ComputeStackPointer(Address fp) {
   MSAN_MEMORY_IS_INITIALIZED(fp + ExitFrameConstants::kSPOffset, kPointerSize);
-  return Memory::Address_at(fp + ExitFrameConstants::kSPOffset);
+  return Memory<Address>(fp + ExitFrameConstants::kSPOffset);
 }
 
 void ExitFrame::FillState(Address fp, Address sp, State* state) {
@@ -687,7 +687,7 @@
   DCHECK(i >= 0 && i < ComputeParametersCount());
   int offset =
       BuiltinExitFrameConstants::kFirstArgumentOffset + i * kPointerSize;
-  return Memory::Object_at(fp() + offset);
+  return Memory<Object*>(fp() + offset);
 }
 
 int BuiltinExitFrame::ComputeParametersCount() const {
@@ -855,7 +855,7 @@
   // Determine the fixed header and spill slot area size.
   int frame_header_size = StandardFrameConstants::kFixedFrameSizeFromFp;
   intptr_t marker =
-      Memory::intptr_at(fp() + CommonFrameConstants::kContextOrFrameTypeOffset);
+      Memory<intptr_t>(fp() + CommonFrameConstants::kContextOrFrameTypeOffset);
   if (StackFrame::IsTypeMarker(marker)) {
     StackFrame::Type candidate = StackFrame::MarkerToType(marker);
     switch (candidate) {
@@ -898,10 +898,10 @@
   slot_space -=
       (frame_header_size + StandardFrameConstants::kFixedFrameSizeAboveFp);
 
-  Object** frame_header_base = &Memory::Object_at(fp() - frame_header_size);
+  Object** frame_header_base = &Memory<Object*>(fp() - frame_header_size);
   Object** frame_header_limit =
-      &Memory::Object_at(fp() - StandardFrameConstants::kCPSlotSize);
-  Object** parameters_base = &Memory::Object_at(sp());
+      &Memory<Object*>(fp() - StandardFrameConstants::kCPSlotSize);
+  Object** parameters_base = &Memory<Object*>(sp());
   Object** parameters_limit = frame_header_base - slot_space / kPointerSize;
 
   // Visit the parameters that may be on top of the saved registers.
@@ -994,7 +994,7 @@
 void OptimizedFrame::Iterate(RootVisitor* v) const { IterateCompiledFrame(v); }
 
 void JavaScriptFrame::SetParameterValue(int index, Object* value) const {
-  Memory::Object_at(GetParameterSlot(index)) = value;
+  Memory<Object*>(GetParameterSlot(index)) = value;
 }
 
 
@@ -1002,7 +1002,7 @@
   Address fp = caller_fp();
   if (has_adapted_arguments()) {
     // Skip the arguments adaptor frame and look at the real caller.
-    fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset);
+    fp = Memory<Address>(fp + StandardFrameConstants::kCallerFPOffset);
   }
   return IsConstructFrame(fp);
 }
@@ -1030,7 +1030,7 @@
   Code* code = LookupCode();
   if (code->kind() == Code::BUILTIN) {
     return static_cast<int>(
-        Memory::intptr_at(fp() + OptimizedBuiltinFrameConstants::kArgCOffset));
+        Memory<intptr_t>(fp() + OptimizedBuiltinFrameConstants::kArgCOffset));
   } else {
     return JavaScriptFrame::GetNumberOfIncomingArguments();
   }
@@ -1085,7 +1085,7 @@
 
 Object* JavaScriptFrame::context() const {
   const int offset = StandardFrameConstants::kContextOffset;
-  Object* maybe_result = Memory::Object_at(fp() + offset);
+  Object* maybe_result = Memory<Object*>(fp() + offset);
   DCHECK(!maybe_result->IsSmi());
   return maybe_result;
 }
@@ -1215,7 +1215,7 @@
 }
 
 Object* JavaScriptFrame::GetParameter(int index) const {
-  return Memory::Object_at(GetParameterSlot(index));
+  return Memory<Object*>(GetParameterSlot(index));
 }
 
 int JavaScriptFrame::ComputeParametersCount() const {
@@ -1228,7 +1228,7 @@
   DCHECK_EQ(RegisterConfiguration::Default()->GetAllocatableGeneralCode(0),
             kJavaScriptCallArgCountRegister.code());
   Object* argc_object =
-      Memory::Object_at(fp() + BuiltinContinuationFrameConstants::kArgCOffset);
+      Memory<Object*>(fp() + BuiltinContinuationFrameConstants::kArgCOffset);
   return Smi::ToInt(argc_object);
 }
 
@@ -1240,7 +1240,7 @@
 }
 
 Object* JavaScriptBuiltinContinuationFrame::context() const {
-  return Memory::Object_at(
+  return Memory<Object*>(
       fp() + BuiltinContinuationFrameConstants::kBuiltinContextOffset);
 }
 
@@ -1252,8 +1252,8 @@
 
   // Only allow setting exception if previous value was the hole.
   CHECK_EQ(ReadOnlyRoots(isolate()).the_hole_value(),
-           Memory::Object_at(exception_argument_slot));
-  Memory::Object_at(exception_argument_slot) = exception;
+           Memory<Object*>(exception_argument_slot));
+  Memory<Object*>(exception_argument_slot) = exception;
 }
 
 FrameSummary::JavaScriptFrameSummary::JavaScriptFrameSummary(
@@ -1643,7 +1643,7 @@
 
 
 Object* OptimizedFrame::StackSlotAt(int index) const {
-  return Memory::Object_at(fp() + StackSlotOffsetRelativeToFp(index));
+  return Memory<Object*>(fp() + StackSlotOffsetRelativeToFp(index));
 }
 
 int InterpretedFrame::position() const {
@@ -1674,7 +1674,7 @@
       InterpreterFrameConstants::kBytecodeOffsetFromFp,
       InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize);
   Address expression_offset = fp + offset - index * kPointerSize;
-  int raw_offset = Smi::ToInt(Memory::Object_at(expression_offset));
+  int raw_offset = Smi::ToInt(Memory<Object*>(expression_offset));
   return raw_offset - BytecodeArray::kHeaderSize + kHeapObjectTag;
 }
 
@@ -1801,7 +1801,7 @@
 
 WasmInstanceObject* WasmCompiledFrame::wasm_instance() const {
   const int offset = WasmCompiledFrameConstants::kWasmInstanceOffset;
-  Object* instance = Memory::Object_at(fp() + offset);
+  Object* instance = Memory<Object*>(fp() + offset);
   return WasmInstanceObject::cast(instance);
 }
 
@@ -1889,7 +1889,7 @@
 
 WasmInstanceObject* WasmInterpreterEntryFrame::wasm_instance() const {
   const int offset = WasmCompiledFrameConstants::kWasmInstanceOffset;
-  Object* instance = Memory::Object_at(fp() + offset);
+  Object* instance = Memory<Object*>(fp() + offset);
   return WasmInstanceObject::cast(instance);
 }
 
@@ -1923,13 +1923,13 @@
 
 Object** WasmCompileLazyFrame::wasm_instance_slot() const {
   const int offset = WasmCompileLazyFrameConstants::kWasmInstanceOffset;
-  return &Memory::Object_at(fp() + offset);
+  return &Memory<Object*>(fp() + offset);
 }
 
 void WasmCompileLazyFrame::Iterate(RootVisitor* v) const {
   const int header_size = WasmCompileLazyFrameConstants::kFixedFrameSizeFromFp;
-  Object** base = &Memory::Object_at(sp());
-  Object** limit = &Memory::Object_at(fp() - header_size);
+  Object** base = &Memory<Object*>(sp());
+  Object** limit = &Memory<Object*>(fp() - header_size);
   v->VisitRootPointers(Root::kTop, nullptr, base, limit);
   v->VisitRootPointer(Root::kTop, nullptr, wasm_instance_slot());
 }
@@ -2105,8 +2105,8 @@
 
 void StandardFrame::IterateExpressions(RootVisitor* v) const {
   const int offset = StandardFrameConstants::kLastObjectOffset;
-  Object** base = &Memory::Object_at(sp());
-  Object** limit = &Memory::Object_at(fp() + offset) + 1;
+  Object** base = &Memory<Object*>(sp());
+  Object** limit = &Memory<Object*>(fp() + offset) + 1;
   v->VisitRootPointers(Root::kTop, nullptr, base, limit);
 }
 
diff --git a/src/handler-table.cc b/src/handler-table.cc
index 57cf4e2..4086cc7 100644
--- a/src/handler-table.cc
+++ b/src/handler-table.cc
@@ -37,7 +37,7 @@
 #endif
       raw_encoded_data_(instruction_start + handler_table_offset) {
   if (handler_table_offset > 0) {
-    number_of_entries_ = Memory::int32_at(raw_encoded_data_);
+    number_of_entries_ = Memory<int32_t>(raw_encoded_data_);
     raw_encoded_data_ += sizeof(int32_t);
   }
 }
@@ -46,14 +46,14 @@
   DCHECK_EQ(kRangeBasedEncoding, mode_);
   DCHECK_LT(index, NumberOfRangeEntries());
   int offset = index * kRangeEntrySize + kRangeStartIndex;
-  return Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t));
+  return Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t));
 }
 
 int HandlerTable::GetRangeEnd(int index) const {
   DCHECK_EQ(kRangeBasedEncoding, mode_);
   DCHECK_LT(index, NumberOfRangeEntries());
   int offset = index * kRangeEntrySize + kRangeEndIndex;
-  return Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t));
+  return Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t));
 }
 
 int HandlerTable::GetRangeHandler(int index) const {
@@ -61,14 +61,14 @@
   DCHECK_LT(index, NumberOfRangeEntries());
   int offset = index * kRangeEntrySize + kRangeHandlerIndex;
   return HandlerOffsetField::decode(
-      Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t)));
+      Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t)));
 }
 
 int HandlerTable::GetRangeData(int index) const {
   DCHECK_EQ(kRangeBasedEncoding, mode_);
   DCHECK_LT(index, NumberOfRangeEntries());
   int offset = index * kRangeEntrySize + kRangeDataIndex;
-  return Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t));
+  return Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t));
 }
 
 HandlerTable::CatchPrediction HandlerTable::GetRangePrediction(
@@ -77,14 +77,14 @@
   DCHECK_LT(index, NumberOfRangeEntries());
   int offset = index * kRangeEntrySize + kRangeHandlerIndex;
   return HandlerPredictionField::decode(
-      Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t)));
+      Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t)));
 }
 
 int HandlerTable::GetReturnOffset(int index) const {
   DCHECK_EQ(kReturnAddressBasedEncoding, mode_);
   DCHECK_LT(index, NumberOfReturnEntries());
   int offset = index * kReturnEntrySize + kReturnOffsetIndex;
-  return Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t));
+  return Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t));
 }
 
 int HandlerTable::GetReturnHandler(int index) const {
@@ -92,17 +92,17 @@
   DCHECK_LT(index, NumberOfReturnEntries());
   int offset = index * kReturnEntrySize + kReturnHandlerIndex;
   return HandlerOffsetField::decode(
-      Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t)));
+      Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t)));
 }
 
 void HandlerTable::SetRangeStart(int index, int value) {
   int offset = index * kRangeEntrySize + kRangeStartIndex;
-  Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t)) = value;
+  Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t)) = value;
 }
 
 void HandlerTable::SetRangeEnd(int index, int value) {
   int offset = index * kRangeEntrySize + kRangeEndIndex;
-  Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t)) = value;
+  Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t)) = value;
 }
 
 void HandlerTable::SetRangeHandler(int index, int handler_offset,
@@ -110,12 +110,12 @@
   int value = HandlerOffsetField::encode(handler_offset) |
               HandlerPredictionField::encode(prediction);
   int offset = index * kRangeEntrySize + kRangeHandlerIndex;
-  Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t)) = value;
+  Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t)) = value;
 }
 
 void HandlerTable::SetRangeData(int index, int value) {
   int offset = index * kRangeEntrySize + kRangeDataIndex;
-  Memory::int32_at(raw_encoded_data_ + offset * sizeof(int32_t)) = value;
+  Memory<int32_t>(raw_encoded_data_ + offset * sizeof(int32_t)) = value;
 }
 
 // static
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 9db1457..2ec3063 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -2812,7 +2812,7 @@
         reinterpret_cast<Map*>(root(kTwoPointerFillerMapRootIndex)),
         SKIP_WRITE_BARRIER);
     if (clear_memory_mode == ClearFreedMemoryMode::kClearFreedMemory) {
-      Memory::Address_at(addr + kPointerSize) =
+      Memory<Address>(addr + kPointerSize) =
           static_cast<Address>(kClearedFreeMemoryValue);
     }
   } else {
diff --git a/src/heap/remembered-set.h b/src/heap/remembered-set.h
index 499cbf6..e59457b 100644
--- a/src/heap/remembered-set.h
+++ b/src/heap/remembered-set.h
@@ -284,8 +284,7 @@
         callback(reinterpret_cast<MaybeObject**>(&code));
     DCHECK(!HasWeakHeapObjectTag(code));
     if (code != old_code) {
-      Memory::Address_at(entry_address) =
-          reinterpret_cast<Code*>(code)->entry();
+      Memory<Address>(entry_address) = reinterpret_cast<Code*>(code)->entry();
     }
     return result;
   }
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 5ccae40..ff28ab5 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -1249,7 +1249,7 @@
   DCHECK_EQ(start % kPointerSize, 0);
   DCHECK_EQ(size % kPointerSize, 0);
   for (size_t s = 0; s + kPointerSize <= size; s += kPointerSize) {
-    Memory::Address_at(start + s) = static_cast<Address>(zap_value);
+    Memory<Address>(start + s) = static_cast<Address>(zap_value);
   }
 }
 
diff --git a/src/ia32/assembler-ia32-inl.h b/src/ia32/assembler-ia32-inl.h
index 1783825..1ce2312 100644
--- a/src/ia32/assembler-ia32-inl.h
+++ b/src/ia32/assembler-ia32-inl.h
@@ -94,19 +94,19 @@
 
 HeapObject* RelocInfo::target_object() {
   DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
-  return HeapObject::cast(Memory::Object_at(pc_));
+  return HeapObject::cast(Memory<Object*>(pc_));
 }
 
 Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
   DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
-  return Handle<HeapObject>::cast(Memory::Object_Handle_at(pc_));
+  return Handle<HeapObject>::cast(Memory<Handle<Object>>(pc_));
 }
 
 void RelocInfo::set_target_object(Heap* heap, HeapObject* target,
                                   WriteBarrierMode write_barrier_mode,
                                   ICacheFlushMode icache_flush_mode) {
   DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
-  Memory::Object_at(pc_) = target;
+  Memory<Object*>(pc_) = target;
   if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
     Assembler::FlushICache(pc_, sizeof(Address));
   }
@@ -118,13 +118,13 @@
 
 Address RelocInfo::target_external_reference() {
   DCHECK(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
-  return Memory::Address_at(pc_);
+  return Memory<Address>(pc_);
 }
 
 void RelocInfo::set_target_external_reference(
     Address target, ICacheFlushMode icache_flush_mode) {
   DCHECK(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
-  Memory::Address_at(pc_) = target;
+  Memory<Address>(pc_) = target;
   if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
     Assembler::FlushICache(pc_, sizeof(Address));
   }
@@ -132,7 +132,7 @@
 
 Address RelocInfo::target_internal_reference() {
   DCHECK(rmode_ == INTERNAL_REFERENCE);
-  return Memory::Address_at(pc_);
+  return Memory<Address>(pc_);
 }
 
 
@@ -163,7 +163,7 @@
 void RelocInfo::WipeOut() {
   if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) ||
       IsInternalReference(rmode_)) {
-    Memory::Address_at(pc_) = kNullAddress;
+    Memory<Address>(pc_) = kNullAddress;
   } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) ||
              IsOffHeapTarget(rmode_)) {
     // Effectively write zero into the relocation.
@@ -318,7 +318,7 @@
 
 void Assembler::deserialization_set_target_internal_reference_at(
     Address pc, Address target, RelocInfo::Mode mode) {
-  Memory::Address_at(pc) = target;
+  Memory<Address>(pc) = target;
 }
 
 
diff --git a/src/ia32/assembler-ia32.cc b/src/ia32/assembler-ia32.cc
index 5424d6c..54a82c6 100644
--- a/src/ia32/assembler-ia32.cc
+++ b/src/ia32/assembler-ia32.cc
@@ -226,7 +226,7 @@
 
 uint32_t RelocInfo::wasm_call_tag() const {
   DCHECK(rmode_ == WASM_CALL || rmode_ == WASM_STUB_CALL);
-  return Memory::uint32_at(pc_);
+  return Memory<uint32_t>(pc_);
 }
 
 // -----------------------------------------------------------------------------
@@ -313,7 +313,7 @@
         break;
     }
     Address pc = reinterpret_cast<Address>(buffer_) + request.offset();
-    Memory::Object_Handle_at(pc) = object;
+    Memory<Handle<Object>>(pc) = object;
   }
 }
 
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index fd055d2..9237441 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -124,7 +124,7 @@
   ic_info.type += type;
 
   Object* maybe_function =
-      Memory::Object_at(fp_ + JavaScriptFrameConstants::kFunctionOffset);
+      Memory<Object*>(fp_ + JavaScriptFrameConstants::kFunctionOffset);
   DCHECK(maybe_function->IsJSFunction());
   JSFunction* function = JSFunction::cast(maybe_function);
   int code_offset = 0;
@@ -172,7 +172,7 @@
   }
   Address* pc_address =
       reinterpret_cast<Address*>(entry + ExitFrameConstants::kCallerPCOffset);
-  Address fp = Memory::Address_at(entry + ExitFrameConstants::kCallerFPOffset);
+  Address fp = Memory<Address>(entry + ExitFrameConstants::kCallerFPOffset);
 #ifdef DEBUG
   StackFrameIterator it(isolate);
   for (int i = 0; i < 1; i++) it.Advance();
@@ -185,9 +185,9 @@
   // is skip this frame. However, the pc should not be updated. The call to
   // ICs happen from bytecode handlers.
   intptr_t frame_marker =
-      Memory::intptr_at(fp + TypedFrameConstants::kFrameTypeOffset);
+      Memory<intptr_t>(fp + TypedFrameConstants::kFrameTypeOffset);
   if (frame_marker == StackFrame::TypeToMarker(StackFrame::STUB)) {
-    fp = Memory::Address_at(fp + TypedFrameConstants::kCallerFPOffset);
+    fp = Memory<Address>(fp + TypedFrameConstants::kCallerFPOffset);
   }
   fp_ = fp;
   if (FLAG_enable_embedded_constant_pool) {
diff --git a/src/mips/assembler-mips-inl.h b/src/mips/assembler-mips-inl.h
index 4d75a05..a0ca03f 100644
--- a/src/mips/assembler-mips-inl.h
+++ b/src/mips/assembler-mips-inl.h
@@ -174,7 +174,7 @@
     set_target_internal_reference_encoded_at(pc, target);
   } else {
     DCHECK(mode == RelocInfo::INTERNAL_REFERENCE);
-    Memory::Address_at(pc) = target;
+    Memory<Address>(pc) = target;
   }
 }
 
@@ -217,7 +217,7 @@
 
 Address RelocInfo::target_internal_reference() {
   if (rmode_ == INTERNAL_REFERENCE) {
-    return Memory::Address_at(pc_);
+    return Memory<Address>(pc_);
   } else {
     // Encoded internal references are lui/ori or lui/jic load of 32-bit
     // absolute address.
@@ -266,7 +266,7 @@
          IsInternalReference(rmode_) || IsInternalReferenceEncoded(rmode_) ||
          IsOffHeapTarget(rmode_));
   if (IsInternalReference(rmode_)) {
-    Memory::Address_at(pc_) = kNullAddress;
+    Memory<Address>(pc_) = kNullAddress;
   } else if (IsInternalReferenceEncoded(rmode_)) {
     Assembler::set_target_internal_reference_encoded_at(pc_, kNullAddress);
   } else {
diff --git a/src/objects-inl.h b/src/objects-inl.h
index d5f7601..05b2b96 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2082,8 +2082,7 @@
          (!Heap::FromWritableHeapObject(this)->deserialization_complete() &&
           map() == nullptr));
   DCHECK_LE(kNextOffset + kPointerSize, relaxed_read_size());
-  return reinterpret_cast<FreeSpace*>(
-      Memory::Address_at(address() + kNextOffset));
+  return reinterpret_cast<FreeSpace*>(Memory<Address>(address() + kNextOffset));
 }
 
 
diff --git a/src/objects/code-inl.h b/src/objects/code-inl.h
index 3f5a52a..308e645 100644
--- a/src/objects/code-inl.h
+++ b/src/objects/code-inl.h
@@ -563,7 +563,7 @@
 }
 
 Object* Code::GetObjectFromEntryAddress(Address location_of_address) {
-  return GetObjectFromCodeEntry(Memory::Address_at(location_of_address));
+  return GetObjectFromCodeEntry(Memory<Address>(location_of_address));
 }
 
 bool Code::CanContainWeakObjects() {
diff --git a/src/ppc/assembler-ppc-inl.h b/src/ppc/assembler-ppc-inl.h
index 24a8045..e3dbaa9 100644
--- a/src/ppc/assembler-ppc-inl.h
+++ b/src/ppc/assembler-ppc-inl.h
@@ -54,8 +54,8 @@
   // absolute code pointer inside code object moves with the code object.
   if (IsInternalReference(rmode_)) {
     // Jump table entry
-    Address target = Memory::Address_at(pc_);
-    Memory::Address_at(pc_) = target + delta;
+    Address target = Memory<Address>(pc_);
+    Memory<Address>(pc_) = target + delta;
   } else {
     // mov sequence
     DCHECK(IsInternalReferenceEncoded(rmode_));
@@ -69,7 +69,7 @@
 Address RelocInfo::target_internal_reference() {
   if (IsInternalReference(rmode_)) {
     // Jump table entry
-    return Memory::Address_at(pc_);
+    return Memory<Address>(pc_);
   } else {
     // mov sequence
     DCHECK(IsInternalReferenceEncoded(rmode_));
@@ -223,7 +223,7 @@
          IsOffHeapTarget(rmode_));
   if (IsInternalReference(rmode_)) {
     // Jump table entry
-    Memory::Address_at(pc_) = kNullAddress;
+    Memory<Address>(pc_) = kNullAddress;
   } else if (IsInternalReferenceEncoded(rmode_) || IsOffHeapTarget(rmode_)) {
     // mov sequence
     // Currently used only by deserializer, no need to flush.
@@ -272,7 +272,7 @@
   if (FLAG_enable_embedded_constant_pool && constant_pool) {
     ConstantPoolEntry::Access access;
     if (IsConstantPoolLoadStart(pc, &access))
-      return Memory::Address_at(target_constant_pool_address_at(
+      return Memory<Address>(target_constant_pool_address_at(
           pc, constant_pool, access, ConstantPoolEntry::INTPTR));
   }
 
@@ -441,7 +441,7 @@
   if (RelocInfo::IsInternalReferenceEncoded(mode)) {
     set_target_address_at(pc, kNullAddress, target, SKIP_ICACHE_FLUSH);
   } else {
-    Memory::Address_at(pc) = target;
+    Memory<Address>(pc) = target;
   }
 }
 
@@ -453,7 +453,7 @@
   if (FLAG_enable_embedded_constant_pool && constant_pool) {
     ConstantPoolEntry::Access access;
     if (IsConstantPoolLoadStart(pc, &access)) {
-      Memory::Address_at(target_constant_pool_address_at(
+      Memory<Address>(target_constant_pool_address_at(
           pc, constant_pool, access, ConstantPoolEntry::INTPTR)) = target;
       return;
     }
diff --git a/src/ppc/assembler-ppc.cc b/src/ppc/assembler-ppc.cc
index c43b955..24d9d2b 100644
--- a/src/ppc/assembler-ppc.cc
+++ b/src/ppc/assembler-ppc.cc
@@ -2094,8 +2094,8 @@
     // Fix up internal references now that they are guaranteed to be bound.
     if (RelocInfo::IsInternalReference(rmode)) {
       // Jump table entry
-      intptr_t pos = static_cast<intptr_t>(Memory::Address_at(pc));
-      Memory::Address_at(pc) = reinterpret_cast<Address>(buffer_) + pos;
+      intptr_t pos = static_cast<intptr_t>(Memory<Address>(pc));
+      Memory<Address>(pc) = reinterpret_cast<Address>(buffer_) + pos;
     } else if (RelocInfo::IsInternalReferenceEncoded(rmode)) {
       // mov sequence
       intptr_t pos = static_cast<intptr_t>(target_address_at(pc, kNullAddress));
diff --git a/src/profiler/tick-sample.cc b/src/profiler/tick-sample.cc
index ef44749..e3bd1d9 100644
--- a/src/profiler/tick-sample.cc
+++ b/src/profiler/tick-sample.cc
@@ -174,7 +174,7 @@
     // Sample potential return address value for frameless invocation of
     // stubs (we'll figure out later, if this value makes sense).
     tos = reinterpret_cast<void*>(
-        i::Memory::Address_at(reinterpret_cast<i::Address>(regs.sp)));
+        i::Memory<i::Address>(reinterpret_cast<i::Address>(regs.sp)));
   } else {
     tos = nullptr;
   }
@@ -255,9 +255,9 @@
       // bytecode_array might be garbage, so don't actually dereference it. We
       // avoid the frame->GetXXX functions since they call BytecodeArray::cast,
       // which has a heap access in its DCHECK.
-      i::Object* bytecode_array = i::Memory::Object_at(
+      i::Object* bytecode_array = i::Memory<i::Object*>(
           frame->fp() + i::InterpreterFrameConstants::kBytecodeArrayFromFp);
-      i::Object* bytecode_offset = i::Memory::Object_at(
+      i::Object* bytecode_offset = i::Memory<i::Object*>(
           frame->fp() + i::InterpreterFrameConstants::kBytecodeOffsetFromFp);
 
       // If the bytecode array is a heap object and the bytecode offset is a
diff --git a/src/regexp/arm/regexp-macro-assembler-arm.cc b/src/regexp/arm/regexp-macro-assembler-arm.cc
index d2a20f3..f77d521 100644
--- a/src/regexp/arm/regexp-macro-assembler-arm.cc
+++ b/src/regexp/arm/regexp-macro-assembler-arm.cc
@@ -1080,7 +1080,7 @@
 // Helper function for reading a value out of a stack frame.
 template <typename T>
 static T& frame_entry(Address re_frame, int frame_offset) {
-  return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset));
+  return reinterpret_cast<T&>(Memory<int32_t>(re_frame + frame_offset));
 }
 
 
diff --git a/src/regexp/ia32/regexp-macro-assembler-ia32.cc b/src/regexp/ia32/regexp-macro-assembler-ia32.cc
index b1e6d40..0d479ca 100644
--- a/src/regexp/ia32/regexp-macro-assembler-ia32.cc
+++ b/src/regexp/ia32/regexp-macro-assembler-ia32.cc
@@ -1108,7 +1108,7 @@
 // Helper function for reading a value out of a stack frame.
 template <typename T>
 static T& frame_entry(Address re_frame, int frame_offset) {
-  return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset));
+  return reinterpret_cast<T&>(Memory<int32_t>(re_frame + frame_offset));
 }
 
 
diff --git a/src/regexp/mips/regexp-macro-assembler-mips.cc b/src/regexp/mips/regexp-macro-assembler-mips.cc
index e16fbd6..36ac932 100644
--- a/src/regexp/mips/regexp-macro-assembler-mips.cc
+++ b/src/regexp/mips/regexp-macro-assembler-mips.cc
@@ -1143,7 +1143,7 @@
 // Helper function for reading a value out of a stack frame.
 template <typename T>
 static T& frame_entry(Address re_frame, int frame_offset) {
-  return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset));
+  return reinterpret_cast<T&>(Memory<int32_t>(re_frame + frame_offset));
 }
 
 
diff --git a/src/regexp/mips64/regexp-macro-assembler-mips64.cc b/src/regexp/mips64/regexp-macro-assembler-mips64.cc
index 40ac387..17a8ce8 100644
--- a/src/regexp/mips64/regexp-macro-assembler-mips64.cc
+++ b/src/regexp/mips64/regexp-macro-assembler-mips64.cc
@@ -1181,7 +1181,7 @@
 // Helper function for reading a value out of a stack frame.
 template <typename T>
 static T& frame_entry(Address re_frame, int frame_offset) {
-  return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset));
+  return reinterpret_cast<T&>(Memory<int32_t>(re_frame + frame_offset));
 }
 
 
diff --git a/src/regexp/ppc/regexp-macro-assembler-ppc.cc b/src/regexp/ppc/regexp-macro-assembler-ppc.cc
index fdda464..4944220 100644
--- a/src/regexp/ppc/regexp-macro-assembler-ppc.cc
+++ b/src/regexp/ppc/regexp-macro-assembler-ppc.cc
@@ -1143,7 +1143,7 @@
 // Helper function for reading a value out of a stack frame.
 template <typename T>
 static T& frame_entry(Address re_frame, int frame_offset) {
-  return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset));
+  return reinterpret_cast<T&>(Memory<int32_t>(re_frame + frame_offset));
 }
 
 
diff --git a/src/regexp/s390/regexp-macro-assembler-s390.cc b/src/regexp/s390/regexp-macro-assembler-s390.cc
index 837d563..3db1ebc 100644
--- a/src/regexp/s390/regexp-macro-assembler-s390.cc
+++ b/src/regexp/s390/regexp-macro-assembler-s390.cc
@@ -1089,9 +1089,9 @@
 static T& frame_entry(Address re_frame, int frame_offset) {
   DCHECK_EQ(kPointerSize, sizeof(T));
 #ifdef V8_TARGET_ARCH_S390X
-  return reinterpret_cast<T&>(Memory::uint64_at(re_frame + frame_offset));
+  return reinterpret_cast<T&>(Memory<uint64_t>(re_frame + frame_offset));
 #else
-  return reinterpret_cast<T&>(Memory::uint32_at(re_frame + frame_offset));
+  return reinterpret_cast<T&>(Memory<uint32_t>(re_frame + frame_offset));
 #endif
 }
 
diff --git a/src/regexp/x64/regexp-macro-assembler-x64.cc b/src/regexp/x64/regexp-macro-assembler-x64.cc
index 46a6a45..43f8076 100644
--- a/src/regexp/x64/regexp-macro-assembler-x64.cc
+++ b/src/regexp/x64/regexp-macro-assembler-x64.cc
@@ -1208,7 +1208,7 @@
 // Helper function for reading a value out of a stack frame.
 template <typename T>
 static T& frame_entry(Address re_frame, int frame_offset) {
-  return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset));
+  return reinterpret_cast<T&>(Memory<int32_t>(re_frame + frame_offset));
 }
 
 
diff --git a/src/s390/assembler-s390-inl.h b/src/s390/assembler-s390-inl.h
index 5ce166f..e2bf452 100644
--- a/src/s390/assembler-s390-inl.h
+++ b/src/s390/assembler-s390-inl.h
@@ -54,8 +54,8 @@
   // Absolute code pointer inside code object moves with the code object.
   if (IsInternalReference(rmode_)) {
     // Jump table entry
-    Address target = Memory::Address_at(pc_);
-    Memory::Address_at(pc_) = target + delta;
+    Address target = Memory<Address>(pc_);
+    Memory<Address>(pc_) = target + delta;
   } else if (IsCodeTarget(rmode_)) {
     SixByteInstr instr =
         Instruction::InstructionBits(reinterpret_cast<const byte*>(pc_));
@@ -78,7 +78,7 @@
 Address RelocInfo::target_internal_reference() {
   if (IsInternalReference(rmode_)) {
     // Jump table entry
-    return Memory::Address_at(pc_);
+    return Memory<Address>(pc_);
   } else {
     // mov sequence
     DCHECK(IsInternalReferenceEncoded(rmode_));
@@ -205,7 +205,7 @@
          IsOffHeapTarget(rmode_));
   if (IsInternalReference(rmode_)) {
     // Jump table entry
-    Memory::Address_at(pc_) = kNullAddress;
+    Memory<Address>(pc_) = kNullAddress;
   } else if (IsInternalReferenceEncoded(rmode_) || IsOffHeapTarget(rmode_)) {
     // mov sequence
     // Currently used only by deserializer, no need to flush.
@@ -293,7 +293,7 @@
   if (RelocInfo::IsInternalReferenceEncoded(mode)) {
     set_target_address_at(pc, kNullAddress, target, SKIP_ICACHE_FLUSH);
   } else {
-    Memory::Address_at(pc) = target;
+    Memory<Address>(pc) = target;
   }
 }
 
diff --git a/src/s390/assembler-s390.cc b/src/s390/assembler-s390.cc
index 4b34bcb..6f1cbcd 100644
--- a/src/s390/assembler-s390.cc
+++ b/src/s390/assembler-s390.cc
@@ -826,8 +826,8 @@
     // Fix up internal references now that they are guaranteed to be bound.
     if (RelocInfo::IsInternalReference(rmode)) {
       // Jump table entry
-      Address pos = Memory::Address_at(pc);
-      Memory::Address_at(pc) = reinterpret_cast<Address>(buffer_) + pos;
+      Address pos = Memory<Address>(pc);
+      Memory<Address>(pc) = reinterpret_cast<Address>(buffer_) + pos;
     } else if (RelocInfo::IsInternalReferenceEncoded(rmode)) {
       // mov sequence
       Address pos = target_address_at(pc, 0);
diff --git a/src/safepoint-table.cc b/src/safepoint-table.cc
index ed8d4a9..5765038 100644
--- a/src/safepoint-table.cc
+++ b/src/safepoint-table.cc
@@ -41,8 +41,8 @@
       stack_slots_(stack_slots),
       has_deopt_(has_deopt) {
   Address header = instruction_start_ + safepoint_table_offset;
-  length_ = Memory::uint32_at(header + kLengthOffset);
-  entry_size_ = Memory::uint32_at(header + kEntrySizeOffset);
+  length_ = Memory<uint32_t>(header + kLengthOffset);
+  entry_size_ = Memory<uint32_t>(header + kEntrySizeOffset);
   pc_and_deoptimization_indexes_ = header + kHeaderSize;
   entries_ = pc_and_deoptimization_indexes_ + (length_ * kFixedEntrySize);
   DCHECK_GT(entry_size_, 0);
diff --git a/src/safepoint-table.h b/src/safepoint-table.h
index e49ef0b..e85a27f 100644
--- a/src/safepoint-table.h
+++ b/src/safepoint-table.h
@@ -103,22 +103,22 @@
 
   unsigned GetPcOffset(unsigned index) const {
     DCHECK(index < length_);
-    return Memory::uint32_at(GetPcOffsetLocation(index));
+    return Memory<uint32_t>(GetPcOffsetLocation(index));
   }
 
   int GetTrampolinePcOffset(unsigned index) const {
     DCHECK(index < length_);
-    return Memory::int_at(GetTrampolineLocation(index));
+    return Memory<int>(GetTrampolineLocation(index));
   }
 
   unsigned find_return_pc(unsigned pc_offset);
 
   SafepointEntry GetEntry(unsigned index) const {
     DCHECK(index < length_);
-    unsigned info = Memory::uint32_at(GetInfoLocation(index));
-    uint8_t* bits = &Memory::uint8_at(entries_ + (index * entry_size_));
+    unsigned info = Memory<uint32_t>(GetInfoLocation(index));
+    uint8_t* bits = &Memory<uint8_t>(entries_ + (index * entry_size_));
     int trampoline_pc =
-        has_deopt_ ? Memory::int_at(GetTrampolineLocation(index)) : -1;
+        has_deopt_ ? Memory<int>(GetTrampolineLocation(index)) : -1;
     return SafepointEntry(info, bits, trampoline_pc);
   }
 
diff --git a/src/v8memory.h b/src/v8memory.h
index 9a6d091..bf62e3b 100644
--- a/src/v8memory.h
+++ b/src/v8memory.h
@@ -14,72 +14,14 @@
 // that typically are needed when incompatible pointer types are used.
 // Note that this class currently relies on undefined behaviour. There is a
 // proposal (http://wg21.link/p0593r2) to make it defined behaviour though.
-class Memory {
- public:
-  static uint8_t& uint8_at(Address addr) {
-    return *reinterpret_cast<uint8_t*>(addr);
-  }
-
-  static uint16_t& uint16_at(Address addr)  {
-    return *reinterpret_cast<uint16_t*>(addr);
-  }
-
-  static uint32_t& uint32_at(Address addr)  {
-    return *reinterpret_cast<uint32_t*>(addr);
-  }
-
-  static int32_t& int32_at(Address addr)  {
-    return *reinterpret_cast<int32_t*>(addr);
-  }
-
-  static uint64_t& uint64_at(Address addr)  {
-    return *reinterpret_cast<uint64_t*>(addr);
-  }
-
-  static int64_t& int64_at(Address addr) {
-    return *reinterpret_cast<int64_t*>(addr);
-  }
-
-  static int& int_at(Address addr)  {
-    return *reinterpret_cast<int*>(addr);
-  }
-
-  static unsigned& unsigned_at(Address addr) {
-    return *reinterpret_cast<unsigned*>(addr);
-  }
-
-  static intptr_t& intptr_at(Address addr)  {
-    return *reinterpret_cast<intptr_t*>(addr);
-  }
-
-  static uintptr_t& uintptr_at(Address addr) {
-    return *reinterpret_cast<uintptr_t*>(addr);
-  }
-
-  static float& float_at(Address addr) {
-    return *reinterpret_cast<float*>(addr);
-  }
-
-  static double& double_at(Address addr)  {
-    return *reinterpret_cast<double*>(addr);
-  }
-
-  static Address& Address_at(Address addr)  {
-    return *reinterpret_cast<Address*>(addr);
-  }
-
-  static Object*& Object_at(Address addr)  {
-    return *reinterpret_cast<Object**>(addr);
-  }
-
-  static Handle<Object>& Object_Handle_at(Address addr)  {
-    return *reinterpret_cast<Handle<Object>*>(addr);
-  }
-
-  static bool IsAddressInRange(Address base, Address address, uint32_t size) {
-    return base <= address && address < base + size;
-  }
-};
+template <class T>
+T& Memory(Address addr) {
+  return *reinterpret_cast<T*>(addr);
+}
+template <class T>
+T& Memory(byte* addr) {
+  return Memory<T>(reinterpret_cast<Address>(addr));
+}
 
 template <typename V>
 static inline V ReadUnalignedValue(Address p) {
diff --git a/src/wasm/wasm-serialization.cc b/src/wasm/wasm-serialization.cc
index 11fadd0..2edc412 100644
--- a/src/wasm/wasm-serialization.cc
+++ b/src/wasm/wasm-serialization.cc
@@ -146,7 +146,7 @@
 #elif V8_TARGET_ARCH_ARM64
   Instruction* instr = reinterpret_cast<Instruction*>(rinfo->pc());
   if (instr->IsLdrLiteralX()) {
-    Memory::Address_at(rinfo->constant_pool_entry_address()) =
+    Memory<Address>(rinfo->constant_pool_entry_address()) =
         static_cast<Address>(tag);
   } else {
     DCHECK(instr->IsBranchAndLink() || instr->IsUnconditionalBranch());
@@ -172,7 +172,7 @@
   Instruction* instr = reinterpret_cast<Instruction*>(rinfo->pc());
   if (instr->IsLdrLiteralX()) {
     return static_cast<uint32_t>(
-        Memory::Address_at(rinfo->constant_pool_entry_address()));
+        Memory<Address>(rinfo->constant_pool_entry_address()));
   } else {
     DCHECK(instr->IsBranchAndLink() || instr->IsUnconditionalBranch());
     return static_cast<uint32_t>(instr->ImmPCOffset() / kInstrSize);
diff --git a/src/x64/assembler-x64-inl.h b/src/x64/assembler-x64-inl.h
index c3b0a5f..4c6cce5 100644
--- a/src/x64/assembler-x64-inl.h
+++ b/src/x64/assembler-x64-inl.h
@@ -24,12 +24,12 @@
 
 
 void Assembler::emitl(uint32_t x) {
-  Memory::uint32_at(reinterpret_cast<Address>(pc_)) = x;
+  Memory<uint32_t>(pc_) = x;
   pc_ += sizeof(uint32_t);
 }
 
 void Assembler::emitp(Address x, RelocInfo::Mode rmode) {
-  Memory::uintptr_at(reinterpret_cast<Address>(pc_)) = x;
+  Memory<uintptr_t>(pc_) = x;
   if (!RelocInfo::IsNone(rmode)) {
     RecordRelocInfo(rmode, x);
   }
@@ -38,13 +38,13 @@
 
 
 void Assembler::emitq(uint64_t x) {
-  Memory::uint64_at(reinterpret_cast<Address>(pc_)) = x;
+  Memory<uint64_t>(pc_) = x;
   pc_ += sizeof(uint64_t);
 }
 
 
 void Assembler::emitw(uint16_t x) {
-  Memory::uint16_at(reinterpret_cast<Address>(pc_)) = x;
+  Memory<uint16_t>(pc_) = x;
   pc_ += sizeof(uint16_t);
 }
 
@@ -233,13 +233,13 @@
 
 
 Address Assembler::target_address_at(Address pc, Address constant_pool) {
-  return Memory::int32_at(pc) + pc + 4;
+  return Memory<int32_t>(pc) + pc + 4;
 }
 
 void Assembler::set_target_address_at(Address pc, Address constant_pool,
                                       Address target,
                                       ICacheFlushMode icache_flush_mode) {
-  Memory::int32_at(pc) = static_cast<int32_t>(target - pc - 4);
+  Memory<int32_t>(pc) = static_cast<int32_t>(target - pc - 4);
   if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
     Assembler::FlushICache(pc, sizeof(int32_t));
   }
@@ -247,7 +247,7 @@
 
 void Assembler::deserialization_set_target_internal_reference_at(
     Address pc, Address target, RelocInfo::Mode mode) {
-  Memory::Address_at(pc) = target;
+  Memory<Address>(pc) = target;
 }
 
 
@@ -267,11 +267,11 @@
 }
 
 Handle<Code> Assembler::code_target_object_handle_at(Address pc) {
-  return GetCodeTarget(Memory::int32_at(pc));
+  return GetCodeTarget(Memory<int32_t>(pc));
 }
 
 Address Assembler::runtime_entry_at(Address pc) {
-  return Memory::int32_at(pc) + options().code_range_start;
+  return Memory<int32_t>(pc) + options().code_range_start;
 }
 
 // -----------------------------------------------------------------------------
@@ -280,10 +280,10 @@
 // The modes possibly affected by apply must be in kApplyMask.
 void RelocInfo::apply(intptr_t delta) {
   if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
-    Memory::int32_at(pc_) -= static_cast<int32_t>(delta);
+    Memory<int32_t>(pc_) -= static_cast<int32_t>(delta);
   } else if (IsInternalReference(rmode_)) {
     // absolute code pointer inside code object moves with the code object.
-    Memory::Address_at(pc_) += delta;
+    Memory<Address>(pc_) += delta;
   }
 }
 
@@ -316,13 +316,13 @@
 
 HeapObject* RelocInfo::target_object() {
   DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
-  return HeapObject::cast(Memory::Object_at(pc_));
+  return HeapObject::cast(Memory<Object*>(pc_));
 }
 
 Handle<HeapObject> RelocInfo::target_object_handle(Assembler* origin) {
   DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
   if (rmode_ == EMBEDDED_OBJECT) {
-    return Handle<HeapObject>::cast(Memory::Object_Handle_at(pc_));
+    return Handle<HeapObject>::cast(Memory<Handle<Object>>(pc_));
   } else {
     return origin->code_target_object_handle_at(pc_);
   }
@@ -330,13 +330,13 @@
 
 Address RelocInfo::target_external_reference() {
   DCHECK(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
-  return Memory::Address_at(pc_);
+  return Memory<Address>(pc_);
 }
 
 void RelocInfo::set_target_external_reference(
     Address target, ICacheFlushMode icache_flush_mode) {
   DCHECK(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
-  Memory::Address_at(pc_) = target;
+  Memory<Address>(pc_) = target;
   if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
     Assembler::FlushICache(pc_, sizeof(Address));
   }
@@ -344,7 +344,7 @@
 
 Address RelocInfo::target_internal_reference() {
   DCHECK(rmode_ == INTERNAL_REFERENCE);
-  return Memory::Address_at(pc_);
+  return Memory<Address>(pc_);
 }
 
 
@@ -357,7 +357,7 @@
                                   WriteBarrierMode write_barrier_mode,
                                   ICacheFlushMode icache_flush_mode) {
   DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
-  Memory::Object_at(pc_) = target;
+  Memory<Object*>(pc_) = target;
   if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
     Assembler::FlushICache(pc_, sizeof(Address));
   }
@@ -383,13 +383,13 @@
 
 Address RelocInfo::target_off_heap_target() {
   DCHECK(IsOffHeapTarget(rmode_));
-  return Memory::Address_at(pc_);
+  return Memory<Address>(pc_);
 }
 
 void RelocInfo::WipeOut() {
   if (IsEmbeddedObject(rmode_) || IsExternalReference(rmode_) ||
       IsInternalReference(rmode_) || IsOffHeapTarget(rmode_)) {
-    Memory::Address_at(pc_) = kNullAddress;
+    Memory<Address>(pc_) = kNullAddress;
   } else if (IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)) {
     // Effectively write zero into the relocation.
     Assembler::set_target_address_at(pc_, constant_pool_,
diff --git a/src/x64/assembler-x64.cc b/src/x64/assembler-x64.cc
index ea5da5f..27120e2 100644
--- a/src/x64/assembler-x64.cc
+++ b/src/x64/assembler-x64.cc
@@ -127,7 +127,7 @@
 void RelocInfo::set_js_to_wasm_address(Address address,
                                        ICacheFlushMode icache_flush_mode) {
   DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
-  Memory::Address_at(pc_) = address;
+  Memory<Address>(pc_) = address;
   if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
     Assembler::FlushICache(pc_, sizeof(Address));
   }
@@ -135,12 +135,12 @@
 
 Address RelocInfo::js_to_wasm_address() const {
   DCHECK_EQ(rmode_, JS_TO_WASM_CALL);
-  return Memory::Address_at(pc_);
+  return Memory<Address>(pc_);
 }
 
 uint32_t RelocInfo::wasm_call_tag() const {
   DCHECK(rmode_ == WASM_CALL || rmode_ == WASM_STUB_CALL);
-  return Memory::uint32_at(pc_);
+  return Memory<uint32_t>(pc_);
 }
 
 // -----------------------------------------------------------------------------
@@ -229,7 +229,7 @@
       // Need 32 bits of displacement, mode 2 or mode 1 with register rbp/r13.
       data_.buf[0] = (modrm & 0x3F) | (is_baseless ? 0x00 : 0x80);
       data_.len = disp_offset + 4;
-      Memory::int32_at(reinterpret_cast<Address>(&data_.buf[disp_offset])) =
+      Memory<int32_t>(reinterpret_cast<Address>(&data_.buf[disp_offset])) =
           disp_value;
     } else if (disp_value != 0 || (base_reg == 0x05)) {
       // Need 8 bits of displacement.
@@ -341,12 +341,12 @@
       case HeapObjectRequest::kHeapNumber: {
         Handle<HeapNumber> object =
             isolate->factory()->NewHeapNumber(request.heap_number(), TENURED);
-        Memory::Object_Handle_at(pc) = object;
+        Memory<Handle<Object>>(pc) = object;
         break;
       }
       case HeapObjectRequest::kCodeStub: {
         request.code_stub()->set_isolate(isolate);
-        UpdateCodeTarget(Memory::int32_at(pc), request.code_stub()->GetCode());
+        UpdateCodeTarget(Memory<int32_t>(pc), request.code_stub()->GetCode());
         break;
       }
     }
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
index 6ae2263..0659ac57 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -789,7 +789,7 @@
   CHECK_GE(array->address() + array->BytecodeArraySize(),
            array->GetFirstBytecodeAddress() + array->length());
   for (int i = 0; i < kRawBytesSize; i++) {
-    CHECK_EQ(Memory::uint8_at(array->GetFirstBytecodeAddress() + i),
+    CHECK_EQ(Memory<uint8_t>(array->GetFirstBytecodeAddress() + i),
              kRawBytes[i]);
     CHECK_EQ(array->get(i), kRawBytes[i]);
   }
@@ -807,7 +807,7 @@
   CHECK_EQ(array->frame_size(), kFrameSize);
   for (int i = 0; i < kRawBytesSize; i++) {
     CHECK_EQ(array->get(i), kRawBytes[i]);
-    CHECK_EQ(Memory::uint8_at(array->GetFirstBytecodeAddress() + i),
+    CHECK_EQ(Memory<uint8_t>(array->GetFirstBytecodeAddress() + i),
              kRawBytes[i]);
   }