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 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 // Find the top-most try-catch handler. | 1309 // Find the top-most try-catch handler. |
1310 StackHandler* handler = StackHandler::FromAddress( | 1310 StackHandler* handler = StackHandler::FromAddress( |
1311 Isolate::handler(isolate_->thread_local_top())); | 1311 Isolate::handler(isolate_->thread_local_top())); |
1312 do { | 1312 do { |
1313 if (handler == promise_try) { | 1313 if (handler == promise_try) { |
1314 // Mark the pushed try-catch handler to prevent a later duplicate event | 1314 // Mark the pushed try-catch handler to prevent a later duplicate event |
1315 // triggered with the following reject. | 1315 // triggered with the following reject. |
1316 return thread_local_.promise_on_stack_->promise(); | 1316 return thread_local_.promise_on_stack_->promise(); |
1317 } | 1317 } |
1318 handler = handler->next(); | 1318 handler = handler->next(); |
1319 // There must be a try-catch handler if a promise is on stack. | |
1320 DCHECK_NE(NULL, handler); | |
1321 // Throwing inside a Promise can be intercepted by an inner try-catch, so | 1319 // Throwing inside a Promise can be intercepted by an inner try-catch, so |
1322 // we stop at the first try-catch handler. | 1320 // we stop at the first try-catch handler. |
1323 } while (!handler->is_catch()); | 1321 } while (handler != NULL && !handler->is_catch()); |
1324 return undefined; | 1322 return undefined; |
1325 } | 1323 } |
1326 | 1324 |
1327 | 1325 |
1328 bool Debug::PromiseHasRejectHandler(Handle<JSObject> promise) { | 1326 bool Debug::PromiseHasRejectHandler(Handle<JSObject> promise) { |
1329 Handle<JSFunction> fun = Handle<JSFunction>::cast( | 1327 Handle<JSFunction> fun = Handle<JSFunction>::cast( |
1330 JSObject::GetDataProperty(isolate_->js_builtins_object(), | 1328 JSObject::GetDataProperty(isolate_->js_builtins_object(), |
1331 isolate_->factory()->NewStringFromStaticAscii( | 1329 isolate_->factory()->NewStringFromStaticAscii( |
1332 "PromiseHasRejectHandler"))); | 1330 "PromiseHasRejectHandler"))); |
1333 Handle<Object> result = | 1331 Handle<Object> result = |
(...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3418 logger_->DebugEvent("Put", message.text()); | 3416 logger_->DebugEvent("Put", message.text()); |
3419 } | 3417 } |
3420 | 3418 |
3421 | 3419 |
3422 void LockingCommandMessageQueue::Clear() { | 3420 void LockingCommandMessageQueue::Clear() { |
3423 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 3421 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
3424 queue_.Clear(); | 3422 queue_.Clear(); |
3425 } | 3423 } |
3426 | 3424 |
3427 } } // namespace v8::internal | 3425 } } // namespace v8::internal |
OLD | NEW |