Index: src/wasm/wasm-module-builder.h |
diff --git a/src/wasm/wasm-module-builder.h b/src/wasm/wasm-module-builder.h |
index 4f463b01df7c55d8ec8be840af2d72931bb320b8..d35313ef47edb364ef0676d6a0bc4a9097f0398d 100644 |
--- a/src/wasm/wasm-module-builder.h |
+++ b/src/wasm/wasm-module-builder.h |
@@ -88,10 +88,10 @@ class ZoneBuffer : public ZoneObject { |
} |
} |
- size_t offset() { return static_cast<size_t>(pos_ - buffer_); } |
- size_t size() { return static_cast<size_t>(pos_ - buffer_); } |
- const byte* begin() { return buffer_; } |
- const byte* end() { return pos_; } |
+ size_t offset() const { return static_cast<size_t>(pos_ - buffer_); } |
+ size_t size() const { return static_cast<size_t>(pos_ - buffer_); } |
+ const byte* begin() const { return buffer_; } |
+ const byte* end() const { return pos_; } |
void EnsureSpace(size_t size) { |
if ((pos_ + size) > end_) { |
@@ -135,10 +135,12 @@ class V8_EXPORT_PRIVATE WasmFunctionBuilder : public ZoneObject { |
void Export(); |
void ExportAs(Vector<const char> name); |
void SetName(Vector<const char> name); |
+ void AddAsmWasmOffset(int asm_position); |
void WriteSignature(ZoneBuffer& buffer) const; |
void WriteExport(ZoneBuffer& buffer) const; |
void WriteBody(ZoneBuffer& buffer) const; |
+ void WriteAsmWasmOffsetTable(ZoneBuffer& buffer) const; |
bool exported() { return exported_; } |
uint32_t func_index() { return func_index_; } |
@@ -167,6 +169,11 @@ class V8_EXPORT_PRIVATE WasmFunctionBuilder : public ZoneObject { |
ZoneVector<uint32_t> f32_temps_; |
ZoneVector<uint32_t> f64_temps_; |
ZoneVector<DirectCallIndex> direct_calls_; |
+ |
+ // Delta-encoded mapping from wasm bytes to asm.js source positions. |
+ ZoneBuffer asm_offsets_; |
+ uint32_t last_asm_byte_offset_ = 0; |
+ uint32_t last_asm_source_position_ = 0; |
}; |
class WasmTemporary { |
@@ -228,6 +235,7 @@ class V8_EXPORT_PRIVATE WasmModuleBuilder : public ZoneObject { |
// Writing methods. |
void WriteTo(ZoneBuffer& buffer) const; |
+ void WriteAsmJsOffsetTable(ZoneBuffer& buffer) const; |
// TODO(titzer): use SignatureMap from signature-map.h here. |
// This signature map is zone-allocated, but the other is heap allocated. |