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 3263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3274 } | 3274 } |
3275 if (job_->GenerateCode() != CompilationJob::SUCCEEDED) { | 3275 if (job_->GenerateCode() != CompilationJob::SUCCEEDED) { |
3276 return Handle<Code>::null(); | 3276 return Handle<Code>::null(); |
3277 } | 3277 } |
3278 base::ElapsedTimer compile_timer; | 3278 base::ElapsedTimer compile_timer; |
3279 if (FLAG_trace_wasm_decode_time) { | 3279 if (FLAG_trace_wasm_decode_time) { |
3280 compile_timer.Start(); | 3280 compile_timer.Start(); |
3281 } | 3281 } |
3282 Handle<Code> code = info_.code(); | 3282 Handle<Code> code = info_.code(); |
3283 DCHECK(!code.is_null()); | 3283 DCHECK(!code.is_null()); |
3284 DCHECK(code->deoptimization_data() == nullptr || | |
3285 code->deoptimization_data()->length() == 0); | |
3286 Handle<FixedArray> deopt_data = | |
3287 isolate_->factory()->NewFixedArray(2, TENURED); | |
3288 if (!module_env_->instance->js_object().is_null()) { | |
3289 deopt_data->set(0, *module_env_->instance->js_object()); | |
3290 } | |
3291 deopt_data->set(1, Smi::FromInt(function_->func_index)); | |
3292 deopt_data->set_length(2); | |
3293 code->set_deoptimization_data(*deopt_data); | |
3294 | 3284 |
3295 RecordFunctionCompilation( | 3285 RecordFunctionCompilation( |
3296 Logger::FUNCTION_TAG, &info_, "WASM_function", function_->func_index, | 3286 Logger::FUNCTION_TAG, &info_, "WASM_function", function_->func_index, |
3297 module_env_->module->GetName(function_->name_offset, | 3287 module_env_->module->GetName(function_->name_offset, |
3298 function_->name_length)); | 3288 function_->name_length)); |
3299 | 3289 |
3300 if (FLAG_trace_wasm_decode_time) { | 3290 if (FLAG_trace_wasm_decode_time) { |
3301 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); | 3291 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); |
3302 PrintF("wasm-code-generation ok: %d bytes, %0.3f ms code generation\n", | 3292 PrintF("wasm-code-generation ok: %d bytes, %0.3f ms code generation\n", |
3303 static_cast<int>(function_->code_end_offset - | 3293 static_cast<int>(function_->code_end_offset - |
3304 function_->code_start_offset), | 3294 function_->code_start_offset), |
3305 compile_ms); | 3295 compile_ms); |
3306 } | 3296 } |
3307 | 3297 |
3308 return code; | 3298 return code; |
3309 } | 3299 } |
3310 | 3300 |
3311 } // namespace compiler | 3301 } // namespace compiler |
3312 } // namespace internal | 3302 } // namespace internal |
3313 } // namespace v8 | 3303 } // namespace v8 |
OLD | NEW |