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 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 break; | 835 break; |
836 // kExprI64ReinterpretF64: | 836 // kExprI64ReinterpretF64: |
837 case wasm::kExprI64ReinterpretF64: | 837 case wasm::kExprI64ReinterpretF64: |
838 op = m->BitcastFloat64ToInt64(); | 838 op = m->BitcastFloat64ToInt64(); |
839 break; | 839 break; |
840 // kExprI64Clz: | 840 // kExprI64Clz: |
841 case wasm::kExprI64Clz: | 841 case wasm::kExprI64Clz: |
842 op = m->Word64Clz(); | 842 op = m->Word64Clz(); |
843 break; | 843 break; |
844 // kExprI64Ctz: | 844 // kExprI64Ctz: |
| 845 case wasm::kExprI64Ctz: { |
| 846 if (m->Word64Ctz().IsSupported()) { |
| 847 op = m->Word64Ctz().op(); |
| 848 break; |
| 849 } else if (m->Is32() && m->Word32Ctz().IsSupported()) { |
| 850 op = m->Word64CtzPlaceholder(); |
| 851 break; |
| 852 } else if (m->Word64ReverseBits().IsSupported()) { |
| 853 Node* reversed = graph()->NewNode(m->Word64ReverseBits().op(), input); |
| 854 Node* result = graph()->NewNode(m->Word64Clz(), reversed); |
| 855 return result; |
| 856 } else { |
| 857 return BuildI64Ctz(input); |
| 858 } |
| 859 } |
845 // kExprI64Popcnt: | 860 // kExprI64Popcnt: |
846 case wasm::kExprI64Popcnt: { | 861 case wasm::kExprI64Popcnt: { |
847 if (m->Word64Popcnt().IsSupported()) { | 862 if (m->Word64Popcnt().IsSupported()) { |
848 op = m->Word64Popcnt().op(); | 863 op = m->Word64Popcnt().op(); |
849 } else if (m->Is32() && m->Word32Popcnt().IsSupported()) { | 864 } else if (m->Is32() && m->Word32Popcnt().IsSupported()) { |
850 op = m->Word64PopcntPlaceholder(); | 865 op = m->Word64PopcntPlaceholder(); |
851 } else { | 866 } else { |
852 return BuildI64Popcnt(input); | 867 return BuildI64Popcnt(input); |
853 } | 868 } |
854 break; | 869 break; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 return BuildI64SConvertF64(input); | 908 return BuildI64SConvertF64(input); |
894 } | 909 } |
895 // kExprI64UConvertF32: | 910 // kExprI64UConvertF32: |
896 case wasm::kExprI64UConvertF32: { | 911 case wasm::kExprI64UConvertF32: { |
897 return BuildI64UConvertF32(input); | 912 return BuildI64UConvertF32(input); |
898 } | 913 } |
899 // kExprI64UConvertF64: | 914 // kExprI64UConvertF64: |
900 case wasm::kExprI64UConvertF64: { | 915 case wasm::kExprI64UConvertF64: { |
901 return BuildI64UConvertF64(input); | 916 return BuildI64UConvertF64(input); |
902 } | 917 } |
903 #if WASM_64 | |
904 // Opcodes only supported on 64-bit platforms. | |
905 // TODO(titzer): query the machine operator builder here instead of #ifdef. | |
906 case wasm::kExprI64Ctz: { | |
907 if (m->Word64Ctz().IsSupported()) { | |
908 op = m->Word64Ctz().op(); | |
909 break; | |
910 } else if (m->Word64ReverseBits().IsSupported()) { | |
911 Node* reversed = graph()->NewNode(m->Word64ReverseBits().op(), input); | |
912 Node* result = graph()->NewNode(m->Word64Clz(), reversed); | |
913 return result; | |
914 } else { | |
915 return BuildI64Ctz(input); | |
916 } | |
917 } | |
918 #endif | |
919 default: | 918 default: |
920 op = UnsupportedOpcode(opcode); | 919 op = UnsupportedOpcode(opcode); |
921 } | 920 } |
922 return graph()->NewNode(op, input); | 921 return graph()->NewNode(op, input); |
923 } | 922 } |
924 | 923 |
925 | 924 |
926 Node* WasmGraphBuilder::Float32Constant(float value) { | 925 Node* WasmGraphBuilder::Float32Constant(float value) { |
927 return jsgraph()->Float32Constant(value); | 926 return jsgraph()->Float32Constant(value); |
928 } | 927 } |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 static_cast<int>(function.code_end_offset - function.code_start_offset), | 2648 static_cast<int>(function.code_end_offset - function.code_start_offset), |
2650 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); | 2649 decode_ms, static_cast<int>(graph.NodeCount()), compile_ms); |
2651 } | 2650 } |
2652 return code; | 2651 return code; |
2653 } | 2652 } |
2654 | 2653 |
2655 | 2654 |
2656 } // namespace compiler | 2655 } // namespace compiler |
2657 } // namespace internal | 2656 } // namespace internal |
2658 } // namespace v8 | 2657 } // namespace v8 |
OLD | NEW |