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

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

Issue 2049513003: [wasm] Support undefined indirect table entries, behind a flag. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [wasm] Patching in the change to have only one runtime check, instead of two. Created 4 years, 6 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
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 kDeclFunctionName = 0x01, 94 kDeclFunctionName = 0x01,
95 kDeclFunctionExport = 0x08 95 kDeclFunctionExport = 0x08
96 }; 96 };
97 97
98 // Constants for fixed-size elements within a module. 98 // Constants for fixed-size elements within a module.
99 static const size_t kDeclMemorySize = 3; 99 static const size_t kDeclMemorySize = 3;
100 static const size_t kDeclDataSegmentSize = 13; 100 static const size_t kDeclDataSegmentSize = 13;
101 101
102 static const uint32_t kMaxReturnCount = 1; 102 static const uint32_t kMaxReturnCount = 1;
103 103
104 // minimum number of entries in the table for JITing
105 static const uint32_t kMinimumIndirectTableSize = 1024;
106
104 // Static representation of a WASM function. 107 // Static representation of a WASM function.
105 struct WasmFunction { 108 struct WasmFunction {
106 FunctionSig* sig; // signature of the function. 109 FunctionSig* sig; // signature of the function.
107 uint32_t func_index; // index into the function table. 110 uint32_t func_index; // index into the function table.
108 uint32_t sig_index; // index into the signature table. 111 uint32_t sig_index; // index into the signature table.
109 uint32_t name_offset; // offset in the module bytes of the name, if any. 112 uint32_t name_offset; // offset in the module bytes of the name, if any.
110 uint32_t name_length; // length in bytes of the name. 113 uint32_t name_length; // length in bytes of the name.
111 uint32_t code_start_offset; // offset in the module bytes of code start. 114 uint32_t code_start_offset; // offset in the module bytes of code start.
112 uint32_t code_end_offset; // offset in the module bytes of code end. 115 uint32_t code_end_offset; // offset in the module bytes of code end.
113 }; 116 };
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 Handle<JSArrayBuffer> mem_buffer; // Handle to array buffer of memory. 225 Handle<JSArrayBuffer> mem_buffer; // Handle to array buffer of memory.
223 Handle<JSArrayBuffer> globals_buffer; // Handle to array buffer of globals. 226 Handle<JSArrayBuffer> globals_buffer; // Handle to array buffer of globals.
224 Handle<FixedArray> function_table; // indirect function table. 227 Handle<FixedArray> function_table; // indirect function table.
225 std::vector<Handle<Code>> function_code; // code objects for each function. 228 std::vector<Handle<Code>> function_code; // code objects for each function.
226 std::vector<Handle<Code>> import_code; // code objects for each import. 229 std::vector<Handle<Code>> import_code; // code objects for each import.
227 // -- raw memory ------------------------------------------------------------ 230 // -- raw memory ------------------------------------------------------------
228 byte* mem_start; // start of linear memory. 231 byte* mem_start; // start of linear memory.
229 size_t mem_size; // size of the linear memory. 232 size_t mem_size; // size of the linear memory.
230 // -- raw globals ----------------------------------------------------------- 233 // -- raw globals -----------------------------------------------------------
231 byte* globals_start; // start of the globals area. 234 byte* globals_start; // start of the globals area.
235 // -- indirect function table information -----------------------------------
236 int padded_entries; // number of entries padded to the indirect func. table
232 237
233 explicit WasmModuleInstance(const WasmModule* m) 238 explicit WasmModuleInstance(const WasmModule* m)
234 : module(m), 239 : module(m),
235 function_code(m->functions.size()), 240 function_code(m->functions.size()),
236 mem_start(nullptr), 241 mem_start(nullptr),
237 mem_size(0), 242 mem_size(0),
238 globals_start(nullptr) {} 243 globals_start(nullptr) {}
239 }; 244 };
240 245
241 // forward declaration. 246 // forward declaration.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // secure. If it turns out that we need more complete checks, we could add a 334 // secure. If it turns out that we need more complete checks, we could add a
330 // special marker as internal field, which will definitely never occur anywhere 335 // special marker as internal field, which will definitely never occur anywhere
331 // else. 336 // else.
332 bool IsWasmObject(Handle<JSObject> object); 337 bool IsWasmObject(Handle<JSObject> object);
333 338
334 } // namespace wasm 339 } // namespace wasm
335 } // namespace internal 340 } // namespace internal
336 } // namespace v8 341 } // namespace v8
337 342
338 #endif // V8_WASM_MODULE_H_ 343 #endif // V8_WASM_MODULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698