2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2014 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/vm/jit/annotation.h"
19 #include "hphp/runtime/vm/jit/normalized-instruction.h"
20 #include "hphp/runtime/vm/jit/translator.h"
21 #include "hphp/runtime/vm/jit/translator-inline.h"
22 #include "hphp/runtime/vm/repo.h"
23 #include "hphp/runtime/vm/repo-global-data.h"
25 namespace HPHP
{ namespace jit
{
29 //////////////////////////////////////////////////////////////////////
33 const StaticString
s_empty("");
35 const Func
* lookupDirectFunc(SrcKey
const sk
,
36 const StringData
* fname
,
37 const StringData
* clsName
,
39 if (clsName
&& !clsName
->isame(s_empty
.get())) {
40 auto const cls
= Unit::lookupClassOrUniqueClass(clsName
);
42 auto const ctx
= sk
.func()->cls();
43 return lookupImmutableMethod(cls
, fname
, magic
, staticCall
, ctx
);
45 auto const func
= Unit::lookupFunc(fname
);
46 if (func
&& func
->isNameBindingImmutable(sk
.unit())) {
54 //////////////////////////////////////////////////////////////////////
56 void annotate(NormalizedInstruction
* i
) {
60 auto const fpi
= i
->func()->findFPI(i
->source
.offset());
61 auto const pushOp
= i
->m_unit
->getOpcode(fpi
->m_fpushOff
);
62 auto const clsName
= i
->m_unit
->lookupLitstrId(i
->imm
[1].u_SA
);
63 auto const funcName
= i
->m_unit
->lookupLitstrId(i
->imm
[2].u_SA
);
64 auto const isStatic
= pushOp
== Op::FPushClsMethodD
||
65 pushOp
== Op::FPushClsMethodF
||
66 pushOp
== Op::FPushClsMethod
;
69 * Currently we don't attempt any of this for FPushClsMethod
70 * because lookupImmutableMethod is only for situations that
74 pushOp
== Op::FPushClsMethod
76 : lookupDirectFunc(i
->source
, funcName
, clsName
, isStatic
);
79 FTRACE(1, "found direct func ({}) for FCallD\n",
80 func
->fullName()->data());
90 //////////////////////////////////////////////////////////////////////