Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=8 sts=4 et sw=4 tw=99: |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef jit_x86_Lowering_x86_h |
michael@0 | 8 | #define jit_x86_Lowering_x86_h |
michael@0 | 9 | |
michael@0 | 10 | #include "jit/shared/Lowering-x86-shared.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace js { |
michael@0 | 13 | namespace jit { |
michael@0 | 14 | |
michael@0 | 15 | class LIRGeneratorX86 : public LIRGeneratorX86Shared |
michael@0 | 16 | { |
michael@0 | 17 | public: |
michael@0 | 18 | LIRGeneratorX86(MIRGenerator *gen, MIRGraph &graph, LIRGraph &lirGraph) |
michael@0 | 19 | : LIRGeneratorX86Shared(gen, graph, lirGraph) |
michael@0 | 20 | { } |
michael@0 | 21 | |
michael@0 | 22 | protected: |
michael@0 | 23 | // Adds a box input to an instruction, setting operand |n| to the type and |
michael@0 | 24 | // |n+1| to the payload. |
michael@0 | 25 | bool useBox(LInstruction *lir, size_t n, MDefinition *mir, |
michael@0 | 26 | LUse::Policy policy = LUse::REGISTER, bool useAtStart = false); |
michael@0 | 27 | bool useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Register reg1, Register reg2); |
michael@0 | 28 | |
michael@0 | 29 | // It's a trap! On x86, the 1-byte store can only use one of |
michael@0 | 30 | // {al,bl,cl,dl,ah,bh,ch,dh}. That means if the register allocator |
michael@0 | 31 | // gives us one of {edi,esi,ebp,esp}, we're out of luck. (The formatter |
michael@0 | 32 | // will assert on us.) Ideally, we'd just ask the register allocator to |
michael@0 | 33 | // give us one of {al,bl,cl,dl}. For now, just useFixed(al). |
michael@0 | 34 | LAllocation useByteOpRegister(MDefinition *mir); |
michael@0 | 35 | LAllocation useByteOpRegisterOrNonDoubleConstant(MDefinition *mir); |
michael@0 | 36 | |
michael@0 | 37 | inline LDefinition tempToUnbox() { |
michael@0 | 38 | return LDefinition::BogusTemp(); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | bool needTempForPostBarrier() { return true; } |
michael@0 | 42 | |
michael@0 | 43 | LDefinition tempForDispatchCache(MIRType outputType = MIRType_None); |
michael@0 | 44 | |
michael@0 | 45 | void lowerUntypedPhiInput(MPhi *phi, uint32_t inputPosition, LBlock *block, size_t lirIndex); |
michael@0 | 46 | bool defineUntypedPhi(MPhi *phi, size_t lirIndex); |
michael@0 | 47 | |
michael@0 | 48 | public: |
michael@0 | 49 | bool visitBox(MBox *box); |
michael@0 | 50 | bool visitUnbox(MUnbox *unbox); |
michael@0 | 51 | bool visitReturn(MReturn *ret); |
michael@0 | 52 | bool visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins); |
michael@0 | 53 | bool visitAsmJSUnsignedToFloat32(MAsmJSUnsignedToFloat32 *ins); |
michael@0 | 54 | bool visitAsmJSLoadHeap(MAsmJSLoadHeap *ins); |
michael@0 | 55 | bool visitAsmJSStoreHeap(MAsmJSStoreHeap *ins); |
michael@0 | 56 | bool visitAsmJSLoadFuncPtr(MAsmJSLoadFuncPtr *ins); |
michael@0 | 57 | bool visitStoreTypedArrayElementStatic(MStoreTypedArrayElementStatic *ins); |
michael@0 | 58 | bool lowerPhi(MPhi *phi); |
michael@0 | 59 | |
michael@0 | 60 | static bool allowTypedElementHoleCheck() { |
michael@0 | 61 | return true; |
michael@0 | 62 | } |
michael@0 | 63 | |
michael@0 | 64 | static bool allowStaticTypedArrayAccesses() { |
michael@0 | 65 | return true; |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | static bool allowFloat32Optimizations() { |
michael@0 | 69 | return true; |
michael@0 | 70 | } |
michael@0 | 71 | |
michael@0 | 72 | static bool allowInlineForkJoinGetSlice() { |
michael@0 | 73 | return true; |
michael@0 | 74 | } |
michael@0 | 75 | }; |
michael@0 | 76 | |
michael@0 | 77 | typedef LIRGeneratorX86 LIRGeneratorSpecific; |
michael@0 | 78 | |
michael@0 | 79 | } // namespace js |
michael@0 | 80 | } // namespace jit |
michael@0 | 81 | |
michael@0 | 82 | #endif /* jit_x86_Lowering_x86_h */ |