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 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2970 CompilationInfo info(func_name, isolate, jsgraph->graph()->zone(), flags); | 2970 CompilationInfo info(func_name, isolate, jsgraph->graph()->zone(), flags); |
2971 base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob( | 2971 base::SmartPointer<CompilationJob> job(Pipeline::NewWasmCompilationJob( |
2972 &info, jsgraph->graph(), descriptor, source_positions)); | 2972 &info, jsgraph->graph(), descriptor, source_positions)); |
2973 Handle<Code> code = Handle<Code>::null(); | 2973 Handle<Code> code = Handle<Code>::null(); |
2974 if (job->OptimizeGraph() == CompilationJob::SUCCEEDED && | 2974 if (job->OptimizeGraph() == CompilationJob::SUCCEEDED && |
2975 job->GenerateCode() == CompilationJob::SUCCEEDED) { | 2975 job->GenerateCode() == CompilationJob::SUCCEEDED) { |
2976 code = info.code(); | 2976 code = info.code(); |
2977 } | 2977 } |
2978 | 2978 |
2979 buffer.Dispose(); | 2979 buffer.Dispose(); |
| 2980 |
2980 if (!code.is_null()) { | 2981 if (!code.is_null()) { |
| 2982 DCHECK(code->deoptimization_data() == nullptr || |
| 2983 code->deoptimization_data()->length() == 0); |
| 2984 Handle<FixedArray> deopt_data = |
| 2985 isolate->factory()->NewFixedArray(2, TENURED); |
| 2986 if (!module_env->instance->js_object.is_null()) { |
| 2987 deopt_data->set(0, *module_env->instance->js_object); |
| 2988 deopt_data->set(1, Smi::FromInt(function->func_index)); |
| 2989 } else if (func_name.start() != nullptr) { |
| 2990 MaybeHandle<String> maybe_name = |
| 2991 isolate->factory()->NewStringFromUtf8(func_name); |
| 2992 if (!maybe_name.is_null()) |
| 2993 deopt_data->set(0, *maybe_name.ToHandleChecked()); |
| 2994 } |
| 2995 deopt_data->set_length(2); |
| 2996 code->set_deoptimization_data(*deopt_data); |
| 2997 |
2981 RecordFunctionCompilation( | 2998 RecordFunctionCompilation( |
2982 Logger::FUNCTION_TAG, &info, "WASM_function", function->func_index, | 2999 Logger::FUNCTION_TAG, &info, "WASM_function", function->func_index, |
2983 module_env->module->GetName(function->name_offset, | 3000 module_env->module->GetName(function->name_offset, |
2984 function->name_length)); | 3001 function->name_length)); |
2985 } | 3002 } |
2986 | 3003 |
2987 if (FLAG_trace_wasm_decode_time) { | 3004 if (FLAG_trace_wasm_decode_time) { |
2988 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); | 3005 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); |
2989 PrintF( | 3006 PrintF( |
2990 "wasm-compile ok: %d bytes, %0.3f ms decode, %d nodes, %0.3f ms " | 3007 "wasm-compile ok: %d bytes, %0.3f ms decode, %d nodes, %0.3f ms " |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3040 | 3057 |
3041 Handle<Code> FinishCompilation(WasmCompilationUnit* unit) { | 3058 Handle<Code> FinishCompilation(WasmCompilationUnit* unit) { |
3042 Handle<Code> result = unit->FinishCompilation(); | 3059 Handle<Code> result = unit->FinishCompilation(); |
3043 delete unit; | 3060 delete unit; |
3044 return result; | 3061 return result; |
3045 } | 3062 } |
3046 | 3063 |
3047 } // namespace compiler | 3064 } // namespace compiler |
3048 } // namespace internal | 3065 } // namespace internal |
3049 } // namespace v8 | 3066 } // namespace v8 |
OLD | NEW |