Clean up irgen.h a bit
[hiphop-php.git] / hphp / runtime / vm / jit / code-gen-helpers-inl.h
blob216a0394994d0752c3392a606de53e25532c2e65
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2016 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #include "hphp/runtime/base/header-kind.h"
19 #include "hphp/runtime/vm/jit/vasm-gen.h"
20 #include "hphp/runtime/vm/jit/vasm-instr.h"
22 #include "hphp/util/asm-x64.h"
24 namespace HPHP { namespace jit {
26 ///////////////////////////////////////////////////////////////////////////////
28 inline void emitTestTVType(Vout& v, Vreg sf, Immed s0, Vreg s1) {
29 v << testbi{s0, s1, sf};
32 inline void emitTestTVType(Vout& v, Vreg sf, Immed s0, Vptr s1) {
33 v << testbim{s0, s1, sf};
36 inline void emitCmpTVType(Vout& v, Vreg sf, Immed s0, Vptr s1) {
37 v << cmpbim{s0, s1, sf};
40 inline void emitCmpTVType(Vout& v, Vreg sf, Immed s0, Vreg s1) {
41 v << cmpbi{s0, s1, sf};
44 ///////////////////////////////////////////////////////////////////////////////
46 template<class Destroy>
47 void emitDecRefWork(Vout& v, Vout& vcold, Vreg data,
48 Destroy destroy, bool unlikelyDestroy) {
49 auto const sf = v.makeReg();
50 v << cmplim{1, data[FAST_REFCOUNT_OFFSET], sf};
51 ifThenElse(
52 v, vcold, CC_E, sf,
53 destroy,
54 [&] (Vout& v) {
55 // If it's not static, actually reduce the reference count. This does
56 // another branch using the same status flags from the cmplim above.
57 ifThen(v, CC_NL, sf, [&] (Vout& v) { emitDecRef(v, data); });
59 unlikelyDestroy
63 ///////////////////////////////////////////////////////////////////////////////