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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 | 1178 |
1179 void Debug::FloodHandlerWithOneShot() { | 1179 void Debug::FloodHandlerWithOneShot() { |
1180 // Iterate through the JavaScript stack looking for handlers. | 1180 // Iterate through the JavaScript stack looking for handlers. |
1181 StackFrame::Id id = break_frame_id(); | 1181 StackFrame::Id id = break_frame_id(); |
1182 if (id == StackFrame::NO_ID) { | 1182 if (id == StackFrame::NO_ID) { |
1183 // If there is no JavaScript stack don't do anything. | 1183 // If there is no JavaScript stack don't do anything. |
1184 return; | 1184 return; |
1185 } | 1185 } |
1186 for (JavaScriptFrameIterator it(isolate_, id); !it.done(); it.Advance()) { | 1186 for (JavaScriptFrameIterator it(isolate_, id); !it.done(); it.Advance()) { |
1187 JavaScriptFrame* frame = it.frame(); | 1187 JavaScriptFrame* frame = it.frame(); |
1188 if (frame->HasHandler()) { | 1188 int stack_slots = 0; // The computed stack slot count is not used. |
1189 // Flood the function with the catch block with break points | 1189 if (frame->LookupExceptionHandlerInTable(&stack_slots) > 0) { |
| 1190 // Flood the function with the catch/finally block with break points. |
1190 FloodWithOneShot(Handle<JSFunction>(frame->function())); | 1191 FloodWithOneShot(Handle<JSFunction>(frame->function())); |
1191 return; | 1192 return; |
1192 } | 1193 } |
1193 } | 1194 } |
1194 } | 1195 } |
1195 | 1196 |
1196 | 1197 |
1197 void Debug::ChangeBreakOnException(ExceptionBreakType type, bool enable) { | 1198 void Debug::ChangeBreakOnException(ExceptionBreakType type, bool enable) { |
1198 if (type == BreakUncaughtException) { | 1199 if (type == BreakUncaughtException) { |
1199 break_on_uncaught_exception_ = enable; | 1200 break_on_uncaught_exception_ = enable; |
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 Handle<JSObject> promise) { | 2497 Handle<JSObject> promise) { |
2497 Handle<JSFunction> fun = Handle<JSFunction>::cast( | 2498 Handle<JSFunction> fun = Handle<JSFunction>::cast( |
2498 JSObject::GetDataProperty(isolate_->js_builtins_object(), | 2499 JSObject::GetDataProperty(isolate_->js_builtins_object(), |
2499 isolate_->factory()->NewStringFromStaticChars( | 2500 isolate_->factory()->NewStringFromStaticChars( |
2500 "PromiseHasUserDefinedRejectHandler"))); | 2501 "PromiseHasUserDefinedRejectHandler"))); |
2501 return Execution::Call(isolate_, fun, promise, 0, NULL); | 2502 return Execution::Call(isolate_, fun, promise, 0, NULL); |
2502 } | 2503 } |
2503 | 2504 |
2504 | 2505 |
2505 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { | 2506 void Debug::OnException(Handle<Object> exception, Handle<Object> promise) { |
2506 bool uncaught = !isolate_->PredictWhetherExceptionIsCaught(*exception); | 2507 Isolate::CatchType catch_type = isolate_->PredictExceptionCatcher(); |
| 2508 bool uncaught = (catch_type == Isolate::NOT_CAUGHT); |
2507 if (promise->IsJSObject()) { | 2509 if (promise->IsJSObject()) { |
2508 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); | 2510 Handle<JSObject> jspromise = Handle<JSObject>::cast(promise); |
2509 // Mark the promise as already having triggered a message. | 2511 // Mark the promise as already having triggered a message. |
2510 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); | 2512 Handle<Symbol> key = isolate_->factory()->promise_debug_marker_symbol(); |
2511 JSObject::SetProperty(jspromise, key, key, STRICT).Assert(); | 2513 JSObject::SetProperty(jspromise, key, key, STRICT).Assert(); |
2512 // Check whether the promise reject is considered an uncaught exception. | 2514 // Check whether the promise reject is considered an uncaught exception. |
2513 Handle<Object> has_reject_handler; | 2515 Handle<Object> has_reject_handler; |
2514 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 2516 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
2515 isolate_, has_reject_handler, | 2517 isolate_, has_reject_handler, |
2516 PromiseHasUserDefinedRejectHandler(jspromise), /* void */); | 2518 PromiseHasUserDefinedRejectHandler(jspromise), /* void */); |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3390 logger_->DebugEvent("Put", message.text()); | 3392 logger_->DebugEvent("Put", message.text()); |
3391 } | 3393 } |
3392 | 3394 |
3393 | 3395 |
3394 void LockingCommandMessageQueue::Clear() { | 3396 void LockingCommandMessageQueue::Clear() { |
3395 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 3397 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
3396 queue_.Clear(); | 3398 queue_.Clear(); |
3397 } | 3399 } |
3398 | 3400 |
3399 } } // namespace v8::internal | 3401 } } // namespace v8::internal |
OLD | NEW |