| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/debug/debug-evaluate.h" | 9 #include "src/debug/debug-evaluate.h" |
| 10 #include "src/debug/debug-frames.h" | 10 #include "src/debug/debug-frames.h" |
| (...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 } | 1205 } |
| 1206 | 1206 |
| 1207 | 1207 |
| 1208 // Prepare for stepping | 1208 // Prepare for stepping |
| 1209 // args[0]: break id for checking execution state | 1209 // args[0]: break id for checking execution state |
| 1210 // args[1]: step action from the enumeration StepAction | 1210 // args[1]: step action from the enumeration StepAction |
| 1211 // args[2]: number of times to perform the step, for step out it is the number | 1211 // args[2]: number of times to perform the step, for step out it is the number |
| 1212 // of frames to step down. | 1212 // of frames to step down. |
| 1213 RUNTIME_FUNCTION(Runtime_PrepareStep) { | 1213 RUNTIME_FUNCTION(Runtime_PrepareStep) { |
| 1214 HandleScope scope(isolate); | 1214 HandleScope scope(isolate); |
| 1215 DCHECK(args.length() == 4); | 1215 DCHECK(args.length() == 3); |
| 1216 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); | 1216 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
| 1217 RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); | 1217 RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); |
| 1218 | 1218 |
| 1219 if (!args[1]->IsNumber() || !args[2]->IsNumber()) { | 1219 if (!args[1]->IsNumber() || !args[2]->IsNumber()) { |
| 1220 return isolate->Throw(isolate->heap()->illegal_argument_string()); | 1220 return isolate->Throw(isolate->heap()->illegal_argument_string()); |
| 1221 } | 1221 } |
| 1222 | 1222 |
| 1223 CONVERT_NUMBER_CHECKED(int, wrapped_frame_id, Int32, args[3]); | |
| 1224 | |
| 1225 StackFrame::Id frame_id; | |
| 1226 if (wrapped_frame_id == 0) { | |
| 1227 frame_id = StackFrame::NO_ID; | |
| 1228 } else { | |
| 1229 frame_id = DebugFrameHelper::UnwrapFrameId(wrapped_frame_id); | |
| 1230 } | |
| 1231 | |
| 1232 // Get the step action and check validity. | 1223 // Get the step action and check validity. |
| 1233 StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1])); | 1224 StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1])); |
| 1234 if (step_action != StepIn && step_action != StepNext && | 1225 if (step_action != StepIn && step_action != StepNext && |
| 1235 step_action != StepOut && step_action != StepFrame) { | 1226 step_action != StepOut && step_action != StepFrame) { |
| 1236 return isolate->Throw(isolate->heap()->illegal_argument_string()); | 1227 return isolate->Throw(isolate->heap()->illegal_argument_string()); |
| 1237 } | 1228 } |
| 1238 | 1229 |
| 1239 if (frame_id != StackFrame::NO_ID && step_action != StepNext && | |
| 1240 step_action != StepOut) { | |
| 1241 return isolate->ThrowIllegalOperation(); | |
| 1242 } | |
| 1243 | |
| 1244 // Get the number of steps. | 1230 // Get the number of steps. |
| 1245 int step_count = NumberToInt32(args[2]); | 1231 int step_count = NumberToInt32(args[2]); |
| 1246 if (step_count < 1) { | 1232 if (step_count < 1) { |
| 1247 return isolate->Throw(isolate->heap()->illegal_argument_string()); | 1233 return isolate->Throw(isolate->heap()->illegal_argument_string()); |
| 1248 } | 1234 } |
| 1249 | 1235 |
| 1250 // Clear all current stepping setup. | 1236 // Clear all current stepping setup. |
| 1251 isolate->debug()->ClearStepping(); | 1237 isolate->debug()->ClearStepping(); |
| 1252 | 1238 |
| 1253 // Prepare step. | 1239 // Prepare step. |
| 1254 isolate->debug()->PrepareStep(static_cast<StepAction>(step_action), | 1240 isolate->debug()->PrepareStep(static_cast<StepAction>(step_action), |
| 1255 step_count, frame_id); | 1241 step_count); |
| 1256 return isolate->heap()->undefined_value(); | 1242 return isolate->heap()->undefined_value(); |
| 1257 } | 1243 } |
| 1258 | 1244 |
| 1259 | 1245 |
| 1260 // Clear all stepping set by PrepareStep. | 1246 // Clear all stepping set by PrepareStep. |
| 1261 RUNTIME_FUNCTION(Runtime_ClearStepping) { | 1247 RUNTIME_FUNCTION(Runtime_ClearStepping) { |
| 1262 HandleScope scope(isolate); | 1248 HandleScope scope(isolate); |
| 1263 DCHECK(args.length() == 0); | 1249 DCHECK(args.length() == 0); |
| 1264 RUNTIME_ASSERT(isolate->debug()->is_active()); | 1250 RUNTIME_ASSERT(isolate->debug()->is_active()); |
| 1265 isolate->debug()->ClearStepping(); | 1251 isolate->debug()->ClearStepping(); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 return Smi::FromInt(isolate->debug()->is_active()); | 1687 return Smi::FromInt(isolate->debug()->is_active()); |
| 1702 } | 1688 } |
| 1703 | 1689 |
| 1704 | 1690 |
| 1705 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1691 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
| 1706 UNIMPLEMENTED(); | 1692 UNIMPLEMENTED(); |
| 1707 return NULL; | 1693 return NULL; |
| 1708 } | 1694 } |
| 1709 } // namespace internal | 1695 } // namespace internal |
| 1710 } // namespace v8 | 1696 } // namespace v8 |
| OLD | NEW |