Commit fc0caf6d authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm] All accesses of bytes in memory are aligned.

It makes no sense to check if unaligned accesses of bytes in memory are
allowed, since these accesses are always aligned. There was a problem
on mips that we created an UnalignedLoad(Int8), which was, however, not
implemented in the mips instruction selector.

R=clemensh@chromium.org

Change-Id: I20369e078e3c24942aa90c2bd3333d9881de0072
Reviewed-on: https://chromium-review.googlesource.com/463006Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44277}
parent c066623e
......@@ -184,6 +184,8 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final
bool IsUnalignedSupported(const Vector<MachineType>& unsupported,
const MachineType& machineType,
uint8_t alignment) const {
// All accesses of bytes in memory are aligned.
DCHECK_NE(machineType.representation(), MachineRepresentation::kWord8);
if (unalignedSupport_ == kFullSupport) {
return true;
} else if (unalignedSupport_ == kNoSupport) {
......
......@@ -3017,7 +3017,8 @@ Node* WasmGraphBuilder::LoadMem(wasm::ValueType type, MachineType memtype,
BoundsCheckMem(memtype, index, offset, position);
}
if (jsgraph()->machine()->UnalignedLoadSupported(memtype, alignment)) {
if (memtype.representation() == MachineRepresentation::kWord8 ||
jsgraph()->machine()->UnalignedLoadSupported(memtype, alignment)) {
if (FLAG_wasm_trap_handler && V8_TRAP_HANDLER_SUPPORTED) {
DCHECK(FLAG_wasm_guard_pages);
Node* position_node = jsgraph()->Int32Constant(position);
......@@ -3072,7 +3073,8 @@ Node* WasmGraphBuilder::StoreMem(MachineType memtype, Node* index,
val = BuildChangeEndianness(val, memtype);
#endif
if (jsgraph()->machine()->UnalignedStoreSupported(memtype, alignment)) {
if (memtype.representation() == MachineRepresentation::kWord8 ||
jsgraph()->machine()->UnalignedStoreSupported(memtype, alignment)) {
if (FLAG_wasm_trap_handler && V8_TRAP_HANDLER_SUPPORTED) {
Node* position_node = jsgraph()->Int32Constant(position);
store = graph()->NewNode(
......
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