Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: src/debug.h

Issue 812583003: Support tasks injection into a running VM. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_DEBUG_H_ 5 #ifndef V8_DEBUG_H_
6 #define V8_DEBUG_H_ 6 #define V8_DEBUG_H_
7 7
8 #include <queue>
8 #include "src/allocation.h" 9 #include "src/allocation.h"
9 #include "src/arguments.h" 10 #include "src/arguments.h"
10 #include "src/assembler.h" 11 #include "src/assembler.h"
11 #include "src/base/atomicops.h" 12 #include "src/base/atomicops.h"
12 #include "src/base/platform/platform.h" 13 #include "src/base/platform/platform.h"
13 #include "src/execution.h" 14 #include "src/execution.h"
14 #include "src/factory.h" 15 #include "src/factory.h"
15 #include "src/flags.h" 16 #include "src/flags.h"
16 #include "src/frames-inl.h" 17 #include "src/frames-inl.h"
17 #include "src/hashmap.h" 18 #include "src/hashmap.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 void Put(const CommandMessage& message); 330 void Put(const CommandMessage& message);
330 void Clear(); 331 void Clear();
331 private: 332 private:
332 Logger* logger_; 333 Logger* logger_;
333 CommandMessageQueue queue_; 334 CommandMessageQueue queue_;
334 mutable base::Mutex mutex_; 335 mutable base::Mutex mutex_;
335 DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue); 336 DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue);
336 }; 337 };
337 338
338 339
340 class LockingTaskQueue {
341 public:
342 LockingTaskQueue();
343 ~LockingTaskQueue();
344 void Enqueue(v8::Task* task);
345 v8::Task* Dequeue();
346 void Clear();
347
348 private:
349 std::queue<v8::Task*> queue_;
350 base::Mutex mutex_;
351 DISALLOW_COPY_AND_ASSIGN(LockingTaskQueue);
352 };
353
354
339 // This class contains the debugger support. The main purpose is to handle 355 // This class contains the debugger support. The main purpose is to handle
340 // setting break points in the code. 356 // setting break points in the code.
341 // 357 //
342 // This class controls the debug info for all functions which currently have 358 // This class controls the debug info for all functions which currently have
343 // active breakpoints in them. This debug info is held in the heap root object 359 // active breakpoints in them. This debug info is held in the heap root object
344 // debug_info which is a FixedArray. Each entry in this list is of class 360 // debug_info which is a FixedArray. Each entry in this list is of class
345 // DebugInfo. 361 // DebugInfo.
346 class Debug { 362 class Debug {
347 public: 363 public:
348 // Debug event triggers. 364 // Debug event triggers.
349 void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue); 365 void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue);
350 366
351 void OnThrow(Handle<Object> exception, bool uncaught); 367 void OnThrow(Handle<Object> exception, bool uncaught);
352 void OnPromiseReject(Handle<JSObject> promise, Handle<Object> value); 368 void OnPromiseReject(Handle<JSObject> promise, Handle<Object> value);
353 void OnCompileError(Handle<Script> script); 369 void OnCompileError(Handle<Script> script);
354 void OnBeforeCompile(Handle<Script> script); 370 void OnBeforeCompile(Handle<Script> script);
355 void OnAfterCompile(Handle<Script> script); 371 void OnAfterCompile(Handle<Script> script);
356 void OnPromiseEvent(Handle<JSObject> data); 372 void OnPromiseEvent(Handle<JSObject> data);
357 void OnAsyncTaskEvent(Handle<JSObject> data); 373 void OnAsyncTaskEvent(Handle<JSObject> data);
358 374
359 // API facing. 375 // API facing.
360 void SetEventListener(Handle<Object> callback, Handle<Object> data); 376 void SetEventListener(Handle<Object> callback, Handle<Object> data);
361 void SetMessageHandler(v8::Debug::MessageHandler handler); 377 void SetMessageHandler(v8::Debug::MessageHandler handler);
362 void EnqueueCommandMessage(Vector<const uint16_t> command, 378 void EnqueueCommandMessage(Vector<const uint16_t> command,
363 v8::Debug::ClientData* client_data = NULL); 379 v8::Debug::ClientData* client_data = NULL);
364 // Enqueue a debugger command to the command queue for event listeners. 380 // Enqueue a debugger command to the command queue for event listeners.
365 void EnqueueDebugCommand(v8::Debug::ClientData* client_data = NULL); 381 void EnqueueDebugCommand(v8::Debug::ClientData* client_data = NULL);
382 void EnqueueEmbedderTask(v8::Task* task);
383 bool ProcessEmbedderTasks();
366 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<JSFunction> fun, 384 MUST_USE_RESULT MaybeHandle<Object> Call(Handle<JSFunction> fun,
367 Handle<Object> data); 385 Handle<Object> data);
368 Handle<Context> GetDebugContext(); 386 Handle<Context> GetDebugContext();
369 void HandleDebugBreak(); 387 void HandleDebugBreak();
370 void ProcessDebugMessages(bool debug_command_only); 388 void ProcessDebugMessages(bool debug_command_only);
371 389
372 // Internal logic 390 // Internal logic
373 bool Load(); 391 bool Load();
374 void Break(Arguments args, JavaScriptFrame*); 392 void Break(Arguments args, JavaScriptFrame*);
375 void SetAfterBreakTarget(JavaScriptFrame* frame); 393 void SetAfterBreakTarget(JavaScriptFrame* frame);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 Handle<Context> debug_context_; 604 Handle<Context> debug_context_;
587 Handle<Object> event_listener_; 605 Handle<Object> event_listener_;
588 Handle<Object> event_listener_data_; 606 Handle<Object> event_listener_data_;
589 607
590 v8::Debug::MessageHandler message_handler_; 608 v8::Debug::MessageHandler message_handler_;
591 609
592 static const int kQueueInitialSize = 4; 610 static const int kQueueInitialSize = 4;
593 base::Semaphore command_received_; // Signaled for each command received. 611 base::Semaphore command_received_; // Signaled for each command received.
594 LockingCommandMessageQueue command_queue_; 612 LockingCommandMessageQueue command_queue_;
595 LockingCommandMessageQueue event_command_queue_; 613 LockingCommandMessageQueue event_command_queue_;
614 LockingTaskQueue embedder_task_queue_;
596 615
597 bool is_active_; 616 bool is_active_;
598 bool is_suppressed_; 617 bool is_suppressed_;
599 bool live_edit_enabled_; 618 bool live_edit_enabled_;
600 bool has_break_points_; 619 bool has_break_points_;
601 bool break_disabled_; 620 bool break_disabled_;
602 bool in_debug_event_listener_; 621 bool in_debug_event_listener_;
603 bool break_on_exception_; 622 bool break_on_exception_;
604 bool break_on_uncaught_exception_; 623 bool break_on_uncaught_exception_;
605 624
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 // several frames above. 784 // several frames above.
766 // There is no calling conventions here, because it never actually gets 785 // There is no calling conventions here, because it never actually gets
767 // called, it only gets returned to. 786 // called, it only gets returned to.
768 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); 787 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm);
769 }; 788 };
770 789
771 790
772 } } // namespace v8::internal 791 } } // namespace v8::internal
773 792
774 #endif // V8_DEBUG_H_ 793 #endif // V8_DEBUG_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698