Chromium Code Reviews| Index: src/wasm/wasm-module.h |
| diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h |
| index 466b15ba6735eb0e89a796dc36fe9248643e9eef..15152a87269c2e86dcf96365b24f3acd335056e0 100644 |
| --- a/src/wasm/wasm-module.h |
| +++ b/src/wasm/wasm-module.h |
| @@ -35,19 +35,20 @@ const uint8_t kWasmFunctionTypeForm = 0x40; |
| const uint8_t kWasmAnyFunctionTypeForm = 0x20; |
| enum WasmSectionCode { |
| - kUnknownSectionCode = 0, // code for unknown sections |
| - kTypeSectionCode = 1, // Function signature declarations |
| - kImportSectionCode = 2, // Import declarations |
| - kFunctionSectionCode = 3, // Function declarations |
| - kTableSectionCode = 4, // Indirect function table and other tables |
| - kMemorySectionCode = 5, // Memory attributes |
| - kGlobalSectionCode = 6, // Global declarations |
| - kExportSectionCode = 7, // Exports |
| - kStartSectionCode = 8, // Start function declaration |
| - kElementSectionCode = 9, // Elements section |
| - kCodeSectionCode = 10, // Function code |
| - kDataSectionCode = 11, // Data segments |
| - kNameSectionCode = 12, // Name section (encoded as a string) |
| + kUnknownSectionCode = 0, // code for unknown sections |
| + kTypeSectionCode = 1, // Function signature declarations |
| + kImportSectionCode = 2, // Import declarations |
| + kFunctionSectionCode = 3, // Function declarations |
| + kTableSectionCode = 4, // Indirect function table and other tables |
| + kMemorySectionCode = 5, // Memory attributes |
| + kGlobalSectionCode = 6, // Global declarations |
| + kExportSectionCode = 7, // Exports |
| + kStartSectionCode = 8, // Start function declaration |
| + kElementSectionCode = 9, // Elements section |
| + kCodeSectionCode = 10, // Function code |
| + kDataSectionCode = 11, // Data segments |
| + kNameSectionCode = 12, // Name section (encoded as a string) |
| + kAsmOffsetsSectionCode = 13, // Asm.js offset table |
| }; |
| inline bool IsValidSectionCode(uint8_t byte) { |
| @@ -394,6 +395,7 @@ class WasmCompiledModule : public FixedArray { |
| MACRO(OBJECT, FixedArray, indirect_function_tables) \ |
| MACRO(OBJECT, SeqOneByteString, module_bytes) \ |
| MACRO(OBJECT, ByteArray, function_names) \ |
| + MACRO(OBJECT, Script, asm_js_script) \ |
| MACRO(SMALL_NUMBER, uint32_t, min_memory_pages) \ |
| MACRO(OBJECT, FixedArray, data_segments_info) \ |
| MACRO(OBJECT, ByteArray, data_segments) \ |
| @@ -499,6 +501,17 @@ Handle<JSFunction> WrapExportCodeAsJSFunction(Isolate* isolate, |
| // else. |
| bool IsWasmObject(Object* object); |
| +// Check whether the wasm module was generated from asm.js code. |
| +bool WasmIsAsm(Object* wasm, Isolate* isolate); |
| + |
| +// Get the script for the asm.js origin of the wasm module. |
| +Handle<Script> GetAsmWasmScript(Handle<JSObject> wasm); |
| + |
| +// Get the asm.js source position for the given byte offset in the given |
| +// function. |
| +int GetAsmWasmSourcePosition(Handle<JSObject> wasm, int func_index, |
| + int byte_offset); |
| + |
| // Update memory references of code objects associated with the module |
| bool UpdateWasmModuleMemory(Handle<JSObject> object, Address old_start, |
| Address new_start, uint32_t old_size, |
| @@ -520,7 +533,7 @@ Handle<JSObject> CreateCompiledModuleObject( |
| V8_EXPORT_PRIVATE MaybeHandle<JSObject> CreateModuleObjectFromBytes( |
| Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower, |
| - ModuleOrigin origin); |
| + ModuleOrigin origin, Handle<Script> asm_js_script); |
|
titzer
2016/10/11 14:51:25
What if, instead of using a special section, we ju
Clemens Hammacher
2016/10/11 17:04:22
That's a very nice idea. Done. It makes things a l
|
| V8_EXPORT_PRIVATE bool ValidateModuleBytes(Isolate* isolate, const byte* start, |
| const byte* end, |