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/v8.h" | 5 #include "src/v8.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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 | 1089 |
1090 Handle<DebugInfo> debug_info = GetDebugInfo(shared); | 1090 Handle<DebugInfo> debug_info = GetDebugInfo(shared); |
1091 // Source positions starts with zero. | 1091 // Source positions starts with zero. |
1092 DCHECK(*source_position >= 0); | 1092 DCHECK(*source_position >= 0); |
1093 | 1093 |
1094 // Find the break point and change it. | 1094 // Find the break point and change it. |
1095 BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS); | 1095 BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS); |
1096 it.FindBreakLocationFromPosition(*source_position, STATEMENT_ALIGNED); | 1096 it.FindBreakLocationFromPosition(*source_position, STATEMENT_ALIGNED); |
1097 it.SetBreakPoint(break_point_object); | 1097 it.SetBreakPoint(break_point_object); |
1098 | 1098 |
1099 *source_position = it.position(); | 1099 *source_position = it.statement_position(); |
1100 | 1100 |
1101 // At least one active break point now. | 1101 // At least one active break point now. |
1102 return debug_info->GetBreakPointCount() > 0; | 1102 return debug_info->GetBreakPointCount() > 0; |
1103 } | 1103 } |
1104 | 1104 |
1105 | 1105 |
1106 bool Debug::SetBreakPointForScript(Handle<Script> script, | 1106 bool Debug::SetBreakPointForScript(Handle<Script> script, |
1107 Handle<Object> break_point_object, | 1107 Handle<Object> break_point_object, |
1108 int* source_position, | 1108 int* source_position, |
1109 BreakPositionAlignment alignment) { | 1109 BreakPositionAlignment alignment) { |
(...skipping 23 matching lines...) Expand all Loading... |
1133 | 1133 |
1134 Handle<DebugInfo> debug_info = GetDebugInfo(shared); | 1134 Handle<DebugInfo> debug_info = GetDebugInfo(shared); |
1135 // Source positions starts with zero. | 1135 // Source positions starts with zero. |
1136 DCHECK(position >= 0); | 1136 DCHECK(position >= 0); |
1137 | 1137 |
1138 // Find the break point and change it. | 1138 // Find the break point and change it. |
1139 BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS); | 1139 BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS); |
1140 it.FindBreakLocationFromPosition(position, alignment); | 1140 it.FindBreakLocationFromPosition(position, alignment); |
1141 it.SetBreakPoint(break_point_object); | 1141 it.SetBreakPoint(break_point_object); |
1142 | 1142 |
1143 *source_position = it.position() + shared->start_position(); | 1143 position = (alignment == STATEMENT_ALIGNED) ? it.statement_position() |
| 1144 : it.position(); |
| 1145 |
| 1146 *source_position = position + shared->start_position(); |
1144 | 1147 |
1145 // At least one active break point now. | 1148 // At least one active break point now. |
1146 DCHECK(debug_info->GetBreakPointCount() > 0); | 1149 DCHECK(debug_info->GetBreakPointCount() > 0); |
1147 return true; | 1150 return true; |
1148 } | 1151 } |
1149 | 1152 |
1150 | 1153 |
1151 void Debug::ClearBreakPoint(Handle<Object> break_point_object) { | 1154 void Debug::ClearBreakPoint(Handle<Object> break_point_object) { |
1152 HandleScope scope(isolate_); | 1155 HandleScope scope(isolate_); |
1153 | 1156 |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 BreakPointInfo::cast(debug_info->break_points()->get(i)); | 1562 BreakPointInfo::cast(debug_info->break_points()->get(i)); |
1560 if (break_point_info->GetBreakPointCount() > 0) { | 1563 if (break_point_info->GetBreakPointCount() > 0) { |
1561 Smi* position; | 1564 Smi* position; |
1562 switch (position_alignment) { | 1565 switch (position_alignment) { |
1563 case STATEMENT_ALIGNED: | 1566 case STATEMENT_ALIGNED: |
1564 position = break_point_info->statement_position(); | 1567 position = break_point_info->statement_position(); |
1565 break; | 1568 break; |
1566 case BREAK_POSITION_ALIGNED: | 1569 case BREAK_POSITION_ALIGNED: |
1567 position = break_point_info->source_position(); | 1570 position = break_point_info->source_position(); |
1568 break; | 1571 break; |
1569 default: | |
1570 UNREACHABLE(); | |
1571 position = break_point_info->statement_position(); | |
1572 } | 1572 } |
1573 | 1573 |
1574 locations->set(count++, position); | 1574 locations->set(count++, position); |
1575 } | 1575 } |
1576 } | 1576 } |
1577 } | 1577 } |
1578 return locations; | 1578 return locations; |
1579 } | 1579 } |
1580 | 1580 |
1581 | 1581 |
(...skipping 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3385 logger_->DebugEvent("Put", message.text()); | 3385 logger_->DebugEvent("Put", message.text()); |
3386 } | 3386 } |
3387 | 3387 |
3388 | 3388 |
3389 void LockingCommandMessageQueue::Clear() { | 3389 void LockingCommandMessageQueue::Clear() { |
3390 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 3390 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
3391 queue_.Clear(); | 3391 queue_.Clear(); |
3392 } | 3392 } |
3393 | 3393 |
3394 } } // namespace v8::internal | 3394 } } // namespace v8::internal |
OLD | NEW |