OLD | NEW |
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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 break; | 827 break; |
828 // kExprI64UConvertI32: | 828 // kExprI64UConvertI32: |
829 case wasm::kExprI64UConvertI32: | 829 case wasm::kExprI64UConvertI32: |
830 op = m->ChangeUint32ToUint64(); | 830 op = m->ChangeUint32ToUint64(); |
831 break; | 831 break; |
832 // kExprF64ReinterpretI64: | 832 // kExprF64ReinterpretI64: |
833 // kExprI64ReinterpretF64: | 833 // kExprI64ReinterpretF64: |
834 // kExprI64Clz: | 834 // kExprI64Clz: |
835 // kExprI64Ctz: | 835 // kExprI64Ctz: |
836 // kExprI64Popcnt: | 836 // kExprI64Popcnt: |
| 837 case wasm::kExprI64Popcnt: { |
| 838 if (m->Word64Popcnt().IsSupported()) { |
| 839 op = m->Word64Popcnt().op(); |
| 840 } else if (m->Is32() && m->Word32Popcnt().IsSupported()) { |
| 841 op = m->Word64PopcntPlaceholder(); |
| 842 } else { |
| 843 return BuildI64Popcnt(input); |
| 844 } |
| 845 break; |
| 846 } |
837 // kExprF32SConvertI64: | 847 // kExprF32SConvertI64: |
838 case wasm::kExprI64Eqz: | 848 case wasm::kExprI64Eqz: |
839 op = m->Word64Equal(); | 849 op = m->Word64Equal(); |
840 return graph()->NewNode(op, input, jsgraph()->Int64Constant(0)); | 850 return graph()->NewNode(op, input, jsgraph()->Int64Constant(0)); |
841 case wasm::kExprF32SConvertI64: | 851 case wasm::kExprF32SConvertI64: |
842 if (m->Is32()) { | 852 if (m->Is32()) { |
843 return BuildF32SConvertI64(input); | 853 return BuildF32SConvertI64(input); |
844 } | 854 } |
845 op = m->RoundInt64ToFloat32(); | 855 op = m->RoundInt64ToFloat32(); |
846 break; | 856 break; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 op = m->Word64Ctz().op(); | 908 op = m->Word64Ctz().op(); |
899 break; | 909 break; |
900 } else if (m->Word64ReverseBits().IsSupported()) { | 910 } else if (m->Word64ReverseBits().IsSupported()) { |
901 Node* reversed = graph()->NewNode(m->Word64ReverseBits().op(), input); | 911 Node* reversed = graph()->NewNode(m->Word64ReverseBits().op(), input); |
902 Node* result = graph()->NewNode(m->Word64Clz(), reversed); | 912 Node* result = graph()->NewNode(m->Word64Clz(), reversed); |
903 return result; | 913 return result; |
904 } else { | 914 } else { |
905 return BuildI64Ctz(input); | 915 return BuildI64Ctz(input); |
906 } | 916 } |
907 } | 917 } |
908 case wasm::kExprI64Popcnt: { | |
909 if (m->Word64Popcnt().IsSupported()) { | |
910 op = m->Word64Popcnt().op(); | |
911 break; | |
912 } else { | |
913 return BuildI64Popcnt(input); | |
914 } | |
915 } | |
916 #endif | 918 #endif |
917 default: | 919 default: |
918 op = UnsupportedOpcode(opcode); | 920 op = UnsupportedOpcode(opcode); |
919 } | 921 } |
920 return graph()->NewNode(op, input); | 922 return graph()->NewNode(op, input); |
921 } | 923 } |
922 | 924 |
923 | 925 |
924 Node* WasmGraphBuilder::Float32Constant(float value) { | 926 Node* WasmGraphBuilder::Float32Constant(float value) { |
925 return jsgraph()->Float32Constant(value); | 927 return jsgraph()->Float32Constant(value); |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2647 static_cast<int>(function.code_end_offset - function.code_start_offset), | 2649 static_cast<int>(function.code_end_offset - function.code_start_offset), |
2648 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); | 2650 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); |
2649 } | 2651 } |
2650 return code; | 2652 return code; |
2651 } | 2653 } |
2652 | 2654 |
2653 | 2655 |
2654 } // namespace compiler | 2656 } // namespace compiler |
2655 } // namespace internal | 2657 } // namespace internal |
2656 } // namespace v8 | 2658 } // namespace v8 |
OLD | NEW |