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

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

Issue 2500443004: [wasm] OOB traps: build protected instruction list during codegen (Closed)
Patch Set: Merging with master 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
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"
11 #include "src/globals.h" 11 #include "src/globals.h"
12 #include "src/handles.h" 12 #include "src/handles.h"
13 #include "src/parsing/preparse-data.h" 13 #include "src/parsing/preparse-data.h"
14 #include "src/trap-handler/trap-handler.h"
14 15
15 #include "src/wasm/managed.h" 16 #include "src/wasm/managed.h"
16 #include "src/wasm/signature-map.h" 17 #include "src/wasm/signature-map.h"
17 #include "src/wasm/wasm-opcodes.h" 18 #include "src/wasm/wasm-opcodes.h"
18 19
19 namespace v8 { 20 namespace v8 {
20 namespace internal { 21 namespace internal {
21 22
22 class WasmCompiledModule; 23 class WasmCompiledModule;
23 class WasmDebugInfo; 24 class WasmDebugInfo;
24 class WasmModuleObject; 25 class WasmModuleObject;
25 class WasmInstanceObject; 26 class WasmInstanceObject;
26 27
27 namespace compiler { 28 namespace compiler {
28 class CallDescriptor; 29 class CallDescriptor;
29 class WasmCompilationUnit; 30 class WasmCompilationUnit;
30 } 31 }
31 32
33 using trap_handler::ProtectedInstructionData;
titzer 2016/11/30 17:31:12 Is it necessary to add these here?
Eric Holk 2016/11/30 20:16:20 No. Done.
34 using trap_handler::ProtectedInstructionList;
35
32 namespace wasm { 36 namespace wasm {
33 class ErrorThrower; 37 class ErrorThrower;
34 38
35 const size_t kMaxModuleSize = 1024 * 1024 * 1024; 39 const size_t kMaxModuleSize = 1024 * 1024 * 1024;
36 const size_t kMaxFunctionSize = 128 * 1024; 40 const size_t kMaxFunctionSize = 128 * 1024;
37 const size_t kMaxStringSize = 256; 41 const size_t kMaxStringSize = 256;
38 const uint32_t kWasmMagic = 0x6d736100; 42 const uint32_t kWasmMagic = 0x6d736100;
39 const uint32_t kWasmVersion = 0x0d; 43 const uint32_t kWasmVersion = 0x0d;
40 44
41 const uint8_t kWasmFunctionTypeForm = 0x60; 45 const uint8_t kWasmFunctionTypeForm = 0x60;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Static representation of a WASM export. 175 // Static representation of a WASM export.
172 struct WasmExport { 176 struct WasmExport {
173 uint32_t name_length; // length in bytes of the exported name. 177 uint32_t name_length; // length in bytes of the exported name.
174 uint32_t name_offset; // offset in module bytes of the name to export. 178 uint32_t name_offset; // offset in module bytes of the name to export.
175 WasmExternalKind kind; // kind of the export. 179 WasmExternalKind kind; // kind of the export.
176 uint32_t index; // index into the respective space. 180 uint32_t index; // index into the respective space.
177 }; 181 };
178 182
179 enum ModuleOrigin { kWasmOrigin, kAsmJsOrigin }; 183 enum ModuleOrigin { kWasmOrigin, kAsmJsOrigin };
180 184
185 enum TrapFields { kTrapCodeOffset, kTrapLandingOffset, kTrapDataSize };
titzer 2016/11/30 17:31:12 Should this move to wasm-objects.h? I think it ref
titzer 2016/11/30 17:31:13 Maybe this fits better in wasm-objects.h? As I thi
Eric Holk 2016/11/30 20:16:20 I moved it to objects.h, because the protected ins
186
181 // Static representation of a module. 187 // Static representation of a module.
182 struct V8_EXPORT_PRIVATE WasmModule { 188 struct V8_EXPORT_PRIVATE WasmModule {
183 static const uint32_t kPageSize = 0x10000; // Page size, 64kb. 189 static const uint32_t kPageSize = 0x10000; // Page size, 64kb.
184 static const uint32_t kMinMemPages = 1; // Minimum memory size = 64kb 190 static const uint32_t kMinMemPages = 1; // Minimum memory size = 64kb
185 static const size_t kV8MaxPages = 16384; // Maximum memory size = 1gb 191 static const size_t kV8MaxPages = 16384; // Maximum memory size = 1gb
186 static const size_t kSpecMaxPages = 65536; // Maximum according to the spec 192 static const size_t kSpecMaxPages = 65536; // Maximum according to the spec
187 static const size_t kV8MaxTableSize = 16 * 1024 * 1024; 193 static const size_t kV8MaxTableSize = 16 * 1024 * 1024;
188 194
189 Zone* owned_zone; 195 Zone* owned_zone;
190 const byte* module_start = nullptr; // starting address for the module bytes 196 const byte* module_start = nullptr; // starting address for the module bytes
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); 451 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj);
446 void ValidateOrphanedInstance(Isolate* isolate, 452 void ValidateOrphanedInstance(Isolate* isolate,
447 Handle<WasmInstanceObject> instance); 453 Handle<WasmInstanceObject> instance);
448 454
449 } // namespace testing 455 } // namespace testing
450 } // namespace wasm 456 } // namespace wasm
451 } // namespace internal 457 } // namespace internal
452 } // namespace v8 458 } // namespace v8
453 459
454 #endif // V8_WASM_MODULE_H_ 460 #endif // V8_WASM_MODULE_H_
OLDNEW
« src/trap-handler/trap-handler.h ('K') | « src/v8.gyp ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698