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

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

Issue 2438673006: [wasm] GrowMemory should update imported memory objects. (Closed)
Patch Set: Improve test Created 4 years, 2 months 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
« no previous file with comments | « src/wasm/wasm-js.cc ('k') | test/mjsunit/wasm/import-memory.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 Handle<JSArrayBuffer> buffer = NewArrayBuffer(isolate, new_size); 1899 Handle<JSArrayBuffer> buffer = NewArrayBuffer(isolate, new_size);
1900 if (buffer.is_null()) return -1; 1900 if (buffer.is_null()) return -1;
1901 Address new_mem_start = static_cast<Address>(buffer->backing_store()); 1901 Address new_mem_start = static_cast<Address>(buffer->backing_store());
1902 if (old_size != 0) { 1902 if (old_size != 0) {
1903 memcpy(new_mem_start, old_mem_start, old_size); 1903 memcpy(new_mem_start, old_mem_start, old_size);
1904 } 1904 }
1905 SetInstanceMemory(instance, *buffer); 1905 SetInstanceMemory(instance, *buffer);
1906 Handle<FixedArray> code_table = GetCompiledModule(*instance)->code_table(); 1906 Handle<FixedArray> code_table = GetCompiledModule(*instance)->code_table();
1907 RelocateMemoryReferencesInCode(code_table, old_mem_start, new_mem_start, 1907 RelocateMemoryReferencesInCode(code_table, old_mem_start, new_mem_start,
1908 old_size, new_size); 1908 old_size, new_size);
1909 Handle<Object> memory_object(instance->GetInternalField(kWasmMemObject),
1910 isolate);
1911 if (!memory_object->IsUndefined(isolate)) {
1912 WasmJs::SetWasmMemoryArrayBuffer(isolate, memory_object, buffer);
1913 }
1914
1909 DCHECK(old_size % WasmModule::kPageSize == 0); 1915 DCHECK(old_size % WasmModule::kPageSize == 0);
1910 return (old_size / WasmModule::kPageSize); 1916 return (old_size / WasmModule::kPageSize);
1911 } 1917 }
1912 1918
1913 void testing::ValidateInstancesChain(Isolate* isolate, 1919 void testing::ValidateInstancesChain(Isolate* isolate,
1914 Handle<JSObject> wasm_module, 1920 Handle<JSObject> wasm_module,
1915 int instance_count) { 1921 int instance_count) {
1916 CHECK_GE(instance_count, 0); 1922 CHECK_GE(instance_count, 0);
1917 DisallowHeapAllocation no_gc; 1923 DisallowHeapAllocation no_gc;
1918 WasmCompiledModule* compiled_module = 1924 WasmCompiledModule* compiled_module =
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 CHECK_NOT_NULL(result.val); 1987 CHECK_NOT_NULL(result.val);
1982 module = const_cast<WasmModule*>(result.val); 1988 module = const_cast<WasmModule*>(result.val);
1983 } 1989 }
1984 1990
1985 Handle<WasmModuleWrapper> module_wrapper = 1991 Handle<WasmModuleWrapper> module_wrapper =
1986 WasmModuleWrapper::New(isolate, module); 1992 WasmModuleWrapper::New(isolate, module);
1987 1993
1988 compiled_module->set_module_wrapper(module_wrapper); 1994 compiled_module->set_module_wrapper(module_wrapper);
1989 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); 1995 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module));
1990 } 1996 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-js.cc ('k') | test/mjsunit/wasm/import-memory.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698