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

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

Issue 1538543002: Have WasmModule free it's own memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: one more file Created 5 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
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | test/cctest/wasm/test-run-wasm.cc » ('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 #ifndef V8_WASM_MODULE_H_ 5 #ifndef V8_WASM_MODULE_H_
6 #define V8_WASM_MODULE_H_ 6 #define V8_WASM_MODULE_H_
7 7
8 #include "src/wasm/wasm-opcodes.h" 8 #include "src/wasm/wasm-opcodes.h"
9 #include "src/wasm/wasm-result.h" 9 #include "src/wasm/wasm-result.h"
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 uint8_t max_mem_size_log2; // maximum size of the memory (log base 2). 92 uint8_t max_mem_size_log2; // maximum size of the memory (log base 2).
93 bool mem_export; // true if the memory is exported. 93 bool mem_export; // true if the memory is exported.
94 bool mem_external; // true if the memory is external. 94 bool mem_external; // true if the memory is external.
95 95
96 std::vector<WasmGlobal>* globals; // globals in this module. 96 std::vector<WasmGlobal>* globals; // globals in this module.
97 std::vector<FunctionSig*>* signatures; // signatures in this module. 97 std::vector<FunctionSig*>* signatures; // signatures in this module.
98 std::vector<WasmFunction>* functions; // functions in this module. 98 std::vector<WasmFunction>* functions; // functions in this module.
99 std::vector<WasmDataSegment>* data_segments; // data segments in this module. 99 std::vector<WasmDataSegment>* data_segments; // data segments in this module.
100 std::vector<uint16_t>* function_table; // function table. 100 std::vector<uint16_t>* function_table; // function table.
101 101
102 WasmModule();
103 ~WasmModule();
104
102 // Get a pointer to a string stored in the module bytes representing a name. 105 // Get a pointer to a string stored in the module bytes representing a name.
103 const char* GetName(uint32_t offset) { 106 const char* GetName(uint32_t offset) {
104 CHECK(BoundsCheck(offset, offset + 1)); 107 CHECK(BoundsCheck(offset, offset + 1));
105 if (offset == 0) return "<?>"; // no name. 108 if (offset == 0) return "<?>"; // no name.
106 return reinterpret_cast<const char*>(module_start + offset); 109 return reinterpret_cast<const char*>(module_start + offset);
107 } 110 }
108 111
109 // Checks the given offset range is contained within the module bytes. 112 // Checks the given offset range is contained within the module bytes.
110 bool BoundsCheck(uint32_t start, uint32_t end) { 113 bool BoundsCheck(uint32_t start, uint32_t end) {
111 size_t size = module_end - module_start; 114 size_t size = module_end - module_start;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 const byte* module_end, bool asm_js = false); 182 const byte* module_end, bool asm_js = false);
180 183
181 // For testing. Decode, verify, and run the last exported function in the 184 // For testing. Decode, verify, and run the last exported function in the
182 // given decoded module. 185 // given decoded module.
183 int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module); 186 int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module);
184 } // namespace wasm 187 } // namespace wasm
185 } // namespace internal 188 } // namespace internal
186 } // namespace v8 189 } // namespace v8
187 190
188 #endif // V8_WASM_MODULE_H_ 191 #endif // V8_WASM_MODULE_H_
OLDNEW
« no previous file with comments | « no previous file | src/wasm/wasm-module.cc » ('j') | test/cctest/wasm/test-run-wasm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698