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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 if (!is_active()) return; | 2136 if (!is_active()) return; |
2137 | 2137 |
2138 StackLimitCheck check(isolate_); | 2138 StackLimitCheck check(isolate_); |
2139 if (check.HasOverflowed()) return; | 2139 if (check.HasOverflowed()) return; |
2140 | 2140 |
2141 { JavaScriptFrameIterator it(isolate_); | 2141 { JavaScriptFrameIterator it(isolate_); |
2142 DCHECK(!it.done()); | 2142 DCHECK(!it.done()); |
2143 Object* fun = it.frame()->function(); | 2143 Object* fun = it.frame()->function(); |
2144 if (fun && fun->IsJSFunction()) { | 2144 if (fun && fun->IsJSFunction()) { |
2145 HandleScope scope(isolate_); | 2145 HandleScope scope(isolate_); |
| 2146 Handle<JSFunction> function(JSFunction::cast(fun), isolate_); |
2146 // Don't stop in builtin and blackboxed functions. | 2147 // Don't stop in builtin and blackboxed functions. |
2147 Handle<SharedFunctionInfo> shared(JSFunction::cast(fun)->shared(), | 2148 Handle<SharedFunctionInfo> shared(function->shared(), isolate_); |
2148 isolate_); | |
2149 bool ignore_break = ignore_break_mode == kIgnoreIfTopFrameBlackboxed | 2149 bool ignore_break = ignore_break_mode == kIgnoreIfTopFrameBlackboxed |
2150 ? IsBlackboxed(shared) | 2150 ? IsBlackboxed(shared) |
2151 : AllFramesOnStackAreBlackboxed(); | 2151 : AllFramesOnStackAreBlackboxed(); |
2152 if (ignore_break) { | 2152 if (ignore_break) { |
2153 // Inspector uses pause on next statement for asynchronous breakpoints. | 2153 // Inspector uses pause on next statement for asynchronous breakpoints. |
2154 // When breakpoint is fired we try to break on first not blackboxed | 2154 // When breakpoint is fired we try to break on first not blackboxed |
2155 // statement. To achieve this goal we need to deoptimize current | 2155 // statement. To achieve this goal we need to deoptimize current |
2156 // function and don't clear requested DebugBreak even if it's blackboxed | 2156 // function and don't clear requested DebugBreak even if it's blackboxed |
2157 // to be able to break on not blackboxed function call. | 2157 // to be able to break on not blackboxed function call. |
2158 // TODO(yangguo): introduce break_on_function_entry since current | 2158 // TODO(yangguo): introduce break_on_function_entry since current |
2159 // implementation is slow. | 2159 // implementation is slow. |
2160 if (isolate_->stack_guard()->CheckDebugBreak()) { | 2160 if (isolate_->stack_guard()->CheckDebugBreak()) { |
2161 Deoptimizer::DeoptimizeFunction(JSFunction::cast(fun)); | 2161 Deoptimizer::DeoptimizeFunction(*function); |
2162 } | 2162 } |
2163 return; | 2163 return; |
2164 } | 2164 } |
2165 JSGlobalObject* global = | 2165 JSGlobalObject* global = function->context()->global_object(); |
2166 JSFunction::cast(fun)->context()->global_object(); | |
2167 // Don't stop in debugger functions. | 2166 // Don't stop in debugger functions. |
2168 if (IsDebugGlobal(global)) return; | 2167 if (IsDebugGlobal(global)) return; |
2169 // Don't stop if the break location is muted. | 2168 // Don't stop if the break location is muted. |
2170 if (IsMutedAtCurrentLocation(it.frame())) return; | 2169 if (IsMutedAtCurrentLocation(it.frame())) return; |
2171 } | 2170 } |
2172 } | 2171 } |
2173 | 2172 |
2174 isolate_->stack_guard()->ClearDebugBreak(); | 2173 isolate_->stack_guard()->ClearDebugBreak(); |
2175 | 2174 |
2176 // Clear stepping to avoid duplicate breaks. | 2175 // Clear stepping to avoid duplicate breaks. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2453 isolate_->Throw(*isolate_->factory()->NewEvalError( | 2452 isolate_->Throw(*isolate_->factory()->NewEvalError( |
2454 MessageTemplate::kNoSideEffectDebugEvaluate)); | 2453 MessageTemplate::kNoSideEffectDebugEvaluate)); |
2455 } | 2454 } |
2456 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); | 2455 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); |
2457 isolate_->debug()->UpdateHookOnFunctionCall(); | 2456 isolate_->debug()->UpdateHookOnFunctionCall(); |
2458 isolate_->debug()->side_effect_check_failed_ = false; | 2457 isolate_->debug()->side_effect_check_failed_ = false; |
2459 } | 2458 } |
2460 | 2459 |
2461 } // namespace internal | 2460 } // namespace internal |
2462 } // namespace v8 | 2461 } // namespace v8 |
OLD | NEW |