fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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" |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 27 | |
| 28 | #if ENABLE(DFG_JIT) |
| 29 | |
fpizlo@apple.com | b426f86 | 2014-02-10 02:51:13 +0000 | [diff] [blame] | 30 | #include "DFGVariableEvent.h" |
| 31 | |
fpizlo@apple.com | cd8eb2c | 2013-09-20 18:42:41 +0000 | [diff] [blame] | 32 | #include "FPRInfo.h" |
| 33 | #include "GPRInfo.h" |
fpizlo@apple.com | b426f86 | 2014-02-10 02:51:13 +0000 | [diff] [blame] | 34 | #include "Operations.h" |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 35 | |
| 36 | namespace JSC { namespace DFG { |
| 37 | |
fpizlo@apple.com | 2ee9936 | 2012-11-24 03:16:47 +0000 | [diff] [blame] | 38 | void VariableEvent::dump(PrintStream& out) const |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 39 | { |
| 40 | switch (kind()) { |
| 41 | case Reset: |
fpizlo@apple.com | 2ee9936 | 2012-11-24 03:16:47 +0000 | [diff] [blame] | 42 | out.printf("Reset"); |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 43 | break; |
| 44 | case BirthToFill: |
| 45 | dumpFillInfo("BirthToFill", out); |
| 46 | break; |
| 47 | case BirthToSpill: |
| 48 | dumpSpillInfo("BirthToSpill", out); |
| 49 | break; |
| 50 | case Fill: |
| 51 | dumpFillInfo("Fill", out); |
| 52 | break; |
| 53 | case Spill: |
| 54 | dumpSpillInfo("Spill", out); |
| 55 | break; |
| 56 | case Death: |
fpizlo@apple.com | 7e2c646 | 2013-01-26 06:07:23 +0000 | [diff] [blame] | 57 | out.print("Death(", id(), ")"); |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 58 | break; |
fpizlo@apple.com | 2f2d63a | 2013-03-01 19:51:31 +0000 | [diff] [blame] | 59 | case MovHintEvent: |
fpizlo@apple.com | ee4d8a7 | 2013-10-01 23:28:51 +0000 | [diff] [blame] | 60 | out.print("MovHint(", id(), ", r", bytecodeRegister(), ")"); |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 61 | break; |
| 62 | case SetLocalEvent: |
fpizlo@apple.com | ee4d8a7 | 2013-10-01 23:28:51 +0000 | [diff] [blame] | 63 | out.print( |
| 64 | "SetLocal(machine:r", machineRegister(), " -> bytecode:r", bytecodeRegister(), |
| 65 | ", ", dataFormatToString(dataFormat()), ")"); |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 66 | break; |
| 67 | default: |
oliver@apple.com | 5598c18 | 2013-01-23 22:25:07 +0000 | [diff] [blame] | 68 | RELEASE_ASSERT_NOT_REACHED(); |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 69 | break; |
| 70 | } |
| 71 | } |
| 72 | |
fpizlo@apple.com | 2ee9936 | 2012-11-24 03:16:47 +0000 | [diff] [blame] | 73 | void VariableEvent::dumpFillInfo(const char* name, PrintStream& out) const |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 74 | { |
fpizlo@apple.com | 7e2c646 | 2013-01-26 06:07:23 +0000 | [diff] [blame] | 75 | out.print(name, "(", id(), ", "); |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 76 | if (dataFormat() == DataFormatDouble) |
fpizlo@apple.com | 2ee9936 | 2012-11-24 03:16:47 +0000 | [diff] [blame] | 77 | out.printf("%s", FPRInfo::debugName(fpr())); |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 78 | #if USE(JSVALUE32_64) |
| 79 | else if (dataFormat() & DataFormatJS) |
fpizlo@apple.com | 2ee9936 | 2012-11-24 03:16:47 +0000 | [diff] [blame] | 80 | out.printf("%s:%s", GPRInfo::debugName(tagGPR()), GPRInfo::debugName(payloadGPR())); |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 81 | #endif |
| 82 | else |
fpizlo@apple.com | 2ee9936 | 2012-11-24 03:16:47 +0000 | [diff] [blame] | 83 | out.printf("%s", GPRInfo::debugName(gpr())); |
| 84 | out.printf(", %s)", dataFormatToString(dataFormat())); |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 85 | } |
| 86 | |
fpizlo@apple.com | 2ee9936 | 2012-11-24 03:16:47 +0000 | [diff] [blame] | 87 | void VariableEvent::dumpSpillInfo(const char* name, PrintStream& out) const |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 88 | { |
fpizlo@apple.com | ee4d8a7 | 2013-10-01 23:28:51 +0000 | [diff] [blame] | 89 | out.print(name, "(", id(), ", r", spillRegister(), ", ", dataFormatToString(dataFormat()), ")"); |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | } } // namespace JSC::DFG |
| 93 | |
| 94 | #endif // ENABLE(DFG_JIT) |
| 95 | |