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/platform.h" | 9 #include "src/base/platform/platform.h" |
10 | 10 |
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 } | 839 } |
840 case wasm::kExprF64Tan: { | 840 case wasm::kExprF64Tan: { |
841 return BuildF64Tan(input); | 841 return BuildF64Tan(input); |
842 } | 842 } |
843 case wasm::kExprF64Exp: { | 843 case wasm::kExprF64Exp: { |
844 return BuildF64Exp(input); | 844 return BuildF64Exp(input); |
845 } | 845 } |
846 case wasm::kExprF64Log: { | 846 case wasm::kExprF64Log: { |
847 return BuildF64Log(input); | 847 return BuildF64Log(input); |
848 } | 848 } |
| 849 // kExprI32ConvertI64: |
849 case wasm::kExprI32ConvertI64: | 850 case wasm::kExprI32ConvertI64: |
850 op = m->TruncateInt64ToInt32(); | 851 op = m->TruncateInt64ToInt32(); |
851 break; | 852 break; |
852 | |
853 // kExprI32ConvertI64: | |
854 // kExprI64SConvertI32: | 853 // kExprI64SConvertI32: |
| 854 case wasm::kExprI64SConvertI32: |
| 855 op = m->ChangeInt32ToInt64(); |
| 856 break; |
855 // kExprI64UConvertI32: | 857 // kExprI64UConvertI32: |
| 858 case wasm::kExprI64UConvertI32: |
| 859 op = m->ChangeUint32ToUint64(); |
| 860 break; |
856 // kExprF64ReinterpretI64: | 861 // kExprF64ReinterpretI64: |
857 // kExprI64ReinterpretF64: | 862 // kExprI64ReinterpretF64: |
858 // kExprI64Clz: | 863 // kExprI64Clz: |
859 // kExprI64Ctz: | 864 // kExprI64Ctz: |
860 // kExprI64Popcnt: | 865 // kExprI64Popcnt: |
861 // kExprF32SConvertI64: | 866 // kExprF32SConvertI64: |
862 case wasm::kExprF32SConvertI64: | 867 case wasm::kExprF32SConvertI64: |
863 if (m->Is32()) { | 868 if (m->Is32()) { |
864 return BuildF32SConvertI64(input); | 869 return BuildF32SConvertI64(input); |
865 } | 870 } |
(...skipping 20 matching lines...) Expand all Loading... |
886 } | 891 } |
887 op = m->RoundUint64ToFloat64(); | 892 op = m->RoundUint64ToFloat64(); |
888 break; | 893 break; |
889 // kExprI64SConvertF32: | 894 // kExprI64SConvertF32: |
890 // kExprI64SConvertF64: | 895 // kExprI64SConvertF64: |
891 // kExprI64UConvertF32: | 896 // kExprI64UConvertF32: |
892 // kExprI64UConvertF64: | 897 // kExprI64UConvertF64: |
893 #if WASM_64 | 898 #if WASM_64 |
894 // Opcodes only supported on 64-bit platforms. | 899 // Opcodes only supported on 64-bit platforms. |
895 // TODO(titzer): query the machine operator builder here instead of #ifdef. | 900 // TODO(titzer): query the machine operator builder here instead of #ifdef. |
896 case wasm::kExprI64SConvertI32: | |
897 op = m->ChangeInt32ToInt64(); | |
898 break; | |
899 case wasm::kExprI64UConvertI32: | |
900 op = m->ChangeUint32ToUint64(); | |
901 break; | |
902 case wasm::kExprI64SConvertF32: { | 901 case wasm::kExprI64SConvertF32: { |
903 Node* trunc = graph()->NewNode(m->TryTruncateFloat32ToInt64(), input); | 902 Node* trunc = graph()->NewNode(m->TryTruncateFloat32ToInt64(), input); |
904 Node* result = | 903 Node* result = |
905 graph()->NewNode(jsgraph()->common()->Projection(0), trunc); | 904 graph()->NewNode(jsgraph()->common()->Projection(0), trunc); |
906 Node* overflow = | 905 Node* overflow = |
907 graph()->NewNode(jsgraph()->common()->Projection(1), trunc); | 906 graph()->NewNode(jsgraph()->common()->Projection(1), trunc); |
908 trap_->ZeroCheck64(kTrapFloatUnrepresentable, overflow); | 907 trap_->ZeroCheck64(kTrapFloatUnrepresentable, overflow); |
909 return result; | 908 return result; |
910 } | 909 } |
911 case wasm::kExprI64SConvertF64: { | 910 case wasm::kExprI64SConvertF64: { |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2474 module_env->module->GetName(function.name_offset)); | 2473 module_env->module->GetName(function.name_offset)); |
2475 } | 2474 } |
2476 | 2475 |
2477 return code; | 2476 return code; |
2478 } | 2477 } |
2479 | 2478 |
2480 | 2479 |
2481 } // namespace compiler | 2480 } // namespace compiler |
2482 } // namespace internal | 2481 } // namespace internal |
2483 } // namespace v8 | 2482 } // namespace v8 |
OLD | NEW |