Chromium Code Reviews| 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() == 3); | 1215 DCHECK(args.length() == 2); |
|
Benedikt Meurer
2015/12/16 08:03:23
Nit: DCHECK_EQ(2, args.length())
| |
| 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()) { |
| 1220 return isolate->Throw(isolate->heap()->illegal_argument_string()); | 1220 return isolate->Throw(isolate->heap()->illegal_argument_string()); |
| 1221 } | 1221 } |
| 1222 | 1222 |
| 1223 // Get the step action and check validity. | 1223 // Get the step action and check validity. |
| 1224 StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1])); | 1224 StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1])); |
| 1225 if (step_action != StepIn && step_action != StepNext && | 1225 if (step_action != StepIn && step_action != StepNext && |
| 1226 step_action != StepOut && step_action != StepFrame) { | 1226 step_action != StepOut && step_action != StepFrame) { |
| 1227 return isolate->Throw(isolate->heap()->illegal_argument_string()); | 1227 return isolate->Throw(isolate->heap()->illegal_argument_string()); |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 // Get the number of steps. | |
| 1231 int step_count = NumberToInt32(args[2]); | |
| 1232 if (step_count < 1) { | |
| 1233 return isolate->Throw(isolate->heap()->illegal_argument_string()); | |
| 1234 } | |
| 1235 | |
| 1236 // Clear all current stepping setup. | 1230 // Clear all current stepping setup. |
| 1237 isolate->debug()->ClearStepping(); | 1231 isolate->debug()->ClearStepping(); |
| 1238 | 1232 |
| 1239 // Prepare step. | 1233 // Prepare step. |
| 1240 isolate->debug()->PrepareStep(static_cast<StepAction>(step_action), | 1234 isolate->debug()->PrepareStep(static_cast<StepAction>(step_action), 1); |
| 1241 step_count); | |
| 1242 return isolate->heap()->undefined_value(); | 1235 return isolate->heap()->undefined_value(); |
| 1243 } | 1236 } |
| 1244 | 1237 |
| 1245 | 1238 |
| 1246 // Clear all stepping set by PrepareStep. | 1239 // Clear all stepping set by PrepareStep. |
| 1247 RUNTIME_FUNCTION(Runtime_ClearStepping) { | 1240 RUNTIME_FUNCTION(Runtime_ClearStepping) { |
| 1248 HandleScope scope(isolate); | 1241 HandleScope scope(isolate); |
| 1249 DCHECK(args.length() == 0); | 1242 DCHECK(args.length() == 0); |
| 1250 RUNTIME_ASSERT(isolate->debug()->is_active()); | 1243 RUNTIME_ASSERT(isolate->debug()->is_active()); |
| 1251 isolate->debug()->ClearStepping(); | 1244 isolate->debug()->ClearStepping(); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1687 return Smi::FromInt(isolate->debug()->is_active()); | 1680 return Smi::FromInt(isolate->debug()->is_active()); |
| 1688 } | 1681 } |
| 1689 | 1682 |
| 1690 | 1683 |
| 1691 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 1684 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
| 1692 UNIMPLEMENTED(); | 1685 UNIMPLEMENTED(); |
| 1693 return NULL; | 1686 return NULL; |
| 1694 } | 1687 } |
| 1695 } // namespace internal | 1688 } // namespace internal |
| 1696 } // namespace v8 | 1689 } // namespace v8 |
| OLD | NEW |