Arquivos
hhvm/hphp/test/quick/inline_1.php
T
jdelong 9749e6bd54 Initial support for inlining small functions
Sets up the translator analyze pass to create a Tracelet for
the callee at every statically-known FCall.  If the callee has an
appropriate shape (in this diff, it must be a function consisting of
"return $this->foo" for a declared property), we can inline it in
HHIR.  Restructures the IR relating to frames some so we can eliminate
the stores relating to ActRec in this simple case (see the comments in
dce.cpp and hhbctranslator.cpp for details).  Includes partial support
for inlining callees with locals, but it's disabled for now because
they will keep the frame live.
2013-04-26 12:59:48 -07:00

47 linhas
617 B
PHP

<?php
//////////////////////////////////////////////////////////////////////
class Dtor { public function __destruct() { echo "dtor\n"; } }
function id($x) {
return $x;
}
function test1() {
$k = new Dtor();
id($k);
}
function test2() {
id(new Dtor());
}
function test3() {
echo id("haha");
echo "\n";
}
function printer($x, $y) {
echo $x;
echo $y;
echo "\n";
}
function test31() {
printer("asd ", id("foo"));
}
function test32() {
echo id(id("foo"));
echo "\n";
}
//////////////////////////////////////////////////////////////////////
test1();
test2();
test3();
test31();
test32();