fpizlo@apple.com | c35b8f7 | 2012-03-12 09:50:38 +0000 | [diff] [blame] | 1 | /* |
fpizlo@apple.com | 7b33e0c | 2014-04-15 20:26:16 +0000 | [diff] [blame] | 2 | * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved. |
fpizlo@apple.com | c35b8f7 | 2012-03-12 09:50:38 +0000 | [diff] [blame] | 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" |
ossy@webkit.org | beb0de4 | 2014-02-17 19:00:03 +0000 | [diff] [blame] | 27 | #include "DFGNodeFlags.h" |
fpizlo@apple.com | c35b8f7 | 2012-03-12 09:50:38 +0000 | [diff] [blame] | 28 | |
| 29 | #if ENABLE(DFG_JIT) |
| 30 | |
fpizlo@apple.com | fb7eff2 | 2014-02-11 01:45:50 +0000 | [diff] [blame] | 31 | #include "JSCInlines.h" |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 32 | #include <wtf/CommaPrinter.h> |
fpizlo@apple.com | a62d482 | 2013-10-06 04:22:43 +0000 | [diff] [blame] | 33 | #include <wtf/StringPrintStream.h> |
fpizlo@apple.com | d7897b1 | 2012-03-12 23:15:45 +0000 | [diff] [blame] | 34 | |
fpizlo@apple.com | c35b8f7 | 2012-03-12 09:50:38 +0000 | [diff] [blame] | 35 | namespace JSC { namespace DFG { |
| 36 | |
fpizlo@apple.com | a62d482 | 2013-10-06 04:22:43 +0000 | [diff] [blame] | 37 | void dumpNodeFlags(PrintStream& actualOut, NodeFlags flags) |
fpizlo@apple.com | c35b8f7 | 2012-03-12 09:50:38 +0000 | [diff] [blame] | 38 | { |
fpizlo@apple.com | a62d482 | 2013-10-06 04:22:43 +0000 | [diff] [blame] | 39 | StringPrintStream out; |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 40 | CommaPrinter comma("|"); |
fpizlo@apple.com | c35b8f7 | 2012-03-12 09:50:38 +0000 | [diff] [blame] | 41 | |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 42 | if (flags & NodeResultMask) { |
| 43 | switch (flags & NodeResultMask) { |
| 44 | case NodeResultJS: |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 45 | out.print(comma, "JS"); |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 46 | break; |
| 47 | case NodeResultNumber: |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 48 | out.print(comma, "Number"); |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 49 | break; |
fpizlo@apple.com | 7b33e0c | 2014-04-15 20:26:16 +0000 | [diff] [blame] | 50 | case NodeResultDouble: |
| 51 | out.print(comma, "Double"); |
| 52 | break; |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 53 | case NodeResultInt32: |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 54 | out.print(comma, "Int32"); |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 55 | break; |
msaboff@apple.com | 9589433 | 2014-01-29 19:18:54 +0000 | [diff] [blame] | 56 | case NodeResultInt52: |
| 57 | out.print(comma, "Int52"); |
| 58 | break; |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 59 | case NodeResultBoolean: |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 60 | out.print(comma, "Boolean"); |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 61 | break; |
| 62 | case NodeResultStorage: |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 63 | out.print(comma, "Storage"); |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 64 | break; |
| 65 | default: |
oliver@apple.com | 5598c18 | 2013-01-23 22:25:07 +0000 | [diff] [blame] | 66 | RELEASE_ASSERT_NOT_REACHED(); |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 67 | break; |
| 68 | } |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 69 | } |
| 70 | |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 71 | if (flags & NodeMustGenerate) |
| 72 | out.print(comma, "MustGen"); |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 73 | |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 74 | if (flags & NodeHasVarArgs) |
| 75 | out.print(comma, "VarArgs"); |
fpizlo@apple.com | 2e1d8f1 | 2012-03-22 23:24:40 +0000 | [diff] [blame] | 76 | |
fpizlo@apple.com | 3d51767 | 2012-06-20 17:48:23 +0000 | [diff] [blame] | 77 | if (flags & NodeResultMask) { |
fpizlo@apple.com | dc36e83 | 2013-09-11 03:24:09 +0000 | [diff] [blame] | 78 | if (!(flags & NodeBytecodeUsesAsNumber) && !(flags & NodeBytecodeNeedsNegZero)) |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 79 | out.print(comma, "PureInt"); |
fpizlo@apple.com | dc36e83 | 2013-09-11 03:24:09 +0000 | [diff] [blame] | 80 | else if (!(flags & NodeBytecodeUsesAsNumber)) |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 81 | out.print(comma, "PureInt(w/ neg zero)"); |
fpizlo@apple.com | dc36e83 | 2013-09-11 03:24:09 +0000 | [diff] [blame] | 82 | else if (!(flags & NodeBytecodeNeedsNegZero)) |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 83 | out.print(comma, "PureNum"); |
fpizlo@apple.com | dc36e83 | 2013-09-11 03:24:09 +0000 | [diff] [blame] | 84 | if (flags & NodeBytecodeUsesAsOther) |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 85 | out.print(comma, "UseAsOther"); |
fpizlo@apple.com | c35b8f7 | 2012-03-12 09:50:38 +0000 | [diff] [blame] | 86 | } |
mark.lam@apple.com | 00178fc | 2015-12-27 06:27:03 +0000 | [diff] [blame] | 87 | |
fpizlo@apple.com | acdb63e | 2016-05-10 02:01:28 +0000 | [diff] [blame] | 88 | if (flags & NodeMayHaveDoubleResult) |
| 89 | out.print(comma, "MayHaveDoubleResult"); |
| 90 | |
| 91 | if (flags & NodeMayHaveNonNumberResult) |
| 92 | out.print(comma, "MayHaveNonNumberResult"); |
| 93 | |
mark.lam@apple.com | c1a7241 | 2016-01-05 23:08:58 +0000 | [diff] [blame] | 94 | if (flags & NodeMayOverflowInt52) |
| 95 | out.print(comma, "MayOverflowInt52"); |
| 96 | |
mark.lam@apple.com | 00178fc | 2015-12-27 06:27:03 +0000 | [diff] [blame] | 97 | if (flags & NodeMayOverflowInt32InBaseline) |
| 98 | out.print(comma, "MayOverflowInt32InBaseline"); |
| 99 | |
| 100 | if (flags & NodeMayOverflowInt32InDFG) |
| 101 | out.print(comma, "MayOverflowInt32InDFG"); |
| 102 | |
fpizlo@apple.com | 96509b7 | 2014-05-26 17:43:41 +0000 | [diff] [blame] | 103 | if (flags & NodeMayNegZeroInBaseline) |
| 104 | out.print(comma, "MayNegZeroInBaseline"); |
| 105 | |
| 106 | if (flags & NodeMayNegZeroInDFG) |
| 107 | out.print(comma, "MayNegZeroInDFG"); |
fpizlo@apple.com | c35b8f7 | 2012-03-12 09:50:38 +0000 | [diff] [blame] | 108 | |
fpizlo@apple.com | dc36e83 | 2013-09-11 03:24:09 +0000 | [diff] [blame] | 109 | if (flags & NodeBytecodeUsesAsInt) |
fpizlo@apple.com | 9682043 | 2013-03-12 06:43:54 +0000 | [diff] [blame] | 110 | out.print(comma, "UseAsInt"); |
fpizlo@apple.com | 40badfc | 2014-04-21 18:43:01 +0000 | [diff] [blame] | 111 | |
| 112 | if (flags & NodeBytecodeUsesAsArrayIndex) |
| 113 | out.print(comma, "ReallyWantsInt"); |
fpizlo@apple.com | deecc64 | 2012-03-25 00:46:21 +0000 | [diff] [blame] | 114 | |
fpizlo@apple.com | 56026af | 2014-03-20 20:53:37 +0000 | [diff] [blame] | 115 | if (flags & NodeIsFlushed) |
| 116 | out.print(comma, "IsFlushed"); |
| 117 | |
fpizlo@apple.com | a62d482 | 2013-10-06 04:22:43 +0000 | [diff] [blame] | 118 | CString string = out.toCString(); |
| 119 | if (!string.length()) |
| 120 | actualOut.print("<empty>"); |
| 121 | else |
| 122 | actualOut.print(string); |
fpizlo@apple.com | c35b8f7 | 2012-03-12 09:50:38 +0000 | [diff] [blame] | 123 | } |
| 124 | |
fpizlo@apple.com | c35b8f7 | 2012-03-12 09:50:38 +0000 | [diff] [blame] | 125 | } } // namespace JSC::DFG |
| 126 | |
| 127 | #endif // ENABLE(DFG_JIT) |
| 128 | |