1/*
2 * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "config.h"
27#include "ExitKind.h"
28
29#include <wtf/Assertions.h>
30#include <wtf/PrintStream.h>
31
32namespace JSC {
33
34const char* exitKindToString(ExitKind kind)
35{
36 switch (kind) {
37 case ExitKindUnset:
38 return "Unset";
39 case BadType:
40 return "BadType";
41 case BadCell:
42 return "BadCell";
43 case BadIdent:
44 return "BadIdent";
45 case BadExecutable:
46 return "BadExecutable";
47 case BadCache:
48 return "BadCache";
49 case BadConstantCache:
50 return "BadConstantCache";
51 case BadIndexingType:
52 return "BadIndexingType";
53 case BadTypeInfoFlags:
54 return "BadTypeInfoFlags";
55 case Overflow:
56 return "Overflow";
57 case NegativeZero:
58 return "NegativeZero";
59 case Int52Overflow:
60 return "Int52Overflow";
61 case StoreToHole:
62 return "StoreToHole";
63 case LoadFromHole:
64 return "LoadFromHole";
65 case OutOfBounds:
66 return "OutOfBounds";
67 case InadequateCoverage:
68 return "InadequateCoverage";
69 case ArgumentsEscaped:
70 return "ArgumentsEscaped";
71 case ExoticObjectMode:
72 return "ExoticObjectMode";
73 case VarargsOverflow:
74 return "VarargsOverflow";
75 case TDZFailure:
76 return "TDZFailure";
77 case HoistingFailed:
78 return "HoistingFailed";
79 case Uncountable:
80 return "Uncountable";
81 case UncountableInvalidation:
82 return "UncountableInvalidation";
83 case WatchdogTimerFired:
84 return "WatchdogTimerFired";
85 case DebuggerEvent:
86 return "DebuggerEvent";
87 case ExceptionCheck:
88 return "ExceptionCheck";
89 case GenericUnwind:
90 return "GenericUnwind";
91 }
92 RELEASE_ASSERT_NOT_REACHED();
93 return "Unknown";
94}
95
96bool exitKindMayJettison(ExitKind kind)
97{
98 switch (kind) {
99 case ExceptionCheck:
100 case GenericUnwind:
101 return false;
102 default:
103 return true;
104 }
105}
106
107} // namespace JSC
108
109namespace WTF {
110
111void printInternal(PrintStream& out, JSC::ExitKind kind)
112{
113 out.print(exitKindToString(kind));
114}
115
116} // namespace WTF
117
118