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

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

Issue 2441353003: [wasm] Set externally passed memory non neuterable (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | 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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 983
984 //-------------------------------------------------------------------------- 984 //--------------------------------------------------------------------------
985 // Set up the memory for the new instance. 985 // Set up the memory for the new instance.
986 //-------------------------------------------------------------------------- 986 //--------------------------------------------------------------------------
987 MaybeHandle<JSArrayBuffer> old_memory; 987 MaybeHandle<JSArrayBuffer> old_memory;
988 988
989 uint32_t min_mem_pages = module_->min_mem_pages; 989 uint32_t min_mem_pages = module_->min_mem_pages;
990 isolate_->counters()->wasm_min_mem_pages_count()->AddSample(min_mem_pages); 990 isolate_->counters()->wasm_min_mem_pages_count()->AddSample(min_mem_pages);
991 // TODO(wasm): re-enable counter for max_mem_pages when we use that field. 991 // TODO(wasm): re-enable counter for max_mem_pages when we use that field.
992 992
993 if (memory_.is_null() && min_mem_pages > 0) { 993 if (!memory_.is_null()) {
994 // Set externally passed ArrayBuffer non neuterable.
995 memory_->set_is_neuterable(false);
996 } else if (min_mem_pages > 0) {
994 memory_ = AllocateMemory(min_mem_pages); 997 memory_ = AllocateMemory(min_mem_pages);
995 if (memory_.is_null()) return nothing; // failed to allocate memory 998 if (memory_.is_null()) return nothing; // failed to allocate memory
996 } 999 }
997 1000
998 if (!memory_.is_null()) { 1001 if (!memory_.is_null()) {
999 instance->SetInternalField(kWasmMemArrayBuffer, *memory_); 1002 instance->SetInternalField(kWasmMemArrayBuffer, *memory_);
1000 Address mem_start = static_cast<Address>(memory_->backing_store()); 1003 Address mem_start = static_cast<Address>(memory_->backing_store());
1001 uint32_t mem_size = 1004 uint32_t mem_size =
1002 static_cast<uint32_t>(memory_->byte_length()->Number()); 1005 static_cast<uint32_t>(memory_->byte_length()->Number());
1003 LoadDataSegments(globals, mem_start, mem_size); 1006 LoadDataSegments(globals, mem_start, mem_size);
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 CHECK_NOT_NULL(result.val); 1990 CHECK_NOT_NULL(result.val);
1988 module = const_cast<WasmModule*>(result.val); 1991 module = const_cast<WasmModule*>(result.val);
1989 } 1992 }
1990 1993
1991 Handle<WasmModuleWrapper> module_wrapper = 1994 Handle<WasmModuleWrapper> module_wrapper =
1992 WasmModuleWrapper::New(isolate, module); 1995 WasmModuleWrapper::New(isolate, module);
1993 1996
1994 compiled_module->set_module_wrapper(module_wrapper); 1997 compiled_module->set_module_wrapper(module_wrapper);
1995 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); 1998 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module));
1996 } 1999 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698