| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 void SetDebugBreak(); | 139 void SetDebugBreak(); |
| 140 void ClearDebugBreak(); | 140 void ClearDebugBreak(); |
| 141 | 141 |
| 142 void SetDebugBreakAtIC(); | 142 void SetDebugBreakAtIC(); |
| 143 void ClearDebugBreakAtIC(); | 143 void ClearDebugBreakAtIC(); |
| 144 | 144 |
| 145 bool IsDebugBreakAtReturn(); | 145 bool IsDebugBreakAtReturn(); |
| 146 void SetDebugBreakAtReturn(); | 146 void SetDebugBreakAtReturn(); |
| 147 void ClearDebugBreakAtReturn(); | 147 void ClearDebugBreakAtReturn(); |
| 148 | 148 |
| 149 bool IsDebugBreakSlot(); |
| 150 bool IsDebugBreakAtSlot(); |
| 151 void SetDebugBreakAtSlot(); |
| 152 void ClearDebugBreakAtSlot(); |
| 153 |
| 149 DISALLOW_COPY_AND_ASSIGN(BreakLocationIterator); | 154 DISALLOW_COPY_AND_ASSIGN(BreakLocationIterator); |
| 150 }; | 155 }; |
| 151 | 156 |
| 152 | 157 |
| 153 // Cache of all script objects in the heap. When a script is added a weak handle | 158 // Cache of all script objects in the heap. When a script is added a weak handle |
| 154 // to it is created and that weak handle is stored in the cache. The weak handle | 159 // to it is created and that weak handle is stored in the cache. The weak handle |
| 155 // callback takes care of removing the script from the cache. The key used in | 160 // callback takes care of removing the script from the cache. The key used in |
| 156 // the cache is the script id. | 161 // the cache is the script id. |
| 157 class ScriptCache : private HashMap { | 162 class ScriptCache : private HashMap { |
| 158 public: | 163 public: |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 321 |
| 317 // Getters for the current exception break state. | 322 // Getters for the current exception break state. |
| 318 static bool break_on_exception() { return break_on_exception_; } | 323 static bool break_on_exception() { return break_on_exception_; } |
| 319 static bool break_on_uncaught_exception() { | 324 static bool break_on_uncaught_exception() { |
| 320 return break_on_uncaught_exception_; | 325 return break_on_uncaught_exception_; |
| 321 } | 326 } |
| 322 | 327 |
| 323 enum AddressId { | 328 enum AddressId { |
| 324 k_after_break_target_address, | 329 k_after_break_target_address, |
| 325 k_debug_break_return_address, | 330 k_debug_break_return_address, |
| 331 k_debug_break_slot_address, |
| 326 k_register_address | 332 k_register_address |
| 327 }; | 333 }; |
| 328 | 334 |
| 329 // Support for setting the address to jump to when returning from break point. | 335 // Support for setting the address to jump to when returning from break point. |
| 330 static Address* after_break_target_address() { | 336 static Address* after_break_target_address() { |
| 331 return reinterpret_cast<Address*>(&thread_local_.after_break_target_); | 337 return reinterpret_cast<Address*>(&thread_local_.after_break_target_); |
| 332 } | 338 } |
| 333 | 339 |
| 334 // Support for saving/restoring registers when handling debug break calls. | 340 // Support for saving/restoring registers when handling debug break calls. |
| 335 static Object** register_address(int r) { | 341 static Object** register_address(int r) { |
| 336 return ®isters_[r]; | 342 return ®isters_[r]; |
| 337 } | 343 } |
| 338 | 344 |
| 339 // Access to the debug break on return code. | 345 // Access to the debug break on return code. |
| 340 static Code* debug_break_return() { return debug_break_return_; } | 346 static Code* debug_break_return() { return debug_break_return_; } |
| 341 static Code** debug_break_return_address() { | 347 static Code** debug_break_return_address() { |
| 342 return &debug_break_return_; | 348 return &debug_break_return_; |
| 343 } | 349 } |
| 344 | 350 |
| 351 // Access to the debug break in debug break slot code. |
| 352 static Code* debug_break_slot() { return debug_break_slot_; } |
| 353 static Code** debug_break_slot_address() { |
| 354 return &debug_break_slot_; |
| 355 } |
| 356 |
| 345 static const int kEstimatedNofDebugInfoEntries = 16; | 357 static const int kEstimatedNofDebugInfoEntries = 16; |
| 346 static const int kEstimatedNofBreakPointsInFunction = 16; | 358 static const int kEstimatedNofBreakPointsInFunction = 16; |
| 347 | 359 |
| 348 static void HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data); | 360 static void HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data); |
| 349 | 361 |
| 350 friend class Debugger; | 362 friend class Debugger; |
| 351 friend Handle<FixedArray> GetDebuggedFunctions(); // In test-debug.cc | 363 friend Handle<FixedArray> GetDebuggedFunctions(); // In test-debug.cc |
| 352 friend void CheckDebuggerUnloaded(bool check_functions); // In test-debug.cc | 364 friend void CheckDebuggerUnloaded(bool check_functions); // In test-debug.cc |
| 353 | 365 |
| 354 // Threading support. | 366 // Threading support. |
| 355 static char* ArchiveDebug(char* to); | 367 static char* ArchiveDebug(char* to); |
| 356 static char* RestoreDebug(char* from); | 368 static char* RestoreDebug(char* from); |
| 357 static int ArchiveSpacePerThread(); | 369 static int ArchiveSpacePerThread(); |
| 358 static void FreeThreadResources() { } | 370 static void FreeThreadResources() { } |
| 359 | 371 |
| 360 // Mirror cache handling. | 372 // Mirror cache handling. |
| 361 static void ClearMirrorCache(); | 373 static void ClearMirrorCache(); |
| 362 | 374 |
| 363 // Script cache handling. | 375 // Script cache handling. |
| 364 static void CreateScriptCache(); | 376 static void CreateScriptCache(); |
| 365 static void DestroyScriptCache(); | 377 static void DestroyScriptCache(); |
| 366 static void AddScriptToScriptCache(Handle<Script> script); | 378 static void AddScriptToScriptCache(Handle<Script> script); |
| 367 static Handle<FixedArray> GetLoadedScripts(); | 379 static Handle<FixedArray> GetLoadedScripts(); |
| 368 | 380 |
| 369 // Garbage collection notifications. | 381 // Garbage collection notifications. |
| 370 static void AfterGarbageCollection(); | 382 static void AfterGarbageCollection(); |
| 371 | 383 |
| 372 // Code generator routines. | 384 // Code generator routines. |
| 385 static void GenerateSlot(MacroAssembler* masm); |
| 373 static void GenerateLoadICDebugBreak(MacroAssembler* masm); | 386 static void GenerateLoadICDebugBreak(MacroAssembler* masm); |
| 374 static void GenerateStoreICDebugBreak(MacroAssembler* masm); | 387 static void GenerateStoreICDebugBreak(MacroAssembler* masm); |
| 375 static void GenerateKeyedLoadICDebugBreak(MacroAssembler* masm); | 388 static void GenerateKeyedLoadICDebugBreak(MacroAssembler* masm); |
| 376 static void GenerateKeyedStoreICDebugBreak(MacroAssembler* masm); | 389 static void GenerateKeyedStoreICDebugBreak(MacroAssembler* masm); |
| 377 static void GenerateConstructCallDebugBreak(MacroAssembler* masm); | 390 static void GenerateConstructCallDebugBreak(MacroAssembler* masm); |
| 378 static void GenerateReturnDebugBreak(MacroAssembler* masm); | 391 static void GenerateReturnDebugBreak(MacroAssembler* masm); |
| 379 static void GenerateStubNoRegistersDebugBreak(MacroAssembler* masm); | 392 static void GenerateStubNoRegistersDebugBreak(MacroAssembler* masm); |
| 393 static void GenerateSlotDebugBreak(MacroAssembler* masm); |
| 380 static void GeneratePlainReturnLiveEdit(MacroAssembler* masm); | 394 static void GeneratePlainReturnLiveEdit(MacroAssembler* masm); |
| 381 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); | 395 static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); |
| 382 | 396 |
| 383 // Called from stub-cache.cc. | 397 // Called from stub-cache.cc. |
| 384 static void GenerateCallICDebugBreak(MacroAssembler* masm); | 398 static void GenerateCallICDebugBreak(MacroAssembler* masm); |
| 385 | 399 |
| 386 static void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id); | 400 static void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id); |
| 387 | 401 |
| 388 static void SetUpFrameDropperFrame(StackFrame* bottom_js_frame, | 402 static void SetUpFrameDropperFrame(StackFrame* bottom_js_frame, |
| 389 Handle<Code> code); | 403 Handle<Code> code); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 }; | 479 }; |
| 466 | 480 |
| 467 // Storage location for registers when handling debug break calls | 481 // Storage location for registers when handling debug break calls |
| 468 static JSCallerSavedBuffer registers_; | 482 static JSCallerSavedBuffer registers_; |
| 469 static ThreadLocal thread_local_; | 483 static ThreadLocal thread_local_; |
| 470 static void ThreadInit(); | 484 static void ThreadInit(); |
| 471 | 485 |
| 472 // Code to call for handling debug break on return. | 486 // Code to call for handling debug break on return. |
| 473 static Code* debug_break_return_; | 487 static Code* debug_break_return_; |
| 474 | 488 |
| 489 // Code to call for handling debug break in debug break slots. |
| 490 static Code* debug_break_slot_; |
| 491 |
| 475 DISALLOW_COPY_AND_ASSIGN(Debug); | 492 DISALLOW_COPY_AND_ASSIGN(Debug); |
| 476 }; | 493 }; |
| 477 | 494 |
| 478 | 495 |
| 479 // Message delivered to the message handler callback. This is either a debugger | 496 // Message delivered to the message handler callback. This is either a debugger |
| 480 // event or the response to a command. | 497 // event or the response to a command. |
| 481 class MessageImpl: public v8::Debug::Message { | 498 class MessageImpl: public v8::Debug::Message { |
| 482 public: | 499 public: |
| 483 // Create a message object for a debug event. | 500 // Create a message object for a debug event. |
| 484 static MessageImpl NewEvent(DebugEvent event, | 501 static MessageImpl NewEvent(DebugEvent event, |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 static Debug_Address Register(int reg) { | 905 static Debug_Address Register(int reg) { |
| 889 return Debug_Address(Debug::k_register_address, reg); | 906 return Debug_Address(Debug::k_register_address, reg); |
| 890 } | 907 } |
| 891 | 908 |
| 892 Address address() const { | 909 Address address() const { |
| 893 switch (id_) { | 910 switch (id_) { |
| 894 case Debug::k_after_break_target_address: | 911 case Debug::k_after_break_target_address: |
| 895 return reinterpret_cast<Address>(Debug::after_break_target_address()); | 912 return reinterpret_cast<Address>(Debug::after_break_target_address()); |
| 896 case Debug::k_debug_break_return_address: | 913 case Debug::k_debug_break_return_address: |
| 897 return reinterpret_cast<Address>(Debug::debug_break_return_address()); | 914 return reinterpret_cast<Address>(Debug::debug_break_return_address()); |
| 915 case Debug::k_debug_break_slot_address: |
| 916 return reinterpret_cast<Address>(Debug::debug_break_slot_address()); |
| 898 case Debug::k_register_address: | 917 case Debug::k_register_address: |
| 899 return reinterpret_cast<Address>(Debug::register_address(reg_)); | 918 return reinterpret_cast<Address>(Debug::register_address(reg_)); |
| 900 default: | 919 default: |
| 901 UNREACHABLE(); | 920 UNREACHABLE(); |
| 902 return NULL; | 921 return NULL; |
| 903 } | 922 } |
| 904 } | 923 } |
| 905 private: | 924 private: |
| 906 Debug::AddressId id_; | 925 Debug::AddressId id_; |
| 907 int reg_; | 926 int reg_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 927 | 946 |
| 928 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); | 947 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); |
| 929 }; | 948 }; |
| 930 | 949 |
| 931 | 950 |
| 932 } } // namespace v8::internal | 951 } } // namespace v8::internal |
| 933 | 952 |
| 934 #endif // ENABLE_DEBUGGER_SUPPORT | 953 #endif // ENABLE_DEBUGGER_SUPPORT |
| 935 | 954 |
| 936 #endif // V8_DEBUG_H_ | 955 #endif // V8_DEBUG_H_ |
| OLD | NEW |