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.h

Issue 2454503005: [wasm] Support for restricted table imports. (Closed)
Patch Set: Fix GC stress issue; tables weren't being reset correctly 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 | « src/wasm/wasm-js.cc ('k') | src/wasm/wasm-module.cc » ('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 #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 <memory> 8 #include <memory>
9 9
10 #include "src/api.h" 10 #include "src/api.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 // Static representation of a wasm data segment. 127 // Static representation of a wasm data segment.
128 struct WasmDataSegment { 128 struct WasmDataSegment {
129 WasmInitExpr dest_addr; // destination memory address of the data. 129 WasmInitExpr dest_addr; // destination memory address of the data.
130 uint32_t source_offset; // start offset in the module bytes. 130 uint32_t source_offset; // start offset in the module bytes.
131 uint32_t source_size; // end offset in the module bytes. 131 uint32_t source_size; // end offset in the module bytes.
132 }; 132 };
133 133
134 // Static representation of a wasm indirect call table. 134 // Static representation of a wasm indirect call table.
135 struct WasmIndirectFunctionTable { 135 struct WasmIndirectFunctionTable {
136 uint32_t size; // initial table size. 136 uint32_t min_size; // minimum table size.
137 uint32_t max_size; // maximum table size. 137 uint32_t max_size; // maximum table size.
138 bool has_max; // true if there is a maximum size.
139 // TODO(titzer): Move this to WasmInstance. Needed by interpreter only.
138 std::vector<int32_t> values; // function table, -1 indicating invalid. 140 std::vector<int32_t> values; // function table, -1 indicating invalid.
139 bool imported; // true if imported. 141 bool imported; // true if imported.
140 bool exported; // true if exported. 142 bool exported; // true if exported.
141 SignatureMap map; // canonicalizing map for sig indexes. 143 SignatureMap map; // canonicalizing map for sig indexes.
142 }; 144 };
143 145
144 // Static representation of how to initialize a table. 146 // Static representation of how to initialize a table.
145 struct WasmTableInit { 147 struct WasmTableInit {
146 uint32_t table_index; 148 uint32_t table_index;
147 WasmInitExpr offset; 149 WasmInitExpr offset;
(...skipping 18 matching lines...) Expand all
166 uint32_t index; // index into the respective space. 168 uint32_t index; // index into the respective space.
167 }; 169 };
168 170
169 enum ModuleOrigin { kWasmOrigin, kAsmJsOrigin }; 171 enum ModuleOrigin { kWasmOrigin, kAsmJsOrigin };
170 172
171 class WasmCompiledModule; 173 class WasmCompiledModule;
172 174
173 // Static representation of a module. 175 // Static representation of a module.
174 struct V8_EXPORT_PRIVATE WasmModule { 176 struct V8_EXPORT_PRIVATE WasmModule {
175 static const uint32_t kPageSize = 0x10000; // Page size, 64kb. 177 static const uint32_t kPageSize = 0x10000; // Page size, 64kb.
176 static const uint32_t kMaxLegalPages = 65536; // Maximum legal pages
177 static const uint32_t kMinMemPages = 1; // Minimum memory size = 64kb 178 static const uint32_t kMinMemPages = 1; // Minimum memory size = 64kb
178 static const uint32_t kMaxMemPages = 16384; // Maximum memory size = 1gb 179 static const size_t kV8MaxPages = 16384; // Maximum memory size = 1gb
180 static const size_t kV8MaxTableSize = 16 * 1024 * 1024;
179 181
180 Zone* owned_zone; 182 Zone* owned_zone;
181 const byte* module_start = nullptr; // starting address for the module bytes 183 const byte* module_start = nullptr; // starting address for the module bytes
182 const byte* module_end = nullptr; // end address for the module bytes 184 const byte* module_end = nullptr; // end address for the module bytes
183 uint32_t min_mem_pages = 0; // minimum size of the memory in 64k pages 185 uint32_t min_mem_pages = 0; // minimum size of the memory in 64k pages
184 uint32_t max_mem_pages = 0; // maximum size of the memory in 64k pages 186 uint32_t max_mem_pages = 0; // maximum size of the memory in 64k pages
185 bool mem_export = false; // true if the memory is exported 187 bool mem_export = false; // true if the memory is exported
186 // TODO(wasm): reconcile start function index being an int with 188 // TODO(wasm): reconcile start function index being an int with
187 // the fact that we index on uint32_t, so we may technically not be 189 // the fact that we index on uint32_t, so we may technically not be
188 // able to represent some start_function_index -es. 190 // able to represent some start_function_index -es.
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 Object* GetOwningWasmInstance(Code* code); 552 Object* GetOwningWasmInstance(Code* code);
551 553
552 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, 554 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate,
553 Handle<JSObject> instance); 555 Handle<JSObject> instance);
554 556
555 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance); 557 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance);
556 558
557 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance, 559 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance,
558 uint32_t pages); 560 uint32_t pages);
559 561
562 void UpdateDispatchTables(Isolate* isolate, Handle<FixedArray> dispatch_tables,
563 int index, Handle<JSFunction> js_function);
564
560 namespace testing { 565 namespace testing {
561 566
562 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> wasm_module, 567 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> wasm_module,
563 int instance_count); 568 int instance_count);
564 void ValidateModuleState(Isolate* isolate, Handle<JSObject> wasm_module); 569 void ValidateModuleState(Isolate* isolate, Handle<JSObject> wasm_module);
565 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); 570 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance);
566 571
567 } // namespace testing 572 } // namespace testing
568 } // namespace wasm 573 } // namespace wasm
569 } // namespace internal 574 } // namespace internal
570 } // namespace v8 575 } // namespace v8
571 576
572 #endif // V8_WASM_MODULE_H_ 577 #endif // V8_WASM_MODULE_H_
OLDNEW
« no previous file with comments | « src/wasm/wasm-js.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698