|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * vim: set ts=8 sts=4 et sw=4 tw=99: |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef jit_x64_Lowering_x64_h |
|
8 #define jit_x64_Lowering_x64_h |
|
9 |
|
10 #include "jit/shared/Lowering-x86-shared.h" |
|
11 |
|
12 namespace js { |
|
13 namespace jit { |
|
14 |
|
15 class LIRGeneratorX64 : public LIRGeneratorX86Shared |
|
16 { |
|
17 public: |
|
18 LIRGeneratorX64(MIRGenerator *gen, MIRGraph &graph, LIRGraph &lirGraph) |
|
19 : LIRGeneratorX86Shared(gen, graph, lirGraph) |
|
20 { } |
|
21 |
|
22 protected: |
|
23 void lowerUntypedPhiInput(MPhi *phi, uint32_t inputPosition, LBlock *block, size_t lirIndex); |
|
24 bool defineUntypedPhi(MPhi *phi, size_t lirIndex); |
|
25 |
|
26 // Adds a use at operand |n| of a value-typed insturction. |
|
27 bool useBox(LInstruction *lir, size_t n, MDefinition *mir, |
|
28 LUse::Policy policy = LUse::REGISTER, bool useAtStart = false); |
|
29 bool useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Register reg1, Register); |
|
30 |
|
31 // x86 has constraints on what registers can be formatted for 1-byte |
|
32 // stores and loads; on x64 all registers are okay. |
|
33 LAllocation useByteOpRegister(MDefinition *mir); |
|
34 LAllocation useByteOpRegisterOrNonDoubleConstant(MDefinition *mir); |
|
35 |
|
36 LDefinition tempToUnbox(); |
|
37 |
|
38 bool needTempForPostBarrier() { return false; } |
|
39 |
|
40 // x64 has a scratch register, so no need for another temp for dispatch |
|
41 // ICs. |
|
42 LDefinition tempForDispatchCache(MIRType outputType = MIRType_None) { |
|
43 return LDefinition::BogusTemp(); |
|
44 } |
|
45 |
|
46 public: |
|
47 bool visitBox(MBox *box); |
|
48 bool visitUnbox(MUnbox *unbox); |
|
49 bool visitReturn(MReturn *ret); |
|
50 bool visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins); |
|
51 bool visitAsmJSUnsignedToFloat32(MAsmJSUnsignedToFloat32 *ins); |
|
52 bool visitAsmJSLoadHeap(MAsmJSLoadHeap *ins); |
|
53 bool visitAsmJSStoreHeap(MAsmJSStoreHeap *ins); |
|
54 bool visitAsmJSLoadFuncPtr(MAsmJSLoadFuncPtr *ins); |
|
55 bool visitStoreTypedArrayElementStatic(MStoreTypedArrayElementStatic *ins); |
|
56 |
|
57 static bool allowFloat32Optimizations() { |
|
58 return true; |
|
59 } |
|
60 |
|
61 static bool allowInlineForkJoinGetSlice() { |
|
62 return true; |
|
63 } |
|
64 }; |
|
65 |
|
66 typedef LIRGeneratorX64 LIRGeneratorSpecific; |
|
67 |
|
68 } // namespace jit |
|
69 } // namespace js |
|
70 |
|
71 #endif /* jit_x64_Lowering_x64_h */ |