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/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/debug/interface-types.h" | 9 #include "src/debug/interface-types.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
11 #include "src/trap-handler/trap-handler.h" | 11 #include "src/trap-handler/trap-handler.h" |
12 #include "src/wasm/managed.h" | 12 #include "src/wasm/managed.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace wasm { | 16 namespace wasm { |
| 17 class InterpretedFrame; |
17 struct WasmModule; | 18 struct WasmModule; |
18 } | 19 } |
19 | 20 |
20 class WasmCompiledModule; | 21 class WasmCompiledModule; |
21 class WasmDebugInfo; | 22 class WasmDebugInfo; |
22 class WasmInstanceObject; | 23 class WasmInstanceObject; |
23 class WasmInstanceWrapper; | 24 class WasmInstanceWrapper; |
24 | 25 |
25 #define DECLARE_CASTS(name) \ | 26 #define DECLARE_CASTS(name) \ |
26 static bool Is##name(Object* object); \ | 27 static bool Is##name(Object* object); \ |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 384 |
384 // Set a breakpoint on the given byte position inside the given module. | 385 // Set a breakpoint on the given byte position inside the given module. |
385 // This will affect all live and future instances of the module. | 386 // This will affect all live and future instances of the module. |
386 // The passed position might be modified to point to the next breakable | 387 // The passed position might be modified to point to the next breakable |
387 // location inside the same function. | 388 // location inside the same function. |
388 // If it points outside a function, or behind the last breakable location, | 389 // If it points outside a function, or behind the last breakable location, |
389 // this function returns false and does not set any breakpoint. | 390 // this function returns false and does not set any breakpoint. |
390 static bool SetBreakPoint(Handle<WasmCompiledModule>, int* position, | 391 static bool SetBreakPoint(Handle<WasmCompiledModule>, int* position, |
391 Handle<Object> break_point_object); | 392 Handle<Object> break_point_object); |
392 | 393 |
| 394 // Get the BreakLocation identifying the given position. Must only be called |
| 395 // with valid (breakable) positions. |
| 396 BreakLocation GetBreakLocation(int position); |
| 397 |
393 // Return an empty handle if no breakpoint is hit at that location, or a | 398 // Return an empty handle if no breakpoint is hit at that location, or a |
394 // FixedArray with all hit breakpoint objects. | 399 // FixedArray with all hit breakpoint objects. |
395 MaybeHandle<FixedArray> CheckBreakPoints(const BreakLocation& location); | 400 MaybeHandle<FixedArray> CheckBreakPoints(const BreakLocation& location); |
396 | 401 |
397 private: | 402 private: |
398 void InitId(); | 403 void InitId(); |
399 | 404 |
400 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); | 405 DISALLOW_IMPLICIT_CONSTRUCTORS(WasmCompiledModule); |
401 }; | 406 }; |
402 | 407 |
403 class WasmDebugInfo : public FixedArray { | 408 class WasmDebugInfo : public FixedArray { |
404 public: | 409 public: |
405 enum Fields { | 410 enum Fields { |
406 kInstance, | 411 kInstance, |
407 kInterpreterHandle, | 412 kInterpreterHandle, |
408 kInterpretedFunctions, | 413 kInterpretedFunctions, |
409 kFieldCount | 414 kFieldCount |
410 }; | 415 }; |
411 | 416 |
412 static Handle<WasmDebugInfo> New(Handle<WasmInstanceObject>); | 417 static Handle<WasmDebugInfo> New(Handle<WasmInstanceObject>); |
413 | 418 |
414 static bool IsDebugInfo(Object*); | 419 static bool IsDebugInfo(Object*); |
415 static WasmDebugInfo* cast(Object*); | 420 static WasmDebugInfo* cast(Object*); |
416 | 421 |
417 static void SetBreakpoint(Handle<WasmDebugInfo>, int func_index, int offset); | 422 static void SetBreakpoint(Handle<WasmDebugInfo>, int func_index, int offset); |
418 | 423 |
419 static void RunInterpreter(Handle<WasmDebugInfo>, int func_index, | 424 static void RunInterpreter(Handle<WasmDebugInfo>, int func_index, |
420 uint8_t* arg_buffer); | 425 uint8_t* arg_buffer); |
421 | 426 |
| 427 static std::vector<std::pair<uint32_t, int>> GetInterpretedStack( |
| 428 Handle<WasmDebugInfo>, Address frame_pointer); |
| 429 |
| 430 static std::unique_ptr<wasm::InterpretedFrame> GetInterpretedFrame( |
| 431 Handle<WasmDebugInfo>, Address frame_pointer, int idx); |
| 432 |
422 DECLARE_GETTER(wasm_instance, WasmInstanceObject); | 433 DECLARE_GETTER(wasm_instance, WasmInstanceObject); |
423 }; | 434 }; |
424 | 435 |
425 class WasmInstanceWrapper : public FixedArray { | 436 class WasmInstanceWrapper : public FixedArray { |
426 public: | 437 public: |
427 static Handle<WasmInstanceWrapper> New(Isolate* isolate, | 438 static Handle<WasmInstanceWrapper> New(Isolate* isolate, |
428 Handle<WasmInstanceObject> instance); | 439 Handle<WasmInstanceObject> instance); |
429 static WasmInstanceWrapper* cast(Object* fixed_array) { | 440 static WasmInstanceWrapper* cast(Object* fixed_array) { |
430 SLOW_DCHECK(IsWasmInstanceWrapper(fixed_array)); | 441 SLOW_DCHECK(IsWasmInstanceWrapper(fixed_array)); |
431 return reinterpret_cast<WasmInstanceWrapper*>(fixed_array); | 442 return reinterpret_cast<WasmInstanceWrapper*>(fixed_array); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 }; | 488 }; |
478 }; | 489 }; |
479 | 490 |
480 #undef DECLARE_ACCESSORS | 491 #undef DECLARE_ACCESSORS |
481 #undef DECLARE_OPTIONAL_ACCESSORS | 492 #undef DECLARE_OPTIONAL_ACCESSORS |
482 | 493 |
483 } // namespace internal | 494 } // namespace internal |
484 } // namespace v8 | 495 } // namespace v8 |
485 | 496 |
486 #endif // V8_WASM_OBJECTS_H_ | 497 #endif // V8_WASM_OBJECTS_H_ |
OLD | NEW |