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/wasm/managed.h" | 9 #include "src/wasm/managed.h" |
10 | 10 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // UTF-8 string. | 264 // UTF-8 string. |
265 static MaybeHandle<String> GetFunctionName( | 265 static MaybeHandle<String> GetFunctionName( |
266 Handle<WasmCompiledModule> compiled_module, uint32_t func_index); | 266 Handle<WasmCompiledModule> compiled_module, uint32_t func_index); |
267 | 267 |
268 // Get the raw bytes of the function name of the function identified by the | 268 // Get the raw bytes of the function name of the function identified by the |
269 // given index. | 269 // given index. |
270 // Meant to be used for debugging or frame printing. | 270 // Meant to be used for debugging or frame printing. |
271 // Does not allocate, hence gc-safe. | 271 // Does not allocate, hence gc-safe. |
272 Vector<const uint8_t> GetRawFunctionName(uint32_t func_index); | 272 Vector<const uint8_t> GetRawFunctionName(uint32_t func_index); |
273 | 273 |
| 274 // Return the byte offset of the function identified by the given index. |
| 275 // The offset will be relative to the start of the module bytes. |
| 276 // Returns -1 if the function index is invalid. |
| 277 int GetFunctionOffset(uint32_t func_index) const; |
| 278 |
274 private: | 279 private: |
275 void InitId(); | 280 void InitId(); |
276 | 281 |
277 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); | 282 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); |
278 }; | 283 }; |
279 | 284 |
280 class WasmDebugInfo : public FixedArray { | 285 class WasmDebugInfo : public FixedArray { |
281 public: | 286 public: |
282 enum class Fields { kFieldCount }; | 287 enum class Fields { kFieldCount }; |
283 | 288 |
(...skipping 27 matching lines...) Expand all Loading... |
311 int func_index, int byte_offset); | 316 int func_index, int byte_offset); |
312 }; | 317 }; |
313 | 318 |
314 #undef DECLARE_ACCESSORS | 319 #undef DECLARE_ACCESSORS |
315 #undef DECLARE_OPTIONAL_ACCESSORS | 320 #undef DECLARE_OPTIONAL_ACCESSORS |
316 | 321 |
317 } // namespace internal | 322 } // namespace internal |
318 } // namespace v8 | 323 } // namespace v8 |
319 | 324 |
320 #endif // V8_WASM_OBJECTS_H_ | 325 #endif // V8_WASM_OBJECTS_H_ |
OLD | NEW |