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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 const size_t kMaxModuleSize = 1024 * 1024 * 1024; | 34 const size_t kMaxModuleSize = 1024 * 1024 * 1024; |
35 const size_t kMaxFunctionSize = 128 * 1024; | 35 const size_t kMaxFunctionSize = 128 * 1024; |
36 const size_t kMaxStringSize = 256; | 36 const size_t kMaxStringSize = 256; |
37 const uint32_t kWasmMagic = 0x6d736100; | 37 const uint32_t kWasmMagic = 0x6d736100; |
38 const uint32_t kWasmVersion = 0x0d; | 38 const uint32_t kWasmVersion = 0x0d; |
39 | 39 |
40 const uint8_t kWasmFunctionTypeForm = 0x60; | 40 const uint8_t kWasmFunctionTypeForm = 0x60; |
41 const uint8_t kWasmAnyFunctionTypeForm = 0x70; | 41 const uint8_t kWasmAnyFunctionTypeForm = 0x70; |
42 | 42 |
| 43 const uint64_t kWasmMaxHeapOffset = |
| 44 static_cast<uint64_t>( |
| 45 std::numeric_limits<uint32_t>::max()) // maximum base value |
| 46 + std::numeric_limits<uint32_t>::max(); // maximum index value |
| 47 |
43 enum WasmSectionCode { | 48 enum WasmSectionCode { |
44 kUnknownSectionCode = 0, // code for unknown sections | 49 kUnknownSectionCode = 0, // code for unknown sections |
45 kTypeSectionCode = 1, // Function signature declarations | 50 kTypeSectionCode = 1, // Function signature declarations |
46 kImportSectionCode = 2, // Import declarations | 51 kImportSectionCode = 2, // Import declarations |
47 kFunctionSectionCode = 3, // Function declarations | 52 kFunctionSectionCode = 3, // Function declarations |
48 kTableSectionCode = 4, // Indirect function table and other tables | 53 kTableSectionCode = 4, // Indirect function table and other tables |
49 kMemorySectionCode = 5, // Memory attributes | 54 kMemorySectionCode = 5, // Memory attributes |
50 kGlobalSectionCode = 6, // Global declarations | 55 kGlobalSectionCode = 6, // Global declarations |
51 kExportSectionCode = 7, // Exports | 56 kExportSectionCode = 7, // Exports |
52 kStartSectionCode = 8, // Start function declaration | 57 kStartSectionCode = 8, // Start function declaration |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 Object* GetOwningWasmInstance(Code* code); | 427 Object* GetOwningWasmInstance(Code* code); |
423 | 428 |
424 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, | 429 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, |
425 Handle<JSObject> instance); | 430 Handle<JSObject> instance); |
426 | 431 |
427 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance); | 432 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance); |
428 | 433 |
429 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance, | 434 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance, |
430 uint32_t pages); | 435 uint32_t pages); |
431 | 436 |
| 437 Handle<JSArrayBuffer> NewArrayBuffer(Isolate* isolate, size_t size, |
| 438 bool enable_guard_regions); |
| 439 |
432 void UpdateDispatchTables(Isolate* isolate, Handle<FixedArray> dispatch_tables, | 440 void UpdateDispatchTables(Isolate* isolate, Handle<FixedArray> dispatch_tables, |
433 int index, Handle<JSFunction> js_function); | 441 int index, Handle<JSFunction> js_function); |
434 | 442 |
435 namespace testing { | 443 namespace testing { |
436 | 444 |
437 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> wasm_module, | 445 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> wasm_module, |
438 int instance_count); | 446 int instance_count); |
439 void ValidateModuleState(Isolate* isolate, Handle<JSObject> wasm_module); | 447 void ValidateModuleState(Isolate* isolate, Handle<JSObject> wasm_module); |
440 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); | 448 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); |
441 | 449 |
442 } // namespace testing | 450 } // namespace testing |
443 } // namespace wasm | 451 } // namespace wasm |
444 } // namespace internal | 452 } // namespace internal |
445 } // namespace v8 | 453 } // namespace v8 |
446 | 454 |
447 #endif // V8_WASM_MODULE_H_ | 455 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |