Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/debug/debug.cc

Issue 2738503006: [inspector] don't make v8::debug::Call for breakProgram. (Closed)
Patch Set: addressed comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2118 2118
2119 Handle<Object> argv[] = { exec_state, data }; 2119 Handle<Object> argv[] = { exec_state, data };
2120 return Execution::Call( 2120 return Execution::Call(
2121 isolate_, 2121 isolate_,
2122 fun, 2122 fun,
2123 Handle<Object>(debug_context()->global_proxy(), isolate_), 2123 Handle<Object>(debug_context()->global_proxy(), isolate_),
2124 arraysize(argv), 2124 arraysize(argv),
2125 argv); 2125 argv);
2126 } 2126 }
2127 2127
2128 2128 void Debug::HandleDebugBreak(IgnoreBreakMode ignore_break_mode) {
2129 void Debug::HandleDebugBreak() {
2130 // Initialize LiveEdit. 2129 // Initialize LiveEdit.
2131 LiveEdit::InitializeThreadLocal(this); 2130 LiveEdit::InitializeThreadLocal(this);
2132 // Ignore debug break during bootstrapping. 2131 // Ignore debug break during bootstrapping.
2133 if (isolate_->bootstrapper()->IsActive()) return; 2132 if (isolate_->bootstrapper()->IsActive()) return;
2134 // Just continue if breaks are disabled. 2133 // Just continue if breaks are disabled.
2135 if (break_disabled()) return; 2134 if (break_disabled()) return;
2136 // Ignore debug break if debugger is not active. 2135 // Ignore debug break if debugger is not active.
2137 if (!is_active()) return; 2136 if (!is_active()) return;
2138 2137
2139 StackLimitCheck check(isolate_); 2138 StackLimitCheck check(isolate_);
2140 if (check.HasOverflowed()) return; 2139 if (check.HasOverflowed()) return;
2141 2140
2142 { JavaScriptFrameIterator it(isolate_); 2141 { JavaScriptFrameIterator it(isolate_);
2143 DCHECK(!it.done()); 2142 DCHECK(!it.done());
2144 Object* fun = it.frame()->function(); 2143 Object* fun = it.frame()->function();
2145 if (fun && fun->IsJSFunction()) { 2144 if (fun && fun->IsJSFunction()) {
2146 HandleScope scope(isolate_); 2145 HandleScope scope(isolate_);
2147 // Don't stop in builtin and blackboxed functions. 2146 // Don't stop in builtin and blackboxed functions.
2148 Handle<SharedFunctionInfo> shared(JSFunction::cast(fun)->shared(), 2147 Handle<SharedFunctionInfo> shared(JSFunction::cast(fun)->shared(),
2149 isolate_); 2148 isolate_);
2150 if (IsBlackboxed(shared)) { 2149 bool ignore_break = ignore_break_mode == kIgnoreIfTopFrameBlackboxed
2150 ? IsBlackboxed(shared)
2151 : AllFramesOnStackAreBlackboxed();
2152 if (ignore_break) {
2151 // Inspector uses pause on next statement for asynchronous breakpoints. 2153 // Inspector uses pause on next statement for asynchronous breakpoints.
2152 // 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
2153 // statement. To achieve this goal we need to deoptimize current 2155 // statement. To achieve this goal we need to deoptimize current
2154 // 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
2155 // to be able to break on not blackboxed function call. 2157 // to be able to break on not blackboxed function call.
2156 // TODO(yangguo): introduce break_on_function_entry since current 2158 // TODO(yangguo): introduce break_on_function_entry since current
2157 // implementation is slow. 2159 // implementation is slow.
2158 if (isolate_->stack_guard()->CheckDebugBreak()) { 2160 if (isolate_->stack_guard()->CheckDebugBreak()) {
2159 Deoptimizer::DeoptimizeFunction(JSFunction::cast(fun)); 2161 Deoptimizer::DeoptimizeFunction(JSFunction::cast(fun));
2160 } 2162 }
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
2448 isolate_->Throw(*isolate_->factory()->NewEvalError( 2450 isolate_->Throw(*isolate_->factory()->NewEvalError(
2449 MessageTemplate::kNoSideEffectDebugEvaluate)); 2451 MessageTemplate::kNoSideEffectDebugEvaluate));
2450 } 2452 }
2451 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); 2453 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_);
2452 isolate_->debug()->UpdateHookOnFunctionCall(); 2454 isolate_->debug()->UpdateHookOnFunctionCall();
2453 isolate_->debug()->side_effect_check_failed_ = false; 2455 isolate_->debug()->side_effect_check_failed_ = false;
2454 } 2456 }
2455 2457
2456 } // namespace internal 2458 } // namespace internal
2457 } // namespace v8 2459 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698