2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
26 #ifndef FTLStackMaps_h
27 #define FTLStackMaps_h
32 #include "FTLDWARFRegister.h"
34 #include "RegisterSet.h"
35 #include <wtf/HashMap.h>
53 void parse(ParseContext
&);
54 void dump(PrintStream
& out
) const;
58 uint64_t functionOffset
;
61 void parse(ParseContext
&);
62 void dump(PrintStream
&) const;
75 DWARFRegister dwarfReg
;
80 void parse(ParseContext
&);
81 void dump(PrintStream
& out
) const;
83 GPRReg
directGPR() const;
84 void restoreInto(MacroAssembler
&, StackMaps
&, char* savedRegisters
, GPRReg result
) const;
87 // FIXME: Investigate how much memory this takes and possibly prune it from the
88 // format we keep around in FTL::JITCode. I suspect that it would be most awesome to
89 // have a CompactStackMaps struct that lossily stores only that subset of StackMaps
90 // and Record that we actually need for OSR exit.
91 // https://bugs.webkit.org/show_bug.cgi?id=130802
93 DWARFRegister dwarfReg
;
96 void parse(ParseContext
&);
97 void dump(PrintStream
& out
) const;
101 uint32_t patchpointID
;
102 uint32_t instructionOffset
;
105 Vector
<Location
> locations
;
106 Vector
<LiveOut
> liveOuts
;
108 bool parse(ParseContext
&);
109 void dump(PrintStream
&) const;
111 RegisterSet
liveOutsSet() const;
112 RegisterSet
locationSet() const;
113 RegisterSet
usedRegisterSet() const;
117 Vector
<StackSize
> stackSizes
;
118 Vector
<Constant
> constants
;
119 Vector
<Record
> records
;
121 bool parse(DataView
*); // Returns true on parse success, false on failure. Failure means that LLVM is signaling compile failure to us.
122 void dump(PrintStream
&) const;
123 void dumpMultiline(PrintStream
&, const char* prefix
) const;
125 typedef HashMap
<uint32_t, Vector
<Record
>, WTF::IntHash
<uint32_t>, WTF::UnsignedWithZeroKeyHashTraits
<uint32_t>> RecordMap
;
127 RecordMap
computeRecordMap() const;
129 unsigned stackSize() const;
132 } } // namespace JSC::FTL
136 void printInternal(PrintStream
&, JSC::FTL::StackMaps::Location::Kind
);
140 #endif // ENABLE(FTL_JIT)
142 #endif // FTLStackMaps_h