Chromium Code Reviews| 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 3033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3044 compile_timer.Start(); | 3044 compile_timer.Start(); |
| 3045 } | 3045 } |
| 3046 Handle<Code> code = info_.code(); | 3046 Handle<Code> code = info_.code(); |
| 3047 DCHECK(!code.is_null()); | 3047 DCHECK(!code.is_null()); |
| 3048 DCHECK(code->deoptimization_data() == nullptr || | 3048 DCHECK(code->deoptimization_data() == nullptr || |
| 3049 code->deoptimization_data()->length() == 0); | 3049 code->deoptimization_data()->length() == 0); |
| 3050 Handle<FixedArray> deopt_data = | 3050 Handle<FixedArray> deopt_data = |
| 3051 isolate_->factory()->NewFixedArray(2, TENURED); | 3051 isolate_->factory()->NewFixedArray(2, TENURED); |
| 3052 if (!module_env_->instance->js_object.is_null()) { | 3052 if (!module_env_->instance->js_object.is_null()) { |
| 3053 deopt_data->set(0, *module_env_->instance->js_object); | 3053 deopt_data->set(0, *module_env_->instance->js_object); |
| 3054 deopt_data->set(1, Smi::FromInt(function_->func_index)); | 3054 } else { |
| 3055 } else if (info_.GetDebugName().get() != nullptr) { | 3055 base::SmartArrayPointer<char> debug_name = info_.GetDebugName(); |
| 3056 MaybeHandle<String> maybe_name = isolate_->factory()->NewStringFromUtf8( | 3056 MaybeHandle<String> maybe_name; |
| 3057 CStrVector(info_.GetDebugName().get())); | 3057 if (debug_name.get() != nullptr) |
| 3058 maybe_name = isolate_->factory()->NewStringFromUtf8( | |
|
Yang
2016/05/03 18:59:07
Can we have brackets around if-body here and below
Clemens Hammacher
2016/05/04 09:06:19
It turned out the first if is even redundant, so I
| |
| 3059 CStrVector(debug_name.get())); | |
| 3058 if (!maybe_name.is_null()) | 3060 if (!maybe_name.is_null()) |
| 3059 deopt_data->set(0, *maybe_name.ToHandleChecked()); | 3061 deopt_data->set(0, *maybe_name.ToHandleChecked()); |
| 3060 } | 3062 } |
| 3063 deopt_data->set(1, Smi::FromInt(function_->func_index)); | |
| 3061 deopt_data->set_length(2); | 3064 deopt_data->set_length(2); |
| 3062 code->set_deoptimization_data(*deopt_data); | 3065 code->set_deoptimization_data(*deopt_data); |
| 3063 | 3066 |
| 3064 RecordFunctionCompilation( | 3067 RecordFunctionCompilation( |
| 3065 Logger::FUNCTION_TAG, &info_, "WASM_function", function_->func_index, | 3068 Logger::FUNCTION_TAG, &info_, "WASM_function", function_->func_index, |
| 3066 module_env_->module->GetName(function_->name_offset, | 3069 module_env_->module->GetName(function_->name_offset, |
| 3067 function_->name_length)); | 3070 function_->name_length)); |
| 3068 | 3071 |
| 3069 if (FLAG_trace_wasm_decode_time) { | 3072 if (FLAG_trace_wasm_decode_time) { |
| 3070 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); | 3073 double compile_ms = compile_timer.Elapsed().InMillisecondsF(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3114 const wasm::WasmFunction* function) { | 3117 const wasm::WasmFunction* function) { |
| 3115 WasmCompilationUnit* unit = | 3118 WasmCompilationUnit* unit = |
| 3116 CreateWasmCompilationUnit(thrower, isolate, module_env, function, 0); | 3119 CreateWasmCompilationUnit(thrower, isolate, module_env, function, 0); |
| 3117 ExecuteCompilation(unit); | 3120 ExecuteCompilation(unit); |
| 3118 return FinishCompilation(unit); | 3121 return FinishCompilation(unit); |
| 3119 } | 3122 } |
| 3120 | 3123 |
| 3121 } // namespace compiler | 3124 } // namespace compiler |
| 3122 } // namespace internal | 3125 } // namespace internal |
| 3123 } // namespace v8 | 3126 } // namespace v8 |
| OLD | NEW |