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

Side by Side Diff: src/debug.cc

Issue 300793002: Move LiveEdit-related code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix x64 Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « src/debug.h ('k') | src/ia32/debug-ia32.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 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "api.h" 7 #include "api.h"
8 #include "arguments.h" 8 #include "arguments.h"
9 #include "bootstrapper.h" 9 #include "bootstrapper.h"
10 #include "code-stubs.h" 10 #include "code-stubs.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 MemCopy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal)); 536 MemCopy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal));
537 return storage + ArchiveSpacePerThread(); 537 return storage + ArchiveSpacePerThread();
538 } 538 }
539 539
540 540
541 int Debug::ArchiveSpacePerThread() { 541 int Debug::ArchiveSpacePerThread() {
542 return sizeof(ThreadLocal); 542 return sizeof(ThreadLocal);
543 } 543 }
544 544
545 545
546 // Frame structure (conforms InternalFrame structure):
547 // -- code
548 // -- SMI maker
549 // -- function (slot is called "context")
550 // -- frame base
551 Object** Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame,
552 Handle<Code> code) {
553 ASSERT(bottom_js_frame->is_java_script());
554
555 Address fp = bottom_js_frame->fp();
556
557 // Move function pointer into "context" slot.
558 Memory::Object_at(fp + StandardFrameConstants::kContextOffset) =
559 Memory::Object_at(fp + JavaScriptFrameConstants::kFunctionOffset);
560
561 Memory::Object_at(fp + InternalFrameConstants::kCodeOffset) = *code;
562 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset) =
563 Smi::FromInt(StackFrame::INTERNAL);
564
565 return reinterpret_cast<Object**>(&Memory::Object_at(
566 fp + StandardFrameConstants::kContextOffset));
567 }
568
569 const int Debug::kFrameDropperFrameSize = 4;
570
571
572 void ScriptCache::Add(Handle<Script> script) { 546 void ScriptCache::Add(Handle<Script> script) {
573 GlobalHandles* global_handles = isolate_->global_handles(); 547 GlobalHandles* global_handles = isolate_->global_handles();
574 // Create an entry in the hash map for the script. 548 // Create an entry in the hash map for the script.
575 int id = script->id()->value(); 549 int id = script->id()->value();
576 HashMap::Entry* entry = 550 HashMap::Entry* entry =
577 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); 551 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true);
578 if (entry->value != NULL) { 552 if (entry->value != NULL) {
579 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); 553 ASSERT(*script == *reinterpret_cast<Script**>(entry->value));
580 return; 554 return;
581 } 555 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 GlobalHandles::Destroy(Handle<Object>::cast(debug_context_).location()); 804 GlobalHandles::Destroy(Handle<Object>::cast(debug_context_).location());
831 debug_context_ = Handle<Context>(); 805 debug_context_ = Handle<Context>();
832 } 806 }
833 807
834 808
835 Object* Debug::Break(Arguments args) { 809 Object* Debug::Break(Arguments args) {
836 Heap* heap = isolate_->heap(); 810 Heap* heap = isolate_->heap();
837 HandleScope scope(isolate_); 811 HandleScope scope(isolate_);
838 ASSERT(args.length() == 0); 812 ASSERT(args.length() == 0);
839 813
840 thread_local_.frame_drop_mode_ = FRAMES_UNTOUCHED; 814 thread_local_.frame_drop_mode_ = LiveEdit::FRAMES_UNTOUCHED;
841 815
842 // Get the top-most JavaScript frame. 816 // Get the top-most JavaScript frame.
843 JavaScriptFrameIterator it(isolate_); 817 JavaScriptFrameIterator it(isolate_);
844 JavaScriptFrame* frame = it.frame(); 818 JavaScriptFrame* frame = it.frame();
845 819
846 // Just continue if breaks are disabled or debugger cannot be loaded. 820 // Just continue if breaks are disabled or debugger cannot be loaded.
847 if (disable_break()) { 821 if (disable_break()) {
848 SetAfterBreakTarget(frame); 822 SetAfterBreakTarget(frame);
849 return heap->undefined_value(); 823 return heap->undefined_value();
850 } 824 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 step_count = count; 917 step_count = count;
944 } 918 }
945 919
946 // Clear all current stepping setup. 920 // Clear all current stepping setup.
947 ClearStepping(); 921 ClearStepping();
948 922
949 // Set up for the remaining steps. 923 // Set up for the remaining steps.
950 PrepareStep(step_action, step_count, StackFrame::NO_ID); 924 PrepareStep(step_action, step_count, StackFrame::NO_ID);
951 } 925 }
952 926
953 if (thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) { 927 if (thread_local_.frame_drop_mode_ == LiveEdit::FRAMES_UNTOUCHED) {
954 SetAfterBreakTarget(frame); 928 SetAfterBreakTarget(frame);
955 } else if (thread_local_.frame_drop_mode_ == 929 } else if (thread_local_.frame_drop_mode_ ==
956 FRAME_DROPPED_IN_IC_CALL) { 930 LiveEdit::FRAME_DROPPED_IN_IC_CALL) {
957 // We must have been calling IC stub. Do not go there anymore. 931 // We must have been calling IC stub. Do not go there anymore.
958 Code* plain_return = isolate_->builtins()->builtin( 932 Code* plain_return = isolate_->builtins()->builtin(
959 Builtins::kPlainReturn_LiveEdit); 933 Builtins::kPlainReturn_LiveEdit);
960 thread_local_.after_break_target_ = plain_return->entry(); 934 thread_local_.after_break_target_ = plain_return->entry();
961 } else if (thread_local_.frame_drop_mode_ == 935 } else if (thread_local_.frame_drop_mode_ ==
962 FRAME_DROPPED_IN_DEBUG_SLOT_CALL) { 936 LiveEdit::FRAME_DROPPED_IN_DEBUG_SLOT_CALL) {
963 // Debug break slot stub does not return normally, instead it manually 937 // Debug break slot stub does not return normally, instead it manually
964 // cleans the stack and jumps. We should patch the jump address. 938 // cleans the stack and jumps. We should patch the jump address.
965 Code* plain_return = isolate_->builtins()->builtin( 939 Code* plain_return = isolate_->builtins()->builtin(
966 Builtins::kFrameDropper_LiveEdit); 940 Builtins::kFrameDropper_LiveEdit);
967 thread_local_.after_break_target_ = plain_return->entry(); 941 thread_local_.after_break_target_ = plain_return->entry();
968 } else if (thread_local_.frame_drop_mode_ == 942 } else if (thread_local_.frame_drop_mode_ ==
969 FRAME_DROPPED_IN_DIRECT_CALL) { 943 LiveEdit::FRAME_DROPPED_IN_DIRECT_CALL) {
970 // Nothing to do, after_break_target is not used here. 944 // Nothing to do, after_break_target is not used here.
971 } else if (thread_local_.frame_drop_mode_ == 945 } else if (thread_local_.frame_drop_mode_ ==
972 FRAME_DROPPED_IN_RETURN_CALL) { 946 LiveEdit::FRAME_DROPPED_IN_RETURN_CALL) {
973 Code* plain_return = isolate_->builtins()->builtin( 947 Code* plain_return = isolate_->builtins()->builtin(
974 Builtins::kFrameDropper_LiveEdit); 948 Builtins::kFrameDropper_LiveEdit);
975 thread_local_.after_break_target_ = plain_return->entry(); 949 thread_local_.after_break_target_ = plain_return->entry();
976 } else { 950 } else {
977 UNREACHABLE(); 951 UNREACHABLE();
978 } 952 }
979 953
980 return heap->undefined_value(); 954 return heap->undefined_value();
981 } 955 }
982 956
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 return (it.rinfo()->pc() == 2458 return (it.rinfo()->pc() ==
2485 addr - Assembler::kPatchReturnSequenceAddressOffset); 2459 addr - Assembler::kPatchReturnSequenceAddressOffset);
2486 } 2460 }
2487 it.next(); 2461 it.next();
2488 } 2462 }
2489 return false; 2463 return false;
2490 } 2464 }
2491 2465
2492 2466
2493 void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, 2467 void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id,
2494 FrameDropMode mode, 2468 LiveEdit::FrameDropMode mode,
2495 Object** restarter_frame_function_pointer) { 2469 Object** restarter_frame_function_pointer) {
2496 if (mode != CURRENTLY_SET_MODE) { 2470 if (mode != LiveEdit::CURRENTLY_SET_MODE) {
2497 thread_local_.frame_drop_mode_ = mode; 2471 thread_local_.frame_drop_mode_ = mode;
2498 } 2472 }
2499 thread_local_.break_frame_id_ = new_break_frame_id; 2473 thread_local_.break_frame_id_ = new_break_frame_id;
2500 thread_local_.restarter_frame_function_pointer_ = 2474 thread_local_.restarter_frame_function_pointer_ =
2501 restarter_frame_function_pointer; 2475 restarter_frame_function_pointer;
2502 } 2476 }
2503 2477
2504 2478
2505 const int Debug::FramePaddingLayout::kInitialSize = 1;
2506
2507
2508 // Any even value bigger than kInitialSize as needed for stack scanning.
2509 const int Debug::FramePaddingLayout::kPaddingValue = kInitialSize + 1;
2510
2511
2512 bool Debug::IsDebugGlobal(GlobalObject* global) { 2479 bool Debug::IsDebugGlobal(GlobalObject* global) {
2513 return IsLoaded() && global == debug_context()->global_object(); 2480 return IsLoaded() && global == debug_context()->global_object();
2514 } 2481 }
2515 2482
2516 2483
2517 void Debug::ClearMirrorCache() { 2484 void Debug::ClearMirrorCache() {
2518 PostponeInterruptsScope postpone(isolate_); 2485 PostponeInterruptsScope postpone(isolate_);
2519 HandleScope scope(isolate_); 2486 HandleScope scope(isolate_);
2520 ASSERT(isolate_->context() == *Debug::debug_context()); 2487 ASSERT(isolate_->context() == *Debug::debug_context());
2521 2488
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
3526 logger_->DebugEvent("Put", message.text()); 3493 logger_->DebugEvent("Put", message.text());
3527 } 3494 }
3528 3495
3529 3496
3530 void LockingCommandMessageQueue::Clear() { 3497 void LockingCommandMessageQueue::Clear() {
3531 LockGuard<Mutex> lock_guard(&mutex_); 3498 LockGuard<Mutex> lock_guard(&mutex_);
3532 queue_.Clear(); 3499 queue_.Clear();
3533 } 3500 }
3534 3501
3535 } } // namespace v8::internal 3502 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.h ('k') | src/ia32/debug-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698