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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/debug.h" | 10 #include "src/debug.h" |
| 11 #include "src/deoptimizer.h" | 11 #include "src/deoptimizer.h" |
| 12 #include "src/isolate-inl.h" | 12 #include "src/isolate-inl.h" |
| 13 #include "src/parser.h" | 13 #include "src/parser.h" |
| 14 #include "src/runtime/runtime.h" | 14 #include "src/runtime/runtime.h" |
| 15 #include "src/runtime/runtime-utils.h" | 15 #include "src/runtime/runtime-utils.h" |
| 16 | 16 |
| 17 namespace v8 { | 17 namespace v8 { |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| 20 RUNTIME_FUNCTION(Runtime_DebugBreak) { | 20 RUNTIME_FUNCTION(Runtime_DebugBreak) { |
| 21 SealHandleScope shs(isolate); | 21 SealHandleScope shs(isolate); |
| 22 DCHECK(args.length() == 0); | 22 DCHECK(args.length() == 0); |
| 23 bool is_debugger_statement = !isolate->stack_guard()->CheckDebugCommand() && | |
| 24 !isolate->stack_guard()->CheckDebugBreak(); | |
|
yurys
2015/03/26 19:44:48
RequestDebugBreak can be called on another thread.
Yang
2015/03/27 09:10:21
How about we just check whether the debugger is ac
| |
| 25 | |
| 26 if (is_debugger_statement) { | |
| 27 // If we have been called via 'debugger' Javascript statement, | |
| 28 // we might not be prepared for breakpoints. | |
| 29 HandleScope handle_scope(isolate); | |
| 30 isolate->debug()->PrepareForBreakPoints(); | |
| 31 } | |
| 23 isolate->debug()->HandleDebugBreak(); | 32 isolate->debug()->HandleDebugBreak(); |
| 24 return isolate->heap()->undefined_value(); | 33 return isolate->heap()->undefined_value(); |
| 25 } | 34 } |
| 26 | 35 |
| 27 | 36 |
| 28 // Helper functions for wrapping and unwrapping stack frame ids. | 37 // Helper functions for wrapping and unwrapping stack frame ids. |
| 29 static Smi* WrapFrameId(StackFrame::Id id) { | 38 static Smi* WrapFrameId(StackFrame::Id id) { |
| 30 DCHECK(IsAligned(OffsetFrom(id), static_cast<intptr_t>(4))); | 39 DCHECK(IsAligned(OffsetFrom(id), static_cast<intptr_t>(4))); |
| 31 return Smi::FromInt(id >> 2); | 40 return Smi::FromInt(id >> 2); |
| 32 } | 41 } |
| (...skipping 2754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2787 return Smi::FromInt(isolate->debug()->is_active()); | 2796 return Smi::FromInt(isolate->debug()->is_active()); |
| 2788 } | 2797 } |
| 2789 | 2798 |
| 2790 | 2799 |
| 2791 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 2800 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
| 2792 UNIMPLEMENTED(); | 2801 UNIMPLEMENTED(); |
| 2793 return NULL; | 2802 return NULL; |
| 2794 } | 2803 } |
| 2795 } | 2804 } |
| 2796 } // namespace v8::internal | 2805 } // namespace v8::internal |
| OLD | NEW |