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/utils.h" | 6 #include "src/utils.h" |
7 | 7 |
8 #include "src/assembler-inl.h" | 8 #include "src/assembler-inl.h" |
9 #include "src/base/iterator.h" | 9 #include "src/base/iterator.h" |
10 #include "src/compiler/wasm-compiler.h" | 10 #include "src/compiler/wasm-compiler.h" |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 } | 640 } |
641 | 641 |
642 uint32_t WasmInstanceObject::GetMaxMemoryPages() { | 642 uint32_t WasmInstanceObject::GetMaxMemoryPages() { |
643 if (has_memory_object()) { | 643 if (has_memory_object()) { |
644 if (memory_object()->has_maximum_pages()) { | 644 if (memory_object()->has_maximum_pages()) { |
645 uint32_t maximum = | 645 uint32_t maximum = |
646 static_cast<uint32_t>(memory_object()->maximum_pages()); | 646 static_cast<uint32_t>(memory_object()->maximum_pages()); |
647 if (maximum < FLAG_wasm_max_mem_pages) return maximum; | 647 if (maximum < FLAG_wasm_max_mem_pages) return maximum; |
648 } | 648 } |
649 } | 649 } |
650 uint32_t compiled_max_pages = compiled_module()->max_mem_pages(); | 650 uint32_t compiled_max_pages = compiled_module()->module()->max_mem_pages; |
651 Isolate* isolate = GetIsolate(); | 651 Isolate* isolate = GetIsolate(); |
652 auto* histogram = (compiled_module()->module()->is_wasm() | 652 auto* histogram = (compiled_module()->module()->is_wasm() |
653 ? isolate->counters()->wasm_wasm_max_mem_pages_count() | 653 ? isolate->counters()->wasm_wasm_max_mem_pages_count() |
654 : isolate->counters()->wasm_asm_max_mem_pages_count()); | 654 : isolate->counters()->wasm_asm_max_mem_pages_count()); |
655 histogram->AddSample(compiled_max_pages); | 655 histogram->AddSample(compiled_max_pages); |
656 if (compiled_max_pages != 0) return compiled_max_pages; | 656 if (compiled_max_pages != 0) return compiled_max_pages; |
657 return FLAG_wasm_max_mem_pages; | 657 return FLAG_wasm_max_mem_pages; |
658 } | 658 } |
659 | 659 |
660 WasmInstanceObject* WasmExportedFunction::instance() { | 660 WasmInstanceObject* WasmExportedFunction::instance() { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 compiled_module->set_code_table(code_table); | 962 compiled_module->set_code_table(code_table); |
963 int function_table_count = | 963 int function_table_count = |
964 static_cast<int>(shared->module()->function_tables.size()); | 964 static_cast<int>(shared->module()->function_tables.size()); |
965 if (function_table_count > 0) { | 965 if (function_table_count > 0) { |
966 compiled_module->set_signature_tables( | 966 compiled_module->set_signature_tables( |
967 maybe_signature_tables.ToHandleChecked()); | 967 maybe_signature_tables.ToHandleChecked()); |
968 compiled_module->set_empty_function_tables( | 968 compiled_module->set_empty_function_tables( |
969 maybe_empty_function_tables.ToHandleChecked()); | 969 maybe_empty_function_tables.ToHandleChecked()); |
970 } | 970 } |
971 // TODO(mtrofin): we copy these because the order of finalization isn't | 971 // TODO(mtrofin): we copy these because the order of finalization isn't |
972 // reliable, and we need some of these at Reset (which is called at | 972 // reliable, and we need these at Reset (which is called at |
973 // finalization). If the order were reliable, and top-down, we could instead | 973 // finalization). If the order were reliable, and top-down, we could instead |
974 // just get them from shared(). | 974 // just get them from shared(). |
975 compiled_module->set_min_mem_pages(shared->module()->min_mem_pages); | 975 compiled_module->set_min_mem_pages(shared->module()->min_mem_pages); |
976 compiled_module->set_max_mem_pages(shared->module()->max_mem_pages); | |
977 compiled_module->set_num_imported_functions( | 976 compiled_module->set_num_imported_functions( |
978 shared->module()->num_imported_functions); | 977 shared->module()->num_imported_functions); |
979 return compiled_module; | 978 return compiled_module; |
980 } | 979 } |
981 | 980 |
982 Handle<WasmCompiledModule> WasmCompiledModule::Clone( | 981 Handle<WasmCompiledModule> WasmCompiledModule::Clone( |
983 Isolate* isolate, Handle<WasmCompiledModule> module) { | 982 Isolate* isolate, Handle<WasmCompiledModule> module) { |
984 Handle<FixedArray> code_copy = | 983 Handle<FixedArray> code_copy = |
985 isolate->factory()->CopyFixedArray(module->code_table()); | 984 isolate->factory()->CopyFixedArray(module->code_table()); |
986 Handle<WasmCompiledModule> ret = Handle<WasmCompiledModule>::cast( | 985 Handle<WasmCompiledModule> ret = Handle<WasmCompiledModule>::cast( |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1573 if (!array->get(kWrapperInstanceObject)->IsWeakCell()) return false; | 1572 if (!array->get(kWrapperInstanceObject)->IsWeakCell()) return false; |
1574 Isolate* isolate = array->GetIsolate(); | 1573 Isolate* isolate = array->GetIsolate(); |
1575 if (!array->get(kNextInstanceWrapper)->IsUndefined(isolate) && | 1574 if (!array->get(kNextInstanceWrapper)->IsUndefined(isolate) && |
1576 !array->get(kNextInstanceWrapper)->IsFixedArray()) | 1575 !array->get(kNextInstanceWrapper)->IsFixedArray()) |
1577 return false; | 1576 return false; |
1578 if (!array->get(kPreviousInstanceWrapper)->IsUndefined(isolate) && | 1577 if (!array->get(kPreviousInstanceWrapper)->IsUndefined(isolate) && |
1579 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) | 1578 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) |
1580 return false; | 1579 return false; |
1581 return true; | 1580 return true; |
1582 } | 1581 } |
OLD | NEW |