[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/463006
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44277}
This commit is contained in:
Andreas Haas 2017-03-30 11:02:11 +02:00 committed by Commit Bot
parent c066623ed7
commit fc0caf6de8
2 changed files with 6 additions and 2 deletions

View File

@ -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) {

View File

@ -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(