Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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_MoveEmitter_x86_shared_h |
michael@0 | 8 | #define jit_MoveEmitter_x86_shared_h |
michael@0 | 9 | |
michael@0 | 10 | #if defined(JS_CODEGEN_X86) |
michael@0 | 11 | # include "jit/x86/MacroAssembler-x86.h" |
michael@0 | 12 | #elif defined(JS_CODEGEN_X64) |
michael@0 | 13 | # include "jit/x64/MacroAssembler-x64.h" |
michael@0 | 14 | #else |
michael@0 | 15 | # error "Wrong architecture. Only x86 and x64 should build this file!" |
michael@0 | 16 | #endif |
michael@0 | 17 | #include "jit/MoveResolver.h" |
michael@0 | 18 | |
michael@0 | 19 | namespace js { |
michael@0 | 20 | namespace jit { |
michael@0 | 21 | |
michael@0 | 22 | class CodeGenerator; |
michael@0 | 23 | |
michael@0 | 24 | class MoveEmitterX86 |
michael@0 | 25 | { |
michael@0 | 26 | bool inCycle_; |
michael@0 | 27 | MacroAssemblerSpecific &masm; |
michael@0 | 28 | |
michael@0 | 29 | // Original stack push value. |
michael@0 | 30 | uint32_t pushedAtStart_; |
michael@0 | 31 | |
michael@0 | 32 | // This is a store stack offset for the cycle-break spill slot, snapshotting |
michael@0 | 33 | // codegen->framePushed_ at the time it is allocated. -1 if not allocated. |
michael@0 | 34 | int32_t pushedAtCycle_; |
michael@0 | 35 | |
michael@0 | 36 | void assertDone(); |
michael@0 | 37 | Address cycleSlot(); |
michael@0 | 38 | Address toAddress(const MoveOperand &operand) const; |
michael@0 | 39 | Operand toOperand(const MoveOperand &operand) const; |
michael@0 | 40 | Operand toPopOperand(const MoveOperand &operand) const; |
michael@0 | 41 | |
michael@0 | 42 | size_t characterizeCycle(const MoveResolver &moves, size_t i, |
michael@0 | 43 | bool *allGeneralRegs, bool *allFloatRegs); |
michael@0 | 44 | bool maybeEmitOptimizedCycle(const MoveResolver &moves, size_t i, |
michael@0 | 45 | bool allGeneralRegs, bool allFloatRegs, size_t swapCount); |
michael@0 | 46 | void emitInt32Move(const MoveOperand &from, const MoveOperand &to); |
michael@0 | 47 | void emitGeneralMove(const MoveOperand &from, const MoveOperand &to); |
michael@0 | 48 | void emitFloat32Move(const MoveOperand &from, const MoveOperand &to); |
michael@0 | 49 | void emitDoubleMove(const MoveOperand &from, const MoveOperand &to); |
michael@0 | 50 | void breakCycle(const MoveOperand &to, MoveOp::Type type); |
michael@0 | 51 | void completeCycle(const MoveOperand &to, MoveOp::Type type); |
michael@0 | 52 | |
michael@0 | 53 | public: |
michael@0 | 54 | MoveEmitterX86(MacroAssemblerSpecific &masm); |
michael@0 | 55 | ~MoveEmitterX86(); |
michael@0 | 56 | void emit(const MoveResolver &moves); |
michael@0 | 57 | void finish(); |
michael@0 | 58 | }; |
michael@0 | 59 | |
michael@0 | 60 | typedef MoveEmitterX86 MoveEmitter; |
michael@0 | 61 | |
michael@0 | 62 | } // ion |
michael@0 | 63 | } // js |
michael@0 | 64 | |
michael@0 | 65 | #endif /* jit_MoveEmitter_x86_shared_h */ |