| 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 // kExprI32ConvertI64: | 855 // kExprI32ConvertI64: |
| 856 // kExprI64SConvertI32: | 856 // kExprI64SConvertI32: |
| 857 // kExprI64UConvertI32: | 857 // kExprI64UConvertI32: |
| 858 // kExprF64ReinterpretI64: | 858 // kExprF64ReinterpretI64: |
| 859 // kExprI64ReinterpretF64: | 859 // kExprI64ReinterpretF64: |
| 860 // kExprI64Clz: | 860 // kExprI64Clz: |
| 861 // kExprI64Ctz: | 861 // kExprI64Ctz: |
| 862 // kExprI64Popcnt: | 862 // kExprI64Popcnt: |
| 863 // kExprF32SConvertI64: | 863 // kExprF32SConvertI64: |
| 864 case wasm::kExprF32SConvertI64: | 864 case wasm::kExprF32SConvertI64: |
| 865 if (kPointerSize == 4) { | 865 if (m->Is32()) { |
| 866 return BuildF32SConvertI64(input); | 866 return BuildF32SConvertI64(input); |
| 867 } | 867 } |
| 868 op = m->RoundInt64ToFloat32(); | 868 op = m->RoundInt64ToFloat32(); |
| 869 break; | 869 break; |
| 870 // kExprF32UConvertI64: | 870 // kExprF32UConvertI64: |
| 871 case wasm::kExprF32UConvertI64: | 871 case wasm::kExprF32UConvertI64: |
| 872 if (kPointerSize == 4) { | 872 if (m->Is32()) { |
| 873 return BuildF32UConvertI64(input); | 873 return BuildF32UConvertI64(input); |
| 874 } | 874 } |
| 875 op = m->RoundUint64ToFloat32(); | 875 op = m->RoundUint64ToFloat32(); |
| 876 break; | 876 break; |
| 877 // kExprF64SConvertI64: | 877 // kExprF64SConvertI64: |
| 878 case wasm::kExprF64SConvertI64: | 878 case wasm::kExprF64SConvertI64: |
| 879 if (kPointerSize == 4) { | 879 if (m->Is32()) { |
| 880 return BuildF64SConvertI64(input); | 880 return BuildF64SConvertI64(input); |
| 881 } | 881 } |
| 882 op = m->RoundInt64ToFloat64(); | 882 op = m->RoundInt64ToFloat64(); |
| 883 break; | 883 break; |
| 884 // kExprF64UConvertI64: | 884 // kExprF64UConvertI64: |
| 885 case wasm::kExprF64UConvertI64: | 885 case wasm::kExprF64UConvertI64: |
| 886 if (kPointerSize == 4) { | 886 if (m->Is32()) { |
| 887 return BuildF64UConvertI64(input); | 887 return BuildF64UConvertI64(input); |
| 888 } | 888 } |
| 889 op = m->RoundUint64ToFloat64(); | 889 op = m->RoundUint64ToFloat64(); |
| 890 break; | 890 break; |
| 891 // kExprI64SConvertF32: | 891 // kExprI64SConvertF32: |
| 892 // kExprI64SConvertF64: | 892 // kExprI64SConvertF64: |
| 893 // kExprI64UConvertF32: | 893 // kExprI64UConvertF32: |
| 894 // kExprI64UConvertF64: | 894 // kExprI64UConvertF64: |
| 895 #if WASM_64 | 895 #if WASM_64 |
| 896 // Opcodes only supported on 64-bit platforms. | 896 // Opcodes only supported on 64-bit platforms. |
| (...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 | 2189 |
| 2190 Node* WasmGraphBuilder::String(const char* string) { | 2190 Node* WasmGraphBuilder::String(const char* string) { |
| 2191 return jsgraph()->Constant( | 2191 return jsgraph()->Constant( |
| 2192 jsgraph()->isolate()->factory()->NewStringFromAsciiChecked(string)); | 2192 jsgraph()->isolate()->factory()->NewStringFromAsciiChecked(string)); |
| 2193 } | 2193 } |
| 2194 | 2194 |
| 2195 | 2195 |
| 2196 Graph* WasmGraphBuilder::graph() { return jsgraph()->graph(); } | 2196 Graph* WasmGraphBuilder::graph() { return jsgraph()->graph(); } |
| 2197 | 2197 |
| 2198 void WasmGraphBuilder::Int64LoweringForTesting() { | 2198 void WasmGraphBuilder::Int64LoweringForTesting() { |
| 2199 if (kPointerSize == 4) { | 2199 if (jsgraph()->machine()->Is32()) { |
| 2200 Int64Lowering r(jsgraph()->graph(), jsgraph()->machine(), | 2200 Int64Lowering r(jsgraph()->graph(), jsgraph()->machine(), |
| 2201 jsgraph()->common(), jsgraph()->zone(), | 2201 jsgraph()->common(), jsgraph()->zone(), |
| 2202 function_signature_); | 2202 function_signature_); |
| 2203 r.LowerGraph(); | 2203 r.LowerGraph(); |
| 2204 } | 2204 } |
| 2205 } | 2205 } |
| 2206 | 2206 |
| 2207 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 2207 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 2208 CompilationInfo* info, | 2208 CompilationInfo* info, |
| 2209 const char* message, uint32_t index, | 2209 const char* message, uint32_t index, |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2435 SNPrintF(buffer, "Compiling WASM function #%d:%s failed:", | 2435 SNPrintF(buffer, "Compiling WASM function #%d:%s failed:", |
| 2436 function.func_index, | 2436 function.func_index, |
| 2437 module_env->module->GetName(function.name_offset)); | 2437 module_env->module->GetName(function.name_offset)); |
| 2438 thrower.Failed(buffer.start(), result); | 2438 thrower.Failed(buffer.start(), result); |
| 2439 return Handle<Code>::null(); | 2439 return Handle<Code>::null(); |
| 2440 } | 2440 } |
| 2441 | 2441 |
| 2442 // Run the compiler pipeline to generate machine code. | 2442 // Run the compiler pipeline to generate machine code. |
| 2443 CallDescriptor* descriptor = | 2443 CallDescriptor* descriptor = |
| 2444 wasm::ModuleEnv::GetWasmCallDescriptor(&zone, function.sig); | 2444 wasm::ModuleEnv::GetWasmCallDescriptor(&zone, function.sig); |
| 2445 if (kPointerSize == 4) { | 2445 if (machine.Is32()) { |
| 2446 descriptor = module_env->GetI32WasmCallDescriptor(&zone, descriptor); | 2446 descriptor = module_env->GetI32WasmCallDescriptor(&zone, descriptor); |
| 2447 } | 2447 } |
| 2448 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION); | 2448 Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION); |
| 2449 // add flags here if a meaningful name is helpful for debugging. | 2449 // add flags here if a meaningful name is helpful for debugging. |
| 2450 bool debugging = | 2450 bool debugging = |
| 2451 #if DEBUG | 2451 #if DEBUG |
| 2452 true; | 2452 true; |
| 2453 #else | 2453 #else |
| 2454 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; | 2454 FLAG_print_opt_code || FLAG_trace_turbo || FLAG_trace_turbo_graph; |
| 2455 #endif | 2455 #endif |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2474 module_env->module->GetName(function.name_offset)); | 2474 module_env->module->GetName(function.name_offset)); |
| 2475 } | 2475 } |
| 2476 | 2476 |
| 2477 return code; | 2477 return code; |
| 2478 } | 2478 } |
| 2479 | 2479 |
| 2480 | 2480 |
| 2481 } // namespace compiler | 2481 } // namespace compiler |
| 2482 } // namespace internal | 2482 } // namespace internal |
| 2483 } // namespace v8 | 2483 } // namespace v8 |
| OLD | NEW |