Chromium Code Reviews| 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 = 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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 Object* GetOwningWasmInstance(Code* code); | 557 Object* GetOwningWasmInstance(Code* code); |
| 553 | 558 |
| 554 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, | 559 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, |
| 555 Handle<JSObject> instance); | 560 Handle<JSObject> instance); |
| 556 | 561 |
| 557 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance); | 562 int32_t GetInstanceMemorySize(Isolate* isolate, Handle<JSObject> instance); |
| 558 | 563 |
| 559 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance, | 564 int32_t GrowInstanceMemory(Isolate* isolate, Handle<JSObject> instance, |
| 560 uint32_t pages); | 565 uint32_t pages); |
| 561 | 566 |
| 567 Handle<JSArrayBuffer> NewArrayBuffer(Isolate* isolate, size_t size, bool guard); | |
|
titzer
2016/11/07 19:54:53
add_guard_pages?
Eric Holk
2016/11/08 23:58:15
I went with enable_guard_regions based on your oth
| |
| 568 | |
| 562 void UpdateDispatchTables(Isolate* isolate, Handle<FixedArray> dispatch_tables, | 569 void UpdateDispatchTables(Isolate* isolate, Handle<FixedArray> dispatch_tables, |
| 563 int index, Handle<JSFunction> js_function); | 570 int index, Handle<JSFunction> js_function); |
| 564 | 571 |
| 565 namespace testing { | 572 namespace testing { |
| 566 | 573 |
| 567 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> wasm_module, | 574 void ValidateInstancesChain(Isolate* isolate, Handle<JSObject> wasm_module, |
| 568 int instance_count); | 575 int instance_count); |
| 569 void ValidateModuleState(Isolate* isolate, Handle<JSObject> wasm_module); | 576 void ValidateModuleState(Isolate* isolate, Handle<JSObject> wasm_module); |
| 570 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); | 577 void ValidateOrphanedInstance(Isolate* isolate, Handle<JSObject> instance); |
| 571 | 578 |
| 572 } // namespace testing | 579 } // namespace testing |
| 573 } // namespace wasm | 580 } // namespace wasm |
| 574 } // namespace internal | 581 } // namespace internal |
| 575 } // namespace v8 | 582 } // namespace v8 |
| 576 | 583 |
| 577 #endif // V8_WASM_MODULE_H_ | 584 #endif // V8_WASM_MODULE_H_ |
| OLD | NEW |