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