OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_OBJECTS_H_ | 5 #ifndef V8_WASM_OBJECTS_H_ |
6 #define V8_WASM_OBJECTS_H_ | 6 #define V8_WASM_OBJECTS_H_ |
7 | 7 |
8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
9 #include "src/trap-handler/trap-handler.h" | 9 #include "src/trap-handler/trap-handler.h" |
10 #include "src/wasm/managed.h" | 10 #include "src/wasm/managed.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // Translate from byte offset in the module to function number and byte offset | 290 // Translate from byte offset in the module to function number and byte offset |
291 // within that function, encoded as line and column in the position info. | 291 // within that function, encoded as line and column in the position info. |
292 // Returns true if the position is valid inside this module, false otherwise. | 292 // Returns true if the position is valid inside this module, false otherwise. |
293 bool GetPositionInfo(uint32_t position, Script::PositionInfo* info); | 293 bool GetPositionInfo(uint32_t position, Script::PositionInfo* info); |
294 | 294 |
295 // Get the asm.js source position from a byte offset. | 295 // Get the asm.js source position from a byte offset. |
296 // Must only be called if the associated wasm object was created from asm.js. | 296 // Must only be called if the associated wasm object was created from asm.js. |
297 static int GetAsmJsSourcePosition(Handle<WasmCompiledModule> debug_info, | 297 static int GetAsmJsSourcePosition(Handle<WasmCompiledModule> debug_info, |
298 uint32_t func_index, uint32_t byte_offset); | 298 uint32_t func_index, uint32_t byte_offset); |
299 | 299 |
| 300 // Compute the disassembly of a wasm function. |
| 301 // Returns the disassembly string and a list of <byte_offset, line, column> |
| 302 // entries, mapping wasm byte offsets to line and column in the disassembly. |
| 303 // The list is guaranteed to be ordered by the byte_offset. |
| 304 // Returns an empty string and empty vector if the function index is invalid. |
| 305 std::pair<std::string, std::vector<std::tuple<uint32_t, int, int>>> |
| 306 DisassembleFunction(int func_index); |
| 307 |
300 private: | 308 private: |
301 void InitId(); | 309 void InitId(); |
302 | 310 |
303 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); | 311 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); |
304 }; | 312 }; |
305 | 313 |
306 // TODO(clemensh): Extend this object for breakpoint support, or remove it. | 314 // TODO(clemensh): Extend this object for breakpoint support, or remove it. |
307 class WasmDebugInfo : public FixedArray { | 315 class WasmDebugInfo : public FixedArray { |
308 public: | 316 public: |
309 enum class Fields { kFieldCount }; | 317 enum class Fields { kFieldCount }; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 }; | 379 }; |
372 }; | 380 }; |
373 | 381 |
374 #undef DECLARE_ACCESSORS | 382 #undef DECLARE_ACCESSORS |
375 #undef DECLARE_OPTIONAL_ACCESSORS | 383 #undef DECLARE_OPTIONAL_ACCESSORS |
376 | 384 |
377 } // namespace internal | 385 } // namespace internal |
378 } // namespace v8 | 386 } // namespace v8 |
379 | 387 |
380 #endif // V8_WASM_OBJECTS_H_ | 388 #endif // V8_WASM_OBJECTS_H_ |
OLD | NEW |