OLD | NEW |
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 Loading... |
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 = 0x0c; | 34 const uint32_t kWasmVersion = 0x0c; |
35 | 35 |
36 const uint8_t kWasmFunctionTypeForm = 0x40; | 36 const uint8_t kWasmFunctionTypeForm = 0x40; |
37 const uint8_t kWasmAnyFunctionTypeForm = 0x20; | 37 const uint8_t kWasmAnyFunctionTypeForm = 0x20; |
38 | 38 |
| 39 #if V8_HOST_ARCH_64_BIT |
| 40 const size_t kWasmMaxHeapOffset = static_cast<size_t>(8) << 30; // 8GB |
| 41 #endif |
| 42 |
39 enum WasmSectionCode { | 43 enum WasmSectionCode { |
40 kUnknownSectionCode = 0, // code for unknown sections | 44 kUnknownSectionCode = 0, // code for unknown sections |
41 kTypeSectionCode = 1, // Function signature declarations | 45 kTypeSectionCode = 1, // Function signature declarations |
42 kImportSectionCode = 2, // Import declarations | 46 kImportSectionCode = 2, // Import declarations |
43 kFunctionSectionCode = 3, // Function declarations | 47 kFunctionSectionCode = 3, // Function declarations |
44 kTableSectionCode = 4, // Indirect function table and other tables | 48 kTableSectionCode = 4, // Indirect function table and other tables |
45 kMemorySectionCode = 5, // Memory attributes | 49 kMemorySectionCode = 5, // Memory attributes |
46 kGlobalSectionCode = 6, // Global declarations | 50 kGlobalSectionCode = 6, // Global declarations |
47 kExportSectionCode = 7, // Exports | 51 kExportSectionCode = 7, // Exports |
48 kStartSectionCode = 8, // Start function declaration | 52 kStartSectionCode = 8, // Start function declaration |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 Object* GetOwningWasmInstance(Code* code); | 554 Object* GetOwningWasmInstance(Code* code); |
551 | 555 |
552 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, | 556 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, |
553 Handle<JSObject> instance); | 557 Handle<JSObject> instance); |
554 | 558 |
555 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance); | 559 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance); |
556 | 560 |
557 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance, | 561 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance, |
558 uint32_t pages); | 562 uint32_t pages); |
559 | 563 |
| 564 Handle<JSArrayBuffer> NewArrayBuffer(Isolate* isolate, size_t size, bool guard); |
| 565 |
560 namespace testing { | 566 namespace testing { |
561 | 567 |
562 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> wasm_module, | 568 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> wasm_module, |
563 int instance_count); | 569 int instance_count); |
564 void ValidateModuleState(Isolate* isolate, Handle<JSObject> wasm_module); | 570 void ValidateModuleState(Isolate* isolate, Handle<JSObject> wasm_module); |
565 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); | 571 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); |
566 | 572 |
567 } // namespace testing | 573 } // namespace testing |
568 } // namespace wasm | 574 } // namespace wasm |
569 } // namespace internal | 575 } // namespace internal |
570 } // namespace v8 | 576 } // namespace v8 |
571 | 577 |
572 #endif // V8_WASM_MODULE_H_ | 578 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |