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/wasm/wasm-objects.h" | 5 #include "src/wasm/wasm-objects.h" |
6 #include "src/wasm/wasm-module.h" | 6 #include "src/wasm/wasm-module.h" |
7 | 7 |
8 #define TRACE(...) \ | 8 #define TRACE(...) \ |
9 do { \ | 9 do { \ |
10 if (FLAG_trace_wasm_instances) PrintF(__VA_ARGS__); \ | 10 if (FLAG_trace_wasm_instances) PrintF(__VA_ARGS__); \ |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 // All checks passed. | 343 // All checks passed. |
344 return true; | 344 return true; |
345 } | 345 } |
346 | 346 |
347 void WasmCompiledModule::PrintInstancesChain() { | 347 void WasmCompiledModule::PrintInstancesChain() { |
348 #if DEBUG | 348 #if DEBUG |
349 if (!FLAG_trace_wasm_instances) return; | 349 if (!FLAG_trace_wasm_instances) return; |
350 for (WasmCompiledModule* current = this; current != nullptr;) { | 350 for (WasmCompiledModule* current = this; current != nullptr;) { |
351 PrintF("->%d", current->instance_id()); | 351 PrintF("->%d", current->instance_id()); |
352 if (current->ptr_to_weak_next_instance() == nullptr) break; | 352 if (!current->has_weak_next_instance()) break; |
353 CHECK(!current->ptr_to_weak_next_instance()->cleared()); | 353 CHECK(!current->ptr_to_weak_next_instance()->cleared()); |
354 current = | 354 current = |
355 WasmCompiledModule::cast(current->ptr_to_weak_next_instance()->value()); | 355 WasmCompiledModule::cast(current->ptr_to_weak_next_instance()->value()); |
356 } | 356 } |
357 PrintF("\n"); | 357 PrintF("\n"); |
358 #endif | 358 #endif |
359 } | 359 } |
360 | 360 |
361 uint32_t WasmCompiledModule::mem_size() const { | 361 uint32_t WasmCompiledModule::mem_size() const { |
362 return has_memory() ? memory()->byte_length()->Number() : default_mem_size(); | 362 return has_memory() ? memory()->byte_length()->Number() : default_mem_size(); |
363 } | 363 } |
364 | 364 |
365 uint32_t WasmCompiledModule::default_mem_size() const { | 365 uint32_t WasmCompiledModule::default_mem_size() const { |
366 return min_mem_pages() * WasmModule::kPageSize; | 366 return min_mem_pages() * WasmModule::kPageSize; |
367 } | 367 } |
OLD | NEW |