Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: src/compiler/wasm-compiler.cc

Issue 2122853002: Implement UnaligedLoad and UnaligedStore turbofan operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/wasm-compiler.h" 5 #include "src/compiler/wasm-compiler.h"
6 6
7 #include "src/isolate-inl.h" 7 #include "src/isolate-inl.h"
8 8
9 #include "src/base/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after
2888 BoundsCheckMem(memtype, index, offset, position); 2888 BoundsCheckMem(memtype, index, offset, position);
2889 bool aligned = static_cast<int>(alignment) >= 2889 bool aligned = static_cast<int>(alignment) >=
2890 ElementSizeLog2Of(memtype.representation()); 2890 ElementSizeLog2Of(memtype.representation());
2891 2891
2892 if (aligned || 2892 if (aligned ||
2893 jsgraph()->machine()->UnalignedLoadSupported(memtype, alignment)) { 2893 jsgraph()->machine()->UnalignedLoadSupported(memtype, alignment)) {
2894 load = graph()->NewNode(jsgraph()->machine()->Load(memtype), 2894 load = graph()->NewNode(jsgraph()->machine()->Load(memtype),
2895 MemBuffer(offset), index, *effect_, *control_); 2895 MemBuffer(offset), index, *effect_, *control_);
2896 *effect_ = load; 2896 *effect_ = load;
2897 } else { 2897 } else {
2898 load = BuildUnalignedLoad(type, memtype, index, offset, alignment); 2898 if (jsgraph()->machine()->UnalignedLoad(memtype).IsSupported()) {
2899 load = graph()->NewNode(jsgraph()->machine()->UnalignedLoad(memtype).op(),
2900 MemBuffer(offset), index, *effect_, *control_);
2901 *effect_ = load;
2902 } else {
2903 load = BuildUnalignedLoad(type, memtype, index, offset, alignment);
titzer 2016/07/11 08:40:00 I thought this routine would go away. Is it the ca
ivica.bogosavljevic 2016/07/11 09:34:43 Agreed. In that case we'll make UnalignedLoad/Unal
2904 }
2899 } 2905 }
2900 #if defined(V8_TARGET_BIG_ENDIAN) 2906 #if defined(V8_TARGET_BIG_ENDIAN)
2901 // TODO(john.yan) Implement byte swap turbofan operator 2907 // TODO(john.yan) Implement byte swap turbofan operator
2902 // and use it if available for better performance 2908 // and use it if available for better performance
2903 load = BuildChangeEndianness(load, memtype, type); 2909 load = BuildChangeEndianness(load, memtype, type);
2904 #endif 2910 #endif
2905 2911
2906 if (type == wasm::kAstI64 && 2912 if (type == wasm::kAstI64 &&
2907 ElementSizeLog2Of(memtype.representation()) < 3) { 2913 ElementSizeLog2Of(memtype.representation()) < 3) {
2908 // TODO(titzer): TF zeroes the upper bits of 64-bit loads for subword sizes. 2914 // TODO(titzer): TF zeroes the upper bits of 64-bit loads for subword sizes.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
3029 #endif 3035 #endif
3030 3036
3031 if (aligned || 3037 if (aligned ||
3032 jsgraph()->machine()->UnalignedStoreSupported(memtype, alignment)) { 3038 jsgraph()->machine()->UnalignedStoreSupported(memtype, alignment)) {
3033 StoreRepresentation rep(memtype.representation(), kNoWriteBarrier); 3039 StoreRepresentation rep(memtype.representation(), kNoWriteBarrier);
3034 store = 3040 store =
3035 graph()->NewNode(jsgraph()->machine()->Store(rep), MemBuffer(offset), 3041 graph()->NewNode(jsgraph()->machine()->Store(rep), MemBuffer(offset),
3036 index, val, *effect_, *control_); 3042 index, val, *effect_, *control_);
3037 *effect_ = store; 3043 *effect_ = store;
3038 } else { 3044 } else {
3039 store = BuildUnalignedStore(memtype, index, offset, alignment, val); 3045 UnalignedStoreRepresentation rep(memtype.representation());
3046
3047 if (jsgraph()->machine()->UnalignedStore(rep).IsSupported()) {
3048 store =
3049 graph()->NewNode(jsgraph()->machine()->UnalignedStore(rep).op(),
3050 MemBuffer(offset), index, val, *effect_, *control_);
3051 *effect_ = store;
3052 } else {
3053 store = BuildUnalignedStore(memtype, index, offset, alignment, val);
3054 }
3040 } 3055 }
3041 3056
3042 return store; 3057 return store;
3043 } 3058 }
3044 3059
3045 Node* WasmGraphBuilder::BuildAsmjsLoadMem(MachineType type, Node* index) { 3060 Node* WasmGraphBuilder::BuildAsmjsLoadMem(MachineType type, Node* index) {
3046 // TODO(turbofan): fold bounds checks for constant asm.js loads. 3061 // TODO(turbofan): fold bounds checks for constant asm.js loads.
3047 // asm.js semantics use CheckedLoad (i.e. OOB reads return 0ish). 3062 // asm.js semantics use CheckedLoad (i.e. OOB reads return 0ish).
3048 const Operator* op = jsgraph()->machine()->CheckedLoad(type); 3063 const Operator* op = jsgraph()->machine()->CheckedLoad(type);
3049 Node* load = graph()->NewNode(op, MemBuffer(0), index, MemSize(0), *effect_, 3064 Node* load = graph()->NewNode(op, MemBuffer(0), index, MemSize(0), *effect_,
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
3464 function_->code_start_offset), 3479 function_->code_start_offset),
3465 compile_ms); 3480 compile_ms);
3466 } 3481 }
3467 3482
3468 return code; 3483 return code;
3469 } 3484 }
3470 3485
3471 } // namespace compiler 3486 } // namespace compiler
3472 } // namespace internal 3487 } // namespace internal
3473 } // namespace v8 3488 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698