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.h" | 10 #include "src/objects.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 kInterpreterHandle, | 413 kInterpreterHandle, |
414 kInterpretedFunctions, | 414 kInterpretedFunctions, |
415 kFieldCount | 415 kFieldCount |
416 }; | 416 }; |
417 | 417 |
418 static Handle<WasmDebugInfo> New(Handle<WasmInstanceObject>); | 418 static Handle<WasmDebugInfo> New(Handle<WasmInstanceObject>); |
419 | 419 |
420 static bool IsDebugInfo(Object*); | 420 static bool IsDebugInfo(Object*); |
421 static WasmDebugInfo* cast(Object*); | 421 static WasmDebugInfo* cast(Object*); |
422 | 422 |
| 423 // Set a breakpoint in the given function at the given byte offset within that |
| 424 // function. This will redirect all future calls to this function to the |
| 425 // interpreter and will always pause at the given offset. |
423 static void SetBreakpoint(Handle<WasmDebugInfo>, int func_index, int offset); | 426 static void SetBreakpoint(Handle<WasmDebugInfo>, int func_index, int offset); |
424 | 427 |
| 428 // Make a function always execute in the interpreter without setting a |
| 429 // breakpoints. |
| 430 static void RedirectToInterpreter(Handle<WasmDebugInfo>, int func_index); |
| 431 |
425 void PrepareStep(StepAction); | 432 void PrepareStep(StepAction); |
426 | 433 |
427 void RunInterpreter(int func_index, uint8_t* arg_buffer); | 434 void RunInterpreter(int func_index, uint8_t* arg_buffer); |
428 | 435 |
429 // Get the stack of the wasm interpreter as pairs of <function index, byte | 436 // Get the stack of the wasm interpreter as pairs of <function index, byte |
430 // offset>. The list is ordered bottom-to-top, i.e. caller before callee. | 437 // offset>. The list is ordered bottom-to-top, i.e. caller before callee. |
431 std::vector<std::pair<uint32_t, int>> GetInterpretedStack( | 438 std::vector<std::pair<uint32_t, int>> GetInterpretedStack( |
432 Address frame_pointer); | 439 Address frame_pointer); |
433 | 440 |
434 std::unique_ptr<wasm::InterpretedFrame> GetInterpretedFrame( | 441 std::unique_ptr<wasm::InterpretedFrame> GetInterpretedFrame( |
435 Address frame_pointer, int idx); | 442 Address frame_pointer, int idx); |
436 | 443 |
| 444 // Returns the number of calls / function frames executed in the interpreter. |
| 445 uint64_t NumInterpretedCalls(); |
| 446 |
437 DECLARE_GETTER(wasm_instance, WasmInstanceObject); | 447 DECLARE_GETTER(wasm_instance, WasmInstanceObject); |
438 }; | 448 }; |
439 | 449 |
440 class WasmInstanceWrapper : public FixedArray { | 450 class WasmInstanceWrapper : public FixedArray { |
441 public: | 451 public: |
442 static Handle<WasmInstanceWrapper> New(Isolate* isolate, | 452 static Handle<WasmInstanceWrapper> New(Isolate* isolate, |
443 Handle<WasmInstanceObject> instance); | 453 Handle<WasmInstanceObject> instance); |
444 static WasmInstanceWrapper* cast(Object* fixed_array) { | 454 static WasmInstanceWrapper* cast(Object* fixed_array) { |
445 SLOW_DCHECK(IsWasmInstanceWrapper(fixed_array)); | 455 SLOW_DCHECK(IsWasmInstanceWrapper(fixed_array)); |
446 return reinterpret_cast<WasmInstanceWrapper*>(fixed_array); | 456 return reinterpret_cast<WasmInstanceWrapper*>(fixed_array); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 }; | 501 }; |
492 }; | 502 }; |
493 | 503 |
494 #undef DECLARE_ACCESSORS | 504 #undef DECLARE_ACCESSORS |
495 #undef DECLARE_OPTIONAL_ACCESSORS | 505 #undef DECLARE_OPTIONAL_ACCESSORS |
496 | 506 |
497 } // namespace internal | 507 } // namespace internal |
498 } // namespace v8 | 508 } // namespace v8 |
499 | 509 |
500 #endif // V8_WASM_OBJECTS_H_ | 510 #endif // V8_WASM_OBJECTS_H_ |
OLD | NEW |