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

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

Issue 2474333003: [wasm] Exported memory should set maximum property when maximum is defined. (Closed)
Patch Set: Format 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 | test/mjsunit/wasm/import-memory.js » ('j') | test/mjsunit/wasm/import-memory.js » ('J')
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 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 case kExternalMemory: { 1669 case kExternalMemory: {
1670 // Export the memory as a WebAssembly.Memory object. 1670 // Export the memory as a WebAssembly.Memory object.
1671 Handle<Object> memory_object( 1671 Handle<Object> memory_object(
1672 instance->GetInternalField(kWasmMemObject), isolate_); 1672 instance->GetInternalField(kWasmMemObject), isolate_);
1673 if (memory_object->IsUndefined(isolate_)) { 1673 if (memory_object->IsUndefined(isolate_)) {
1674 // If there was no imported WebAssembly.Memory object, create one. 1674 // If there was no imported WebAssembly.Memory object, create one.
1675 Handle<JSArrayBuffer> buffer( 1675 Handle<JSArrayBuffer> buffer(
1676 JSArrayBuffer::cast( 1676 JSArrayBuffer::cast(
1677 instance->GetInternalField(kWasmMemArrayBuffer)), 1677 instance->GetInternalField(kWasmMemArrayBuffer)),
1678 isolate_); 1678 isolate_);
1679 memory_object = 1679 memory_object = WasmJs::CreateWasmMemoryObject(
1680 WasmJs::CreateWasmMemoryObject(isolate_, buffer, false, 0); 1680 isolate_, buffer, (module_->max_mem_pages != 0),
1681 module_->max_mem_pages);
1681 instance->SetInternalField(kWasmMemObject, *memory_object); 1682 instance->SetInternalField(kWasmMemObject, *memory_object);
1682 } 1683 }
1683 1684
1684 desc.set_value(memory_object); 1685 desc.set_value(memory_object);
1685 break; 1686 break;
1686 } 1687 }
1687 case kExternalGlobal: { 1688 case kExternalGlobal: {
1688 // Export the value of the global variable as a number. 1689 // Export the value of the global variable as a number.
1689 WasmGlobal& global = module_->globals[exp.index]; 1690 WasmGlobal& global = module_->globals[exp.index];
1690 double num = 0; 1691 double num = 0;
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 CHECK_NOT_NULL(result.val); 2233 CHECK_NOT_NULL(result.val);
2233 module = const_cast<WasmModule*>(result.val); 2234 module = const_cast<WasmModule*>(result.val);
2234 } 2235 }
2235 2236
2236 Handle<WasmModuleWrapper> module_wrapper = 2237 Handle<WasmModuleWrapper> module_wrapper =
2237 WasmModuleWrapper::New(isolate, module); 2238 WasmModuleWrapper::New(isolate, module);
2238 2239
2239 compiled_module->set_module_wrapper(module_wrapper); 2240 compiled_module->set_module_wrapper(module_wrapper);
2240 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); 2241 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module));
2241 } 2242 }
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/wasm/import-memory.js » ('j') | test/mjsunit/wasm/import-memory.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698