blob: 02a0d785b4c72569d33c2a71d64a284706cab18d [file] [log] [blame]
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +00001/*
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.com8618e4b2012-07-03 01:27:16 +000027
28#if ENABLE(DFG_JIT)
29
fpizlo@apple.comb426f862014-02-10 02:51:13 +000030#include "DFGVariableEvent.h"
31
fpizlo@apple.comcd8eb2c2013-09-20 18:42:41 +000032#include "FPRInfo.h"
33#include "GPRInfo.h"
fpizlo@apple.comb426f862014-02-10 02:51:13 +000034#include "Operations.h"
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000035
36namespace JSC { namespace DFG {
37
fpizlo@apple.com2ee99362012-11-24 03:16:47 +000038void VariableEvent::dump(PrintStream& out) const
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000039{
40 switch (kind()) {
41 case Reset:
fpizlo@apple.com2ee99362012-11-24 03:16:47 +000042 out.printf("Reset");
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000043 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.com7e2c6462013-01-26 06:07:23 +000057 out.print("Death(", id(), ")");
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000058 break;
fpizlo@apple.com2f2d63a2013-03-01 19:51:31 +000059 case MovHintEvent:
fpizlo@apple.comee4d8a72013-10-01 23:28:51 +000060 out.print("MovHint(", id(), ", r", bytecodeRegister(), ")");
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000061 break;
62 case SetLocalEvent:
fpizlo@apple.comee4d8a72013-10-01 23:28:51 +000063 out.print(
64 "SetLocal(machine:r", machineRegister(), " -> bytecode:r", bytecodeRegister(),
65 ", ", dataFormatToString(dataFormat()), ")");
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000066 break;
67 default:
oliver@apple.com5598c182013-01-23 22:25:07 +000068 RELEASE_ASSERT_NOT_REACHED();
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000069 break;
70 }
71}
72
fpizlo@apple.com2ee99362012-11-24 03:16:47 +000073void VariableEvent::dumpFillInfo(const char* name, PrintStream& out) const
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000074{
fpizlo@apple.com7e2c6462013-01-26 06:07:23 +000075 out.print(name, "(", id(), ", ");
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000076 if (dataFormat() == DataFormatDouble)
fpizlo@apple.com2ee99362012-11-24 03:16:47 +000077 out.printf("%s", FPRInfo::debugName(fpr()));
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000078#if USE(JSVALUE32_64)
79 else if (dataFormat() & DataFormatJS)
fpizlo@apple.com2ee99362012-11-24 03:16:47 +000080 out.printf("%s:%s", GPRInfo::debugName(tagGPR()), GPRInfo::debugName(payloadGPR()));
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000081#endif
82 else
fpizlo@apple.com2ee99362012-11-24 03:16:47 +000083 out.printf("%s", GPRInfo::debugName(gpr()));
84 out.printf(", %s)", dataFormatToString(dataFormat()));
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000085}
86
fpizlo@apple.com2ee99362012-11-24 03:16:47 +000087void VariableEvent::dumpSpillInfo(const char* name, PrintStream& out) const
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000088{
fpizlo@apple.comee4d8a72013-10-01 23:28:51 +000089 out.print(name, "(", id(), ", r", spillRegister(), ", ", dataFormatToString(dataFormat()), ")");
fpizlo@apple.com8618e4b2012-07-03 01:27:16 +000090}
91
92} } // namespace JSC::DFG
93
94#endif // ENABLE(DFG_JIT)
95