1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/shared/MoveEmitter-x86-shared.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 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_MoveEmitter_x86_shared_h 1.11 +#define jit_MoveEmitter_x86_shared_h 1.12 + 1.13 +#if defined(JS_CODEGEN_X86) 1.14 +# include "jit/x86/MacroAssembler-x86.h" 1.15 +#elif defined(JS_CODEGEN_X64) 1.16 +# include "jit/x64/MacroAssembler-x64.h" 1.17 +#else 1.18 +# error "Wrong architecture. Only x86 and x64 should build this file!" 1.19 +#endif 1.20 +#include "jit/MoveResolver.h" 1.21 + 1.22 +namespace js { 1.23 +namespace jit { 1.24 + 1.25 +class CodeGenerator; 1.26 + 1.27 +class MoveEmitterX86 1.28 +{ 1.29 + bool inCycle_; 1.30 + MacroAssemblerSpecific &masm; 1.31 + 1.32 + // Original stack push value. 1.33 + uint32_t pushedAtStart_; 1.34 + 1.35 + // This is a store stack offset for the cycle-break spill slot, snapshotting 1.36 + // codegen->framePushed_ at the time it is allocated. -1 if not allocated. 1.37 + int32_t pushedAtCycle_; 1.38 + 1.39 + void assertDone(); 1.40 + Address cycleSlot(); 1.41 + Address toAddress(const MoveOperand &operand) const; 1.42 + Operand toOperand(const MoveOperand &operand) const; 1.43 + Operand toPopOperand(const MoveOperand &operand) const; 1.44 + 1.45 + size_t characterizeCycle(const MoveResolver &moves, size_t i, 1.46 + bool *allGeneralRegs, bool *allFloatRegs); 1.47 + bool maybeEmitOptimizedCycle(const MoveResolver &moves, size_t i, 1.48 + bool allGeneralRegs, bool allFloatRegs, size_t swapCount); 1.49 + void emitInt32Move(const MoveOperand &from, const MoveOperand &to); 1.50 + void emitGeneralMove(const MoveOperand &from, const MoveOperand &to); 1.51 + void emitFloat32Move(const MoveOperand &from, const MoveOperand &to); 1.52 + void emitDoubleMove(const MoveOperand &from, const MoveOperand &to); 1.53 + void breakCycle(const MoveOperand &to, MoveOp::Type type); 1.54 + void completeCycle(const MoveOperand &to, MoveOp::Type type); 1.55 + 1.56 + public: 1.57 + MoveEmitterX86(MacroAssemblerSpecific &masm); 1.58 + ~MoveEmitterX86(); 1.59 + void emit(const MoveResolver &moves); 1.60 + void finish(); 1.61 +}; 1.62 + 1.63 +typedef MoveEmitterX86 MoveEmitter; 1.64 + 1.65 +} // ion 1.66 +} // js 1.67 + 1.68 +#endif /* jit_MoveEmitter_x86_shared_h */