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