| OLD | NEW |
| 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 "src/debug/debug.h" | 5 #include "src/debug/debug.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 while (node != NULL) { | 683 while (node != NULL) { |
| 684 Handle<Object> result = | 684 Handle<Object> result = |
| 685 DebugInfo::FindBreakPointInfo(node->debug_info(), break_point_object); | 685 DebugInfo::FindBreakPointInfo(node->debug_info(), break_point_object); |
| 686 if (!result->IsUndefined()) { | 686 if (!result->IsUndefined()) { |
| 687 // Get information in the break point. | 687 // Get information in the break point. |
| 688 Handle<BreakPointInfo> break_point_info = | 688 Handle<BreakPointInfo> break_point_info = |
| 689 Handle<BreakPointInfo>::cast(result); | 689 Handle<BreakPointInfo>::cast(result); |
| 690 Handle<DebugInfo> debug_info = node->debug_info(); | 690 Handle<DebugInfo> debug_info = node->debug_info(); |
| 691 | 691 |
| 692 // Find the break point and clear it. | 692 // Find the break point and clear it. |
| 693 Address pc = debug_info->code()->entry() + | 693 Address pc = |
| 694 break_point_info->code_position()->value(); | 694 debug_info->code()->entry() + break_point_info->code_position(); |
| 695 | 695 |
| 696 BreakLocation location = | 696 BreakLocation location = |
| 697 BreakLocation::FromAddress(debug_info, ALL_BREAK_LOCATIONS, pc); | 697 BreakLocation::FromAddress(debug_info, ALL_BREAK_LOCATIONS, pc); |
| 698 location.ClearBreakPoint(break_point_object); | 698 location.ClearBreakPoint(break_point_object); |
| 699 | 699 |
| 700 // If there are no more break points left remove the debug info for this | 700 // If there are no more break points left remove the debug info for this |
| 701 // function. | 701 // function. |
| 702 if (debug_info->GetBreakPointCount() == 0) { | 702 if (debug_info->GetBreakPointCount() == 0) { |
| 703 RemoveDebugInfoAndClearFromShared(debug_info); | 703 RemoveDebugInfoAndClearFromShared(debug_info); |
| 704 } | 704 } |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 int count = 0; | 1064 int count = 0; |
| 1065 for (int i = 0; i < debug_info->break_points()->length(); ++i) { | 1065 for (int i = 0; i < debug_info->break_points()->length(); ++i) { |
| 1066 if (!debug_info->break_points()->get(i)->IsUndefined()) { | 1066 if (!debug_info->break_points()->get(i)->IsUndefined()) { |
| 1067 BreakPointInfo* break_point_info = | 1067 BreakPointInfo* break_point_info = |
| 1068 BreakPointInfo::cast(debug_info->break_points()->get(i)); | 1068 BreakPointInfo::cast(debug_info->break_points()->get(i)); |
| 1069 int break_points = break_point_info->GetBreakPointCount(); | 1069 int break_points = break_point_info->GetBreakPointCount(); |
| 1070 if (break_points == 0) continue; | 1070 if (break_points == 0) continue; |
| 1071 Smi* position = NULL; | 1071 Smi* position = NULL; |
| 1072 switch (position_alignment) { | 1072 switch (position_alignment) { |
| 1073 case STATEMENT_ALIGNED: | 1073 case STATEMENT_ALIGNED: |
| 1074 position = break_point_info->statement_position(); | 1074 position = Smi::FromInt(break_point_info->statement_position()); |
| 1075 break; | 1075 break; |
| 1076 case BREAK_POSITION_ALIGNED: | 1076 case BREAK_POSITION_ALIGNED: |
| 1077 position = break_point_info->source_position(); | 1077 position = Smi::FromInt(break_point_info->source_position()); |
| 1078 break; | 1078 break; |
| 1079 } | 1079 } |
| 1080 for (int j = 0; j < break_points; ++j) locations->set(count++, position); | 1080 for (int j = 0; j < break_points; ++j) locations->set(count++, position); |
| 1081 } | 1081 } |
| 1082 } | 1082 } |
| 1083 return locations; | 1083 return locations; |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 | 1086 |
| 1087 // Handle stepping into a function. | 1087 // Handle stepping into a function. |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 void Debug::RecordEvalCaller(Handle<Script> script) { | 1671 void Debug::RecordEvalCaller(Handle<Script> script) { |
| 1672 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); | 1672 script->set_compilation_type(Script::COMPILATION_TYPE_EVAL); |
| 1673 // For eval scripts add information on the function from which eval was | 1673 // For eval scripts add information on the function from which eval was |
| 1674 // called. | 1674 // called. |
| 1675 StackTraceFrameIterator it(script->GetIsolate()); | 1675 StackTraceFrameIterator it(script->GetIsolate()); |
| 1676 if (!it.done()) { | 1676 if (!it.done()) { |
| 1677 script->set_eval_from_shared(it.frame()->function()->shared()); | 1677 script->set_eval_from_shared(it.frame()->function()->shared()); |
| 1678 Code* code = it.frame()->LookupCode(); | 1678 Code* code = it.frame()->LookupCode(); |
| 1679 int offset = static_cast<int>( | 1679 int offset = static_cast<int>( |
| 1680 it.frame()->pc() - code->instruction_start()); | 1680 it.frame()->pc() - code->instruction_start()); |
| 1681 script->set_eval_from_instructions_offset(Smi::FromInt(offset)); | 1681 script->set_eval_from_instructions_offset(offset); |
| 1682 } | 1682 } |
| 1683 } | 1683 } |
| 1684 | 1684 |
| 1685 | 1685 |
| 1686 MaybeHandle<Object> Debug::MakeExecutionState() { | 1686 MaybeHandle<Object> Debug::MakeExecutionState() { |
| 1687 // Create the execution state object. | 1687 // Create the execution state object. |
| 1688 Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()) }; | 1688 Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()) }; |
| 1689 return CallFunction("MakeExecutionState", arraysize(argv), argv); | 1689 return CallFunction("MakeExecutionState", arraysize(argv), argv); |
| 1690 } | 1690 } |
| 1691 | 1691 |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2580 } | 2580 } |
| 2581 | 2581 |
| 2582 | 2582 |
| 2583 void LockingCommandMessageQueue::Clear() { | 2583 void LockingCommandMessageQueue::Clear() { |
| 2584 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2584 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 2585 queue_.Clear(); | 2585 queue_.Clear(); |
| 2586 } | 2586 } |
| 2587 | 2587 |
| 2588 } // namespace internal | 2588 } // namespace internal |
| 2589 } // namespace v8 | 2589 } // namespace v8 |
| OLD | NEW |