Line data Source code
1 : // Copyright 2017 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #include "src/wasm/wasm-api.h"
6 :
7 : #include "src/isolate-inl.h"
8 : #include "src/isolate.h"
9 :
10 : namespace v8 {
11 : namespace internal {
12 : namespace wasm {
13 :
14 53785176 : ScheduledErrorThrower::~ScheduledErrorThrower() {
15 : // There should never be both a pending and a scheduled exception.
16 : DCHECK(!isolate()->has_scheduled_exception() ||
17 : !isolate()->has_pending_exception());
18 : // Don't throw another error if there is already a scheduled error.
19 80693039 : if (isolate()->has_scheduled_exception()) {
20 1460 : Reset();
21 26891128 : } else if (isolate()->has_pending_exception()) {
22 50 : Reset();
23 50 : isolate()->OptionalRescheduleException(false);
24 26891078 : } else if (error()) {
25 33470 : isolate()->ScheduleThrow(*Reify());
26 : }
27 26892588 : }
28 :
29 : } // namespace wasm
30 : } // namespace internal
31 : } // namespace v8
|