1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/x86/Lowering-x86.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,82 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99: 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef jit_x86_Lowering_x86_h 1.11 +#define jit_x86_Lowering_x86_h 1.12 + 1.13 +#include "jit/shared/Lowering-x86-shared.h" 1.14 + 1.15 +namespace js { 1.16 +namespace jit { 1.17 + 1.18 +class LIRGeneratorX86 : public LIRGeneratorX86Shared 1.19 +{ 1.20 + public: 1.21 + LIRGeneratorX86(MIRGenerator *gen, MIRGraph &graph, LIRGraph &lirGraph) 1.22 + : LIRGeneratorX86Shared(gen, graph, lirGraph) 1.23 + { } 1.24 + 1.25 + protected: 1.26 + // Adds a box input to an instruction, setting operand |n| to the type and 1.27 + // |n+1| to the payload. 1.28 + bool useBox(LInstruction *lir, size_t n, MDefinition *mir, 1.29 + LUse::Policy policy = LUse::REGISTER, bool useAtStart = false); 1.30 + bool useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Register reg1, Register reg2); 1.31 + 1.32 + // It's a trap! On x86, the 1-byte store can only use one of 1.33 + // {al,bl,cl,dl,ah,bh,ch,dh}. That means if the register allocator 1.34 + // gives us one of {edi,esi,ebp,esp}, we're out of luck. (The formatter 1.35 + // will assert on us.) Ideally, we'd just ask the register allocator to 1.36 + // give us one of {al,bl,cl,dl}. For now, just useFixed(al). 1.37 + LAllocation useByteOpRegister(MDefinition *mir); 1.38 + LAllocation useByteOpRegisterOrNonDoubleConstant(MDefinition *mir); 1.39 + 1.40 + inline LDefinition tempToUnbox() { 1.41 + return LDefinition::BogusTemp(); 1.42 + } 1.43 + 1.44 + bool needTempForPostBarrier() { return true; } 1.45 + 1.46 + LDefinition tempForDispatchCache(MIRType outputType = MIRType_None); 1.47 + 1.48 + void lowerUntypedPhiInput(MPhi *phi, uint32_t inputPosition, LBlock *block, size_t lirIndex); 1.49 + bool defineUntypedPhi(MPhi *phi, size_t lirIndex); 1.50 + 1.51 + public: 1.52 + bool visitBox(MBox *box); 1.53 + bool visitUnbox(MUnbox *unbox); 1.54 + bool visitReturn(MReturn *ret); 1.55 + bool visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins); 1.56 + bool visitAsmJSUnsignedToFloat32(MAsmJSUnsignedToFloat32 *ins); 1.57 + bool visitAsmJSLoadHeap(MAsmJSLoadHeap *ins); 1.58 + bool visitAsmJSStoreHeap(MAsmJSStoreHeap *ins); 1.59 + bool visitAsmJSLoadFuncPtr(MAsmJSLoadFuncPtr *ins); 1.60 + bool visitStoreTypedArrayElementStatic(MStoreTypedArrayElementStatic *ins); 1.61 + bool lowerPhi(MPhi *phi); 1.62 + 1.63 + static bool allowTypedElementHoleCheck() { 1.64 + return true; 1.65 + } 1.66 + 1.67 + static bool allowStaticTypedArrayAccesses() { 1.68 + return true; 1.69 + } 1.70 + 1.71 + static bool allowFloat32Optimizations() { 1.72 + return true; 1.73 + } 1.74 + 1.75 + static bool allowInlineForkJoinGetSlice() { 1.76 + return true; 1.77 + } 1.78 +}; 1.79 + 1.80 +typedef LIRGeneratorX86 LIRGeneratorSpecific; 1.81 + 1.82 +} // namespace js 1.83 +} // namespace jit 1.84 + 1.85 +#endif /* jit_x86_Lowering_x86_h */