| 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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 obj.Dispose(); | 710 obj.Dispose(); |
| 711 obj.Clear(); | 711 obj.Clear(); |
| 712 } | 712 } |
| 713 | 713 |
| 714 | 714 |
| 715 void Debug::Setup(bool create_heap_objects) { | 715 void Debug::Setup(bool create_heap_objects) { |
| 716 ThreadInit(); | 716 ThreadInit(); |
| 717 if (create_heap_objects) { | 717 if (create_heap_objects) { |
| 718 // Get code to handle debug break on return. | 718 // Get code to handle debug break on return. |
| 719 debug_break_return_ = | 719 debug_break_return_ = |
| 720 Isolate::Current()->builtins()->builtin(Builtins::Return_DebugBreak); | 720 Isolate::Current()->builtins()->builtin(Builtins::kReturn_DebugBreak); |
| 721 ASSERT(debug_break_return_->IsCode()); | 721 ASSERT(debug_break_return_->IsCode()); |
| 722 // Get code to handle debug break in debug break slots. | 722 // Get code to handle debug break in debug break slots. |
| 723 debug_break_slot_ = | 723 debug_break_slot_ = |
| 724 Isolate::Current()->builtins()->builtin(Builtins::Slot_DebugBreak); | 724 Isolate::Current()->builtins()->builtin(Builtins::kSlot_DebugBreak); |
| 725 ASSERT(debug_break_slot_->IsCode()); | 725 ASSERT(debug_break_slot_->IsCode()); |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 | 728 |
| 729 | 729 |
| 730 void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data) { | 730 void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data) { |
| 731 Debug* debug = Isolate::Current()->debug(); | 731 Debug* debug = Isolate::Current()->debug(); |
| 732 DebugInfoListNode* node = reinterpret_cast<DebugInfoListNode*>(data); | 732 DebugInfoListNode* node = reinterpret_cast<DebugInfoListNode*>(data); |
| 733 // We need to clear all breakpoints associated with the function to restore | 733 // We need to clear all breakpoints associated with the function to restore |
| 734 // original code and avoid patching the code twice later because | 734 // original code and avoid patching the code twice later because |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 // Set up for the remaining steps. | 1000 // Set up for the remaining steps. |
| 1001 debug->PrepareStep(step_action, step_count); | 1001 debug->PrepareStep(step_action, step_count); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 if (debug->thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) { | 1004 if (debug->thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) { |
| 1005 debug->SetAfterBreakTarget(frame); | 1005 debug->SetAfterBreakTarget(frame); |
| 1006 } else if (debug->thread_local_.frame_drop_mode_ == | 1006 } else if (debug->thread_local_.frame_drop_mode_ == |
| 1007 FRAME_DROPPED_IN_IC_CALL) { | 1007 FRAME_DROPPED_IN_IC_CALL) { |
| 1008 // We must have been calling IC stub. Do not go there anymore. | 1008 // We must have been calling IC stub. Do not go there anymore. |
| 1009 Code* plain_return = | 1009 Code* plain_return = |
| 1010 Isolate::Current()->builtins()->builtin(Builtins::PlainReturn_LiveEdit); | 1010 Isolate::Current()->builtins()->builtin( |
| 1011 Builtins::kPlainReturn_LiveEdit); |
| 1011 debug->thread_local_.after_break_target_ = plain_return->entry(); | 1012 debug->thread_local_.after_break_target_ = plain_return->entry(); |
| 1012 } else if (debug->thread_local_.frame_drop_mode_ == | 1013 } else if (debug->thread_local_.frame_drop_mode_ == |
| 1013 FRAME_DROPPED_IN_DEBUG_SLOT_CALL) { | 1014 FRAME_DROPPED_IN_DEBUG_SLOT_CALL) { |
| 1014 // Debug break slot stub does not return normally, instead it manually | 1015 // Debug break slot stub does not return normally, instead it manually |
| 1015 // cleans the stack and jumps. We should patch the jump address. | 1016 // cleans the stack and jumps. We should patch the jump address. |
| 1016 Code* plain_return = Isolate::Current()->builtins()->builtin( | 1017 Code* plain_return = Isolate::Current()->builtins()->builtin( |
| 1017 Builtins::FrameDropper_LiveEdit); | 1018 Builtins::kFrameDropper_LiveEdit); |
| 1018 debug->thread_local_.after_break_target_ = plain_return->entry(); | 1019 debug->thread_local_.after_break_target_ = plain_return->entry(); |
| 1019 } else if (debug->thread_local_.frame_drop_mode_ == | 1020 } else if (debug->thread_local_.frame_drop_mode_ == |
| 1020 FRAME_DROPPED_IN_DIRECT_CALL) { | 1021 FRAME_DROPPED_IN_DIRECT_CALL) { |
| 1021 // Nothing to do, after_break_target is not used here. | 1022 // Nothing to do, after_break_target is not used here. |
| 1022 } else { | 1023 } else { |
| 1023 UNREACHABLE(); | 1024 UNREACHABLE(); |
| 1024 } | 1025 } |
| 1025 | 1026 |
| 1026 return heap->undefined_value(); | 1027 return heap->undefined_value(); |
| 1027 } | 1028 } |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) { | 1511 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) { |
| 1511 // Find the builtin debug break function matching the calling convention | 1512 // Find the builtin debug break function matching the calling convention |
| 1512 // used by the call site. | 1513 // used by the call site. |
| 1513 if (code->is_inline_cache_stub()) { | 1514 if (code->is_inline_cache_stub()) { |
| 1514 switch (code->kind()) { | 1515 switch (code->kind()) { |
| 1515 case Code::CALL_IC: | 1516 case Code::CALL_IC: |
| 1516 case Code::KEYED_CALL_IC: | 1517 case Code::KEYED_CALL_IC: |
| 1517 return ComputeCallDebugBreak(code->arguments_count(), code->kind()); | 1518 return ComputeCallDebugBreak(code->arguments_count(), code->kind()); |
| 1518 | 1519 |
| 1519 case Code::LOAD_IC: | 1520 case Code::LOAD_IC: |
| 1520 return Handle<Code>(Isolate::Current()->builtins()->builtin( | 1521 return Isolate::Current()->builtins()->LoadIC_DebugBreak(); |
| 1521 Builtins::LoadIC_DebugBreak)); | |
| 1522 | 1522 |
| 1523 case Code::STORE_IC: | 1523 case Code::STORE_IC: |
| 1524 return Handle<Code>(Isolate::Current()->builtins()->builtin( | 1524 return Isolate::Current()->builtins()->StoreIC_DebugBreak(); |
| 1525 Builtins::StoreIC_DebugBreak)); | |
| 1526 | 1525 |
| 1527 case Code::KEYED_LOAD_IC: | 1526 case Code::KEYED_LOAD_IC: |
| 1528 return Handle<Code>( | 1527 return Isolate::Current()->builtins()->KeyedLoadIC_DebugBreak(); |
| 1529 Isolate::Current()->builtins()->builtin( | |
| 1530 Builtins::KeyedLoadIC_DebugBreak)); | |
| 1531 | 1528 |
| 1532 case Code::KEYED_STORE_IC: | 1529 case Code::KEYED_STORE_IC: |
| 1533 return Handle<Code>( | 1530 return Isolate::Current()->builtins()->KeyedStoreIC_DebugBreak(); |
| 1534 Isolate::Current()->builtins()->builtin( | |
| 1535 Builtins::KeyedStoreIC_DebugBreak)); | |
| 1536 | 1531 |
| 1537 default: | 1532 default: |
| 1538 UNREACHABLE(); | 1533 UNREACHABLE(); |
| 1539 } | 1534 } |
| 1540 } | 1535 } |
| 1541 if (RelocInfo::IsConstructCall(mode)) { | 1536 if (RelocInfo::IsConstructCall(mode)) { |
| 1542 Handle<Code> result = | 1537 Handle<Code> result = |
| 1543 Handle<Code>(Isolate::Current()->builtins()->builtin( | 1538 Isolate::Current()->builtins()->ConstructCall_DebugBreak(); |
| 1544 Builtins::ConstructCall_DebugBreak)); | |
| 1545 return result; | 1539 return result; |
| 1546 } | 1540 } |
| 1547 if (code->kind() == Code::STUB) { | 1541 if (code->kind() == Code::STUB) { |
| 1548 ASSERT(code->major_key() == CodeStub::CallFunction); | 1542 ASSERT(code->major_key() == CodeStub::CallFunction); |
| 1549 Handle<Code> result = | 1543 Handle<Code> result = |
| 1550 Handle<Code>(Isolate::Current()->builtins()->builtin( | 1544 Isolate::Current()->builtins()->StubNoRegisters_DebugBreak(); |
| 1551 Builtins::StubNoRegisters_DebugBreak)); | |
| 1552 return result; | 1545 return result; |
| 1553 } | 1546 } |
| 1554 | 1547 |
| 1555 UNREACHABLE(); | 1548 UNREACHABLE(); |
| 1556 return Handle<Code>::null(); | 1549 return Handle<Code>::null(); |
| 1557 } | 1550 } |
| 1558 | 1551 |
| 1559 | 1552 |
| 1560 // Simple function for returning the source positions for active break points. | 1553 // Simple function for returning the source positions for active break points. |
| 1561 Handle<Object> Debug::GetSourceBreakLocations( | 1554 Handle<Object> Debug::GetSourceBreakLocations( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 } | 1602 } |
| 1610 fp = it.frame()->fp(); | 1603 fp = it.frame()->fp(); |
| 1611 } | 1604 } |
| 1612 | 1605 |
| 1613 // Flood the function with one-shot break points if it is called from where | 1606 // Flood the function with one-shot break points if it is called from where |
| 1614 // step into was requested. | 1607 // step into was requested. |
| 1615 if (fp == step_in_fp()) { | 1608 if (fp == step_in_fp()) { |
| 1616 // Don't allow step into functions in the native context. | 1609 // Don't allow step into functions in the native context. |
| 1617 if (!function->IsBuiltin()) { | 1610 if (!function->IsBuiltin()) { |
| 1618 if (function->shared()->code() == | 1611 if (function->shared()->code() == |
| 1619 Isolate::Current()->builtins()->builtin(Builtins::FunctionApply) || | 1612 Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply) || |
| 1620 function->shared()->code() == | 1613 function->shared()->code() == |
| 1621 Isolate::Current()->builtins()->builtin(Builtins::FunctionCall)) { | 1614 Isolate::Current()->builtins()->builtin(Builtins::kFunctionCall)) { |
| 1622 // Handle function.apply and function.call separately to flood the | 1615 // Handle function.apply and function.call separately to flood the |
| 1623 // function to be called and not the code for Builtins::FunctionApply or | 1616 // function to be called and not the code for Builtins::FunctionApply or |
| 1624 // Builtins::FunctionCall. The receiver of call/apply is the target | 1617 // Builtins::FunctionCall. The receiver of call/apply is the target |
| 1625 // function. | 1618 // function. |
| 1626 if (!holder.is_null() && holder->IsJSFunction() && | 1619 if (!holder.is_null() && holder->IsJSFunction() && |
| 1627 !JSFunction::cast(*holder)->IsBuiltin()) { | 1620 !JSFunction::cast(*holder)->IsBuiltin()) { |
| 1628 Handle<SharedFunctionInfo> shared_info( | 1621 Handle<SharedFunctionInfo> shared_info( |
| 1629 JSFunction::cast(*holder)->shared()); | 1622 JSFunction::cast(*holder)->shared()); |
| 1630 Debug::FloodWithOneShot(shared_info); | 1623 Debug::FloodWithOneShot(shared_info); |
| 1631 } | 1624 } |
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3162 { | 3155 { |
| 3163 Locker locker; | 3156 Locker locker; |
| 3164 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3157 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
| 3165 } | 3158 } |
| 3166 } | 3159 } |
| 3167 } | 3160 } |
| 3168 | 3161 |
| 3169 #endif // ENABLE_DEBUGGER_SUPPORT | 3162 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3170 | 3163 |
| 3171 } } // namespace v8::internal | 3164 } } // namespace v8::internal |
| OLD | NEW |