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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
| 8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
| 9 #include "src/base/atomic-utils.h" | 9 #include "src/base/atomic-utils.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1146 // Build an instance, in all of its glory. | 1146 // Build an instance, in all of its glory. |
| 1147 MaybeHandle<WasmInstanceObject> Build() { | 1147 MaybeHandle<WasmInstanceObject> Build() { |
| 1148 // Check that an imports argument was provided, if the module requires it. | 1148 // Check that an imports argument was provided, if the module requires it. |
| 1149 // No point in continuing otherwise. | 1149 // No point in continuing otherwise. |
| 1150 if (!module_->import_table.empty() && ffi_.is_null()) { | 1150 if (!module_->import_table.empty() && ffi_.is_null()) { |
| 1151 thrower_->TypeError( | 1151 thrower_->TypeError( |
| 1152 "Imports argument must be present and must be an object"); | 1152 "Imports argument must be present and must be an object"); |
| 1153 return {}; | 1153 return {}; |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 // Record build time into correct bucket, then build instance. | |
| 1156 HistogramTimerScope wasm_instantiate_module_time_scope( | 1157 HistogramTimerScope wasm_instantiate_module_time_scope( |
| 1157 isolate_->counters()->wasm_instantiate_module_time()); | 1158 module_->origin == ModuleOrigin::kWasmOrigin |
|
bradnelson
2017/03/24 17:25:10
Ah, good idea.
| |
| 1159 ? isolate_->counters()->wasm_instantiate_wasm_module_time() | |
| 1160 : isolate_->counters()->wasm_instantiate_asm_module_time()); | |
| 1158 Factory* factory = isolate_->factory(); | 1161 Factory* factory = isolate_->factory(); |
| 1159 | 1162 |
| 1160 //-------------------------------------------------------------------------- | 1163 //-------------------------------------------------------------------------- |
| 1161 // Reuse the compiled module (if no owner), otherwise clone. | 1164 // Reuse the compiled module (if no owner), otherwise clone. |
| 1162 //-------------------------------------------------------------------------- | 1165 //-------------------------------------------------------------------------- |
| 1163 Handle<FixedArray> code_table; | 1166 Handle<FixedArray> code_table; |
| 1164 Handle<FixedArray> old_code_table; | 1167 Handle<FixedArray> old_code_table; |
| 1165 MaybeHandle<WasmInstanceObject> owner; | 1168 MaybeHandle<WasmInstanceObject> owner; |
| 1166 | 1169 |
| 1167 TRACE("Starting new module instantiation\n"); | 1170 TRACE("Starting new module instantiation\n"); |
| (...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3202 callee_compiled->instruction_start()); | 3205 callee_compiled->instruction_start()); |
| 3203 } | 3206 } |
| 3204 DCHECK_EQ(non_compiled_functions.size(), idx); | 3207 DCHECK_EQ(non_compiled_functions.size(), idx); |
| 3205 } | 3208 } |
| 3206 | 3209 |
| 3207 Code* ret = | 3210 Code* ret = |
| 3208 Code::cast(compiled_module->code_table()->get(func_to_return_idx)); | 3211 Code::cast(compiled_module->code_table()->get(func_to_return_idx)); |
| 3209 DCHECK_EQ(Code::WASM_FUNCTION, ret->kind()); | 3212 DCHECK_EQ(Code::WASM_FUNCTION, ret->kind()); |
| 3210 return handle(ret, isolate); | 3213 return handle(ret, isolate); |
| 3211 } | 3214 } |
| OLD | NEW |