Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/wasm/wasm-module.cc

Issue 2548223002: [wasm] Update WasmMemoryObject correctly when module memory is exported. (Closed)
Patch Set: Add export-grow test in import-memory.js Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/base/atomic-utils.h" 7 #include "src/base/atomic-utils.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 9
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 case kExternalMemory: { 1787 case kExternalMemory: {
1788 // Export the memory as a WebAssembly.Memory object. 1788 // Export the memory as a WebAssembly.Memory object.
1789 Handle<WasmMemoryObject> memory_object; 1789 Handle<WasmMemoryObject> memory_object;
1790 if (!instance->has_memory_object()) { 1790 if (!instance->has_memory_object()) {
1791 // If there was no imported WebAssembly.Memory object, create one. 1791 // If there was no imported WebAssembly.Memory object, create one.
1792 Handle<JSArrayBuffer> buffer(instance->get_memory_buffer(), 1792 Handle<JSArrayBuffer> buffer(instance->get_memory_buffer(),
1793 isolate_); 1793 isolate_);
1794 memory_object = WasmMemoryObject::New( 1794 memory_object = WasmMemoryObject::New(
1795 isolate_, buffer, 1795 isolate_, buffer,
1796 (module_->max_mem_pages != 0) ? module_->max_mem_pages : -1); 1796 (module_->max_mem_pages != 0) ? module_->max_mem_pages : -1);
1797 instance->set_memory_object(*memory_object);
1798 } else { 1797 } else {
1799 memory_object = Handle<WasmMemoryObject>( 1798 memory_object = Handle<WasmMemoryObject>(
1800 instance->get_memory_object(), isolate_); 1799 instance->get_memory_object(), isolate_);
1801 DCHECK(WasmJs::IsWasmMemoryObject(isolate_, memory_object)); 1800 DCHECK(WasmJs::IsWasmMemoryObject(isolate_, memory_object));
1802 memory_object->ResetInstancesLink(isolate_); 1801 memory_object->ResetInstancesLink(isolate_);
1803 } 1802 }
1804 1803
1805 desc.set_value(memory_object); 1804 desc.set_value(memory_object);
1806 break; 1805 break;
1807 } 1806 }
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 MaybeHandle<String> WasmCompiledModule::GetFunctionName( 2356 MaybeHandle<String> WasmCompiledModule::GetFunctionName(
2358 Handle<WasmCompiledModule> compiled_module, uint32_t func_index) { 2357 Handle<WasmCompiledModule> compiled_module, uint32_t func_index) {
2359 DCHECK_LT(func_index, compiled_module->module()->functions.size()); 2358 DCHECK_LT(func_index, compiled_module->module()->functions.size());
2360 WasmFunction& function = compiled_module->module()->functions[func_index]; 2359 WasmFunction& function = compiled_module->module()->functions[func_index];
2361 Isolate* isolate = compiled_module->GetIsolate(); 2360 Isolate* isolate = compiled_module->GetIsolate();
2362 MaybeHandle<String> string = ExtractStringFromModuleBytes( 2361 MaybeHandle<String> string = ExtractStringFromModuleBytes(
2363 isolate, compiled_module, function.name_offset, function.name_length); 2362 isolate, compiled_module, function.name_offset, function.name_length);
2364 if (!string.is_null()) return string.ToHandleChecked(); 2363 if (!string.is_null()) return string.ToHandleChecked();
2365 return {}; 2364 return {};
2366 } 2365 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/wasm/regression-670683.js » ('j') | test/mjsunit/wasm/import-memory.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698