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

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

Issue 2396433008: [wasm] Add guard regions to end of WebAssembly.Memory buffers (Closed)
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/v8/v8 into guard-pages 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"
(...skipping 18 matching lines...) Expand all
29 29
30 const size_t kMaxModuleSize = 1024 * 1024 * 1024; 30 const size_t kMaxModuleSize = 1024 * 1024 * 1024;
31 const size_t kMaxFunctionSize = 128 * 1024; 31 const size_t kMaxFunctionSize = 128 * 1024;
32 const size_t kMaxStringSize = 256; 32 const size_t kMaxStringSize = 256;
33 const uint32_t kWasmMagic = 0x6d736100; 33 const uint32_t kWasmMagic = 0x6d736100;
34 const uint32_t kWasmVersion = 0x0d; 34 const uint32_t kWasmVersion = 0x0d;
35 35
36 const uint8_t kWasmFunctionTypeForm = 0x60; 36 const uint8_t kWasmFunctionTypeForm = 0x60;
37 const uint8_t kWasmAnyFunctionTypeForm = 0x70; 37 const uint8_t kWasmAnyFunctionTypeForm = 0x70;
38 38
39 const uint64_t kWasmMaxHeapOffset =
40 static_cast<uint64_t>(
41 std::numeric_limits<uint32_t>::max()) // maximum base value
42 + std::numeric_limits<uint32_t>::max(); // maximum index value
43
39 enum WasmSectionCode { 44 enum WasmSectionCode {
40 kUnknownSectionCode = 0, // code for unknown sections 45 kUnknownSectionCode = 0, // code for unknown sections
41 kTypeSectionCode = 1, // Function signature declarations 46 kTypeSectionCode = 1, // Function signature declarations
42 kImportSectionCode = 2, // Import declarations 47 kImportSectionCode = 2, // Import declarations
43 kFunctionSectionCode = 3, // Function declarations 48 kFunctionSectionCode = 3, // Function declarations
44 kTableSectionCode = 4, // Indirect function table and other tables 49 kTableSectionCode = 4, // Indirect function table and other tables
45 kMemorySectionCode = 5, // Memory attributes 50 kMemorySectionCode = 5, // Memory attributes
46 kGlobalSectionCode = 6, // Global declarations 51 kGlobalSectionCode = 6, // Global declarations
47 kExportSectionCode = 7, // Exports 52 kExportSectionCode = 7, // Exports
48 kStartSectionCode = 8, // Start function declaration 53 kStartSectionCode = 8, // Start function declaration
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 Object* GetOwningWasmInstance(Code* code); 559 Object* GetOwningWasmInstance(Code* code);
555 560
556 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, 561 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate,
557 Handle<JSObject> instance); 562 Handle<JSObject> instance);
558 563
559 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance); 564 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance);
560 565
561 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance, 566 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance,
562 uint32_t pages); 567 uint32_t pages);
563 568
569 Handle<JSArrayBuffer> NewArrayBuffer(Isolate* isolate, size_t size,
570 bool enable_guard_regions);
571
564 void UpdateDispatchTables(Isolate* isolate, Handle<FixedArray> dispatch_tables, 572 void UpdateDispatchTables(Isolate* isolate, Handle<FixedArray> dispatch_tables,
565 int index, Handle<JSFunction> js_function); 573 int index, Handle<JSFunction> js_function);
566 574
567 namespace testing { 575 namespace testing {
568 576
569 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> wasm_module, 577 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> wasm_module,
570 int instance_count); 578 int instance_count);
571 void ValidateModuleState(Isolate* isolate, Handle<JSObject> wasm_module); 579 void ValidateModuleState(Isolate* isolate, Handle<JSObject> wasm_module);
572 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); 580 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance);
573 581
574 } // namespace testing 582 } // namespace testing
575 } // namespace wasm 583 } // namespace wasm
576 } // namespace internal 584 } // namespace internal
577 } // namespace v8 585 } // namespace v8
578 586
579 #endif // V8_WASM_MODULE_H_ 587 #endif // V8_WASM_MODULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698