|
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_x86_Lowering_x86_h |
|
8 #define jit_x86_Lowering_x86_h |
|
9 |
|
10 #include "jit/shared/Lowering-x86-shared.h" |
|
11 |
|
12 namespace js { |
|
13 namespace jit { |
|
14 |
|
15 class LIRGeneratorX86 : public LIRGeneratorX86Shared |
|
16 { |
|
17 public: |
|
18 LIRGeneratorX86(MIRGenerator *gen, MIRGraph &graph, LIRGraph &lirGraph) |
|
19 : LIRGeneratorX86Shared(gen, graph, lirGraph) |
|
20 { } |
|
21 |
|
22 protected: |
|
23 // Adds a box input to an instruction, setting operand |n| to the type and |
|
24 // |n+1| to the payload. |
|
25 bool useBox(LInstruction *lir, size_t n, MDefinition *mir, |
|
26 LUse::Policy policy = LUse::REGISTER, bool useAtStart = false); |
|
27 bool useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Register reg1, Register reg2); |
|
28 |
|
29 // It's a trap! On x86, the 1-byte store can only use one of |
|
30 // {al,bl,cl,dl,ah,bh,ch,dh}. That means if the register allocator |
|
31 // gives us one of {edi,esi,ebp,esp}, we're out of luck. (The formatter |
|
32 // will assert on us.) Ideally, we'd just ask the register allocator to |
|
33 // give us one of {al,bl,cl,dl}. For now, just useFixed(al). |
|
34 LAllocation useByteOpRegister(MDefinition *mir); |
|
35 LAllocation useByteOpRegisterOrNonDoubleConstant(MDefinition *mir); |
|
36 |
|
37 inline LDefinition tempToUnbox() { |
|
38 return LDefinition::BogusTemp(); |
|
39 } |
|
40 |
|
41 bool needTempForPostBarrier() { return true; } |
|
42 |
|
43 LDefinition tempForDispatchCache(MIRType outputType = MIRType_None); |
|
44 |
|
45 void lowerUntypedPhiInput(MPhi *phi, uint32_t inputPosition, LBlock *block, size_t lirIndex); |
|
46 bool defineUntypedPhi(MPhi *phi, size_t lirIndex); |
|
47 |
|
48 public: |
|
49 bool visitBox(MBox *box); |
|
50 bool visitUnbox(MUnbox *unbox); |
|
51 bool visitReturn(MReturn *ret); |
|
52 bool visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins); |
|
53 bool visitAsmJSUnsignedToFloat32(MAsmJSUnsignedToFloat32 *ins); |
|
54 bool visitAsmJSLoadHeap(MAsmJSLoadHeap *ins); |
|
55 bool visitAsmJSStoreHeap(MAsmJSStoreHeap *ins); |
|
56 bool visitAsmJSLoadFuncPtr(MAsmJSLoadFuncPtr *ins); |
|
57 bool visitStoreTypedArrayElementStatic(MStoreTypedArrayElementStatic *ins); |
|
58 bool lowerPhi(MPhi *phi); |
|
59 |
|
60 static bool allowTypedElementHoleCheck() { |
|
61 return true; |
|
62 } |
|
63 |
|
64 static bool allowStaticTypedArrayAccesses() { |
|
65 return true; |
|
66 } |
|
67 |
|
68 static bool allowFloat32Optimizations() { |
|
69 return true; |
|
70 } |
|
71 |
|
72 static bool allowInlineForkJoinGetSlice() { |
|
73 return true; |
|
74 } |
|
75 }; |
|
76 |
|
77 typedef LIRGeneratorX86 LIRGeneratorSpecific; |
|
78 |
|
79 } // namespace js |
|
80 } // namespace jit |
|
81 |
|
82 #endif /* jit_x86_Lowering_x86_h */ |