PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - Zend - zend_operators.h (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 218 221 98.6 %
Date: 2014-09-27 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | Zend Engine                                                          |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
       6             :    +----------------------------------------------------------------------+
       7             :    | This source file is subject to version 2.00 of the Zend 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.zend.com/license/2_00.txt.                                |
      11             :    | If you did not receive a copy of the Zend license and are unable to  |
      12             :    | obtain it through the world-wide-web, please send a note to          |
      13             :    | license@zend.com so we can mail you a copy immediately.              |
      14             :    +----------------------------------------------------------------------+
      15             :    | Authors: Andi Gutmans <andi@zend.com>                                |
      16             :    |          Zeev Suraski <zeev@zend.com>                                |
      17             :    +----------------------------------------------------------------------+
      18             : */
      19             : 
      20             : /* $Id$ */
      21             : 
      22             : #ifndef ZEND_OPERATORS_H
      23             : #define ZEND_OPERATORS_H
      24             : 
      25             : #include <errno.h>
      26             : #include <math.h>
      27             : #include <assert.h>
      28             : 
      29             : #ifdef __GNUC__
      30             : #include <stddef.h>
      31             : #endif
      32             : 
      33             : #ifdef HAVE_IEEEFP_H
      34             : #include <ieeefp.h>
      35             : #endif
      36             : 
      37             : #include "zend_strtod.h"
      38             : #include "zend_multiply.h"
      39             : 
      40             : #if 0&&HAVE_BCMATH
      41             : #include "ext/bcmath/libbcmath/src/bcmath.h"
      42             : #endif
      43             : 
      44             : #define LONG_SIGN_MASK (((zend_long)1) << (8*sizeof(zend_long)-1))
      45             : 
      46             : BEGIN_EXTERN_C()
      47             : ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      48             : ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      49             : ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      50             : ZEND_API int pow_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      51             : ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      52             : ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      53             : ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      54             : ZEND_API int boolean_not_function(zval *result, zval *op1 TSRMLS_DC);
      55             : ZEND_API int bitwise_not_function(zval *result, zval *op1 TSRMLS_DC);
      56             : ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      57             : ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      58             : ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      59             : ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      60             : ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      61             : ZEND_API int concat_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      62             : 
      63             : ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      64             : ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      65             : ZEND_API int is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      66             : ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      67             : ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      68             : ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
      69             : 
      70             : ZEND_API zend_bool instanceof_function_ex(const zend_class_entry *instance_ce, const zend_class_entry *ce, zend_bool interfaces_only TSRMLS_DC);
      71             : ZEND_API zend_bool instanceof_function(const zend_class_entry *instance_ce, const zend_class_entry *ce TSRMLS_DC);
      72             : END_EXTERN_C()
      73             : 
      74             : #if ZEND_DVAL_TO_LVAL_CAST_OK
      75             : static zend_always_inline zend_long zend_dval_to_lval(double d)
      76             : {
      77             :     if (EXPECTED(zend_finite(d)) && EXPECTED(!zend_isnan(d))) {
      78             :         return (zend_long)d;
      79             :     } else {
      80             :         return 0;
      81             :     }
      82             : }
      83             : #elif SIZEOF_ZEND_LONG == 4
      84             : static zend_always_inline zend_long zend_dval_to_lval(double d)
      85             : {
      86             :         if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
      87             :                 return 0;
      88             :         } else if (d > ZEND_LONG_MAX || d < ZEND_LONG_MIN) {
      89             :                 double  two_pow_32 = pow(2., 32.),
      90             :                                 dmod;
      91             : 
      92             :                 dmod = fmod(d, two_pow_32);
      93             :                 if (dmod < 0) {
      94             :                         /* we're going to make this number positive; call ceil()
      95             :                          * to simulate rounding towards 0 of the negative number */
      96             :                         dmod = ceil(dmod) + two_pow_32;
      97             :                 }
      98             :                 return (zend_long)(zend_ulong)dmod;
      99             :         }
     100             :         return (zend_long)d;
     101             : }
     102             : #else
     103             : static zend_always_inline zend_long zend_dval_to_lval(double d)
     104             : {
     105       26590 :         if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) {
     106           4 :                 return 0;
     107             :         /* >= as (double)ZEND_LONG_MAX is outside signed range */
     108       26586 :         } else if (d >= ZEND_LONG_MAX || d < ZEND_LONG_MIN) {
     109         149 :                 double  two_pow_64 = pow(2., 64.),
     110             :                                 dmod;
     111             : 
     112         149 :                 dmod = fmod(d, two_pow_64);
     113         149 :                 if (dmod < 0) {
     114             :                         /* no need to call ceil; original double must have had no
     115             :                          * fractional part, hence dmod does not have one either */
     116           7 :                         dmod += two_pow_64;
     117             :                 }
     118         149 :                 return (zend_long)(zend_ulong)dmod;
     119             :         }
     120       26437 :         return (zend_long)d;
     121             : }
     122             : #endif
     123             : /* }}} */
     124             : 
     125             : #define ZEND_IS_DIGIT(c) ((c) >= '0' && (c) <= '9')
     126             : #define ZEND_IS_XDIGIT(c) (((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))
     127             : 
     128             : /**
     129             :  * Checks whether the string "str" with length "length" is numeric. The value
     130             :  * of allow_errors determines whether it's required to be entirely numeric, or
     131             :  * just its prefix. Leading whitespace is allowed.
     132             :  *
     133             :  * The function returns 0 if the string did not contain a valid number; IS_LONG
     134             :  * if it contained a number that fits within the range of a long; or IS_DOUBLE
     135             :  * if the number was out of long range or contained a decimal point/exponent.
     136             :  * The number's value is returned into the respective pointer, *lval or *dval,
     137             :  * if that pointer is not NULL.
     138             :  *
     139             :  * This variant also gives information if a string that represents an integer
     140             :  * could not be represented as such due to overflow. It writes 1 to oflow_info
     141             :  * if the integer is larger than ZEND_LONG_MAX and -1 if it's smaller than ZEND_LONG_MIN.
     142             :  */
     143             : ZEND_API zend_uchar _is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info);
     144             : 
     145             : static zend_always_inline zend_uchar is_numeric_string_ex(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors, int *oflow_info)
     146             : {
     147     1097004 :         if (*str > '9') {
     148      134644 :                 return 0;
     149             :         }
     150      962360 :         return _is_numeric_string_ex(str, length, lval, dval, allow_errors, oflow_info);
     151             : }
     152             : 
     153             : static zend_always_inline zend_uchar is_numeric_string(const char *str, size_t length, zend_long *lval, double *dval, int allow_errors) {
     154      157197 :     return is_numeric_string_ex(str, length, lval, dval, allow_errors, NULL);
     155             : }
     156             : 
     157             : ZEND_API zend_uchar is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval);
     158             : 
     159             : static zend_always_inline const char *
     160             : zend_memnstr(const char *haystack, const char *needle, size_t needle_len, char *end)
     161             : {
     162     2641184 :         const char *p = haystack;
     163     2641184 :         const char ne = needle[needle_len-1];
     164             :         ptrdiff_t off_p;
     165             :         size_t off_s;
     166             : 
     167     2641184 :         if (needle_len == 1) {
     168     1844432 :                 return (char *)memchr(p, *needle, (end-p));
     169             :         }
     170             : 
     171      796752 :         off_p = end - haystack;
     172      796752 :         off_s = (off_p > 0) ? (size_t)off_p : 0;
     173      796752 :         if (needle_len > off_s) {
     174        6407 :                 return NULL;
     175             :         }
     176             : 
     177      790345 :         end -= needle_len;
     178             : 
     179     4064570 :         while (p <= end) {
     180     3989076 :                 if ((p = (char *)memchr(p, *needle, (end-p+1))) && ne == p[needle_len-1]) {
     181      514203 :                         if (!memcmp(needle, p, needle_len-1)) {
     182      179325 :                                 return p;
     183             :                         }
     184             :                 }
     185             : 
     186     3809751 :                 if (p == NULL) {
     187      535526 :                         return NULL;
     188             :                 }
     189             : 
     190     3274225 :                 p++;
     191             :         }
     192             : 
     193       75494 :         return NULL;
     194             : }
     195             : 
     196             : static zend_always_inline const void *zend_memrchr(const void *s, int c, size_t n)
     197             : {
     198             :         register const unsigned char *e;
     199             : 
     200     3223377 :         if (n <= 0) {
     201         428 :                 return NULL;
     202             :         }
     203             : 
     204    47057349 :         for (e = (const unsigned char *)s + n - 1; e >= (const unsigned char *)s; e--) {
     205    43871320 :                 if (*e == (const unsigned char)c) {
     206       36920 :                         return (const void *)e;
     207             :                 }
     208             :         }
     209             : 
     210     3186029 :         return NULL;
     211             : }
     212             : 
     213             : BEGIN_EXTERN_C()
     214             : ZEND_API int increment_function(zval *op1);
     215             : ZEND_API int decrement_function(zval *op2);
     216             : 
     217             : ZEND_API void convert_scalar_to_number(zval *op TSRMLS_DC);
     218             : ZEND_API void _convert_to_cstring(zval *op ZEND_FILE_LINE_DC);
     219             : ZEND_API void _convert_to_string(zval *op ZEND_FILE_LINE_DC);
     220             : ZEND_API void convert_to_long(zval *op);
     221             : ZEND_API void convert_to_double(zval *op);
     222             : ZEND_API void convert_to_long_base(zval *op, int base);
     223             : ZEND_API void convert_to_null(zval *op);
     224             : ZEND_API void convert_to_boolean(zval *op);
     225             : ZEND_API void convert_to_array(zval *op);
     226             : ZEND_API void convert_to_object(zval *op);
     227             : ZEND_API void multi_convert_to_long_ex(int argc, ...);
     228             : ZEND_API void multi_convert_to_double_ex(int argc, ...);
     229             : ZEND_API void multi_convert_to_string_ex(int argc, ...);
     230             : 
     231             : ZEND_API zend_long _zval_get_long_func(zval *op TSRMLS_DC);
     232             : ZEND_API double _zval_get_double_func(zval *op TSRMLS_DC);
     233             : ZEND_API zend_string *_zval_get_string_func(zval *op TSRMLS_DC);
     234             : 
     235             : static zend_always_inline zend_long _zval_get_long(zval *op TSRMLS_DC) {
     236      283333 :         return Z_TYPE_P(op) == IS_LONG ? Z_LVAL_P(op) : _zval_get_long_func(op TSRMLS_CC);
     237             : }
     238             : static zend_always_inline double _zval_get_double(zval *op TSRMLS_DC) {
     239      206052 :         return Z_TYPE_P(op) == IS_DOUBLE ? Z_DVAL_P(op) : _zval_get_double_func(op TSRMLS_CC);
     240             : }
     241             : static zend_always_inline zend_string *_zval_get_string(zval *op TSRMLS_DC) {
     242     6494224 :         return Z_TYPE_P(op) == IS_STRING ? zend_string_copy(Z_STR_P(op)) : _zval_get_string_func(op TSRMLS_CC);
     243             : }
     244             : 
     245             : #define zval_get_long(op) _zval_get_long((op) TSRMLS_CC)
     246             : #define zval_get_double(op) _zval_get_double((op) TSRMLS_CC)
     247             : #define zval_get_string(op) _zval_get_string((op) TSRMLS_CC)
     248             : 
     249             : ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2);
     250             : ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2);
     251             : #define convert_to_cstring(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_cstring((op) ZEND_FILE_LINE_CC); }
     252             : #define convert_to_string(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); }
     253             : 
     254             : ZEND_API int zval_is_true(zval *op);
     255             : ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
     256             : ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
     257             : ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive TSRMLS_DC);
     258             : ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
     259             : ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
     260             : #if HAVE_STRCOLL
     261             : ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC);
     262             : #endif
     263             : 
     264             : ZEND_API void zend_str_tolower(char *str, size_t length);
     265             : ZEND_API char *zend_str_tolower_copy(char *dest, const char *source, size_t length);
     266             : ZEND_API char *zend_str_tolower_dup(const char *source, size_t length);
     267             : 
     268             : ZEND_API int zend_binary_zval_strcmp(zval *s1, zval *s2);
     269             : ZEND_API int zend_binary_zval_strncmp(zval *s1, zval *s2, zval *s3);
     270             : ZEND_API int zend_binary_zval_strcasecmp(zval *s1, zval *s2);
     271             : ZEND_API int zend_binary_zval_strncasecmp(zval *s1, zval *s2, zval *s3);
     272             : ZEND_API int zend_binary_strcmp(const char *s1, size_t len1, const char *s2, size_t len2);
     273             : ZEND_API int zend_binary_strncmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length);
     274             : ZEND_API int zend_binary_strcasecmp(const char *s1, size_t len1, const char *s2, size_t len2);
     275             : ZEND_API int zend_binary_strncasecmp(const char *s1, size_t len1, const char *s2, size_t len2, size_t length);
     276             : ZEND_API int zend_binary_strcasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2);
     277             : ZEND_API int zend_binary_strncasecmp_l(const char *s1, size_t len1, const char *s2, size_t len2, size_t length);
     278             : 
     279             : ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
     280             : ZEND_API void zend_compare_symbol_tables(zval *result, HashTable *ht1, HashTable *ht2 TSRMLS_DC);
     281             : ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC);
     282             : ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);
     283             : 
     284             : ZEND_API int zend_atoi(const char *str, int str_len);
     285             : ZEND_API zend_long zend_atol(const char *str, int str_len);
     286             : 
     287             : ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
     288             : 
     289             : #define convert_to_ex_master(pzv, lower_type, upper_type)       \
     290             :         if (Z_TYPE_P(pzv)!=upper_type) {                                        \
     291             :                 SEPARATE_ZVAL_IF_NOT_REF(pzv);                                          \
     292             :                 convert_to_##lower_type(pzv);                                           \
     293             :         }
     294             : 
     295             : #define convert_to_explicit_type(pzv, type)             \
     296             :         do {                                                                            \
     297             :                 switch (type) {                                                 \
     298             :                         case IS_NULL:                                           \
     299             :                                 convert_to_null(pzv);                   \
     300             :                                 break;                                                  \
     301             :                         case IS_LONG:                                           \
     302             :                                 convert_to_long(pzv);                   \
     303             :                                 break;                                                  \
     304             :                         case IS_DOUBLE:                                         \
     305             :                                 convert_to_double(pzv);                 \
     306             :                                 break;                                                  \
     307             :                         case _IS_BOOL:                                          \
     308             :                                 convert_to_boolean(pzv);                \
     309             :                                 break;                                                  \
     310             :                         case IS_ARRAY:                                          \
     311             :                                 convert_to_array(pzv);                  \
     312             :                                 break;                                                  \
     313             :                         case IS_OBJECT:                                         \
     314             :                                 convert_to_object(pzv);                 \
     315             :                                 break;                                                  \
     316             :                         case IS_STRING:                                         \
     317             :                                 convert_to_string(pzv);                 \
     318             :                                 break;                                                  \
     319             :                         default:                                                        \
     320             :                                 assert(0);                                              \
     321             :                                 break;                                                  \
     322             :                 }                                                                               \
     323             :         } while (0);
     324             : 
     325             : #define convert_to_explicit_type_ex(pzv, str_type)      \
     326             :         if (Z_TYPE_P(pzv) != str_type) {                                \
     327             :                 SEPARATE_ZVAL_IF_NOT_REF(pzv);                          \
     328             :                 convert_to_explicit_type(pzv, str_type);        \
     329             :         }
     330             : 
     331             : #define convert_to_boolean_ex(pzv)      convert_to_ex_master(pzv, boolean, _IS_BOOL)
     332             : #define convert_to_long_ex(pzv)         convert_to_ex_master(pzv, long, IS_LONG)
     333             : #define convert_to_double_ex(pzv)       convert_to_ex_master(pzv, double, IS_DOUBLE)
     334             : #define convert_to_string_ex(pzv)       convert_to_ex_master(pzv, string, IS_STRING)
     335             : #define convert_to_array_ex(pzv)        convert_to_ex_master(pzv, array, IS_ARRAY)
     336             : #define convert_to_object_ex(pzv)       convert_to_ex_master(pzv, object, IS_OBJECT)
     337             : #define convert_to_null_ex(pzv)         convert_to_ex_master(pzv, null, IS_NULL)
     338             : 
     339             : #define convert_scalar_to_number_ex(pzv)                                                        \
     340             :         if (Z_TYPE_P(pzv)!=IS_LONG && Z_TYPE_P(pzv)!=IS_DOUBLE) {               \
     341             :                 SEPARATE_ZVAL_IF_NOT_REF(pzv);                                                          \
     342             :                 convert_scalar_to_number(pzv TSRMLS_CC);                                        \
     343             :         }
     344             : 
     345             : #if HAVE_SETLOCALE && defined(ZEND_WIN32) && !defined(ZTS) && defined(_MSC_VER) && (_MSC_VER >= 1400)
     346             : /* This is performance improvement of tolower() on Windows and VC2005
     347             :  * Gives 10-18% on bench.php
     348             :  */
     349             : #define ZEND_USE_TOLOWER_L 1
     350             : #endif
     351             : 
     352             : #ifdef ZEND_USE_TOLOWER_L
     353             : ZEND_API void zend_update_current_locale(void);
     354             : #else
     355             : #define zend_update_current_locale()
     356             : #endif
     357             : 
     358             : /* The offset in bytes between the value and type fields of a zval */
     359             : #define ZVAL_OFFSETOF_TYPE      \
     360             :         (offsetof(zval, u1.type_info) - offsetof(zval, value))
     361             : 
     362             : static zend_always_inline int fast_increment_function(zval *op1)
     363             : {
     364     4993747 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     365             : #if defined(__GNUC__) && defined(__i386__)
     366             :                 __asm__(
     367             :                         "incl (%0)\n\t"
     368             :                         "jno  0f\n\t"
     369             :                         "movl $0x0, (%0)\n\t"
     370             :                         "movl $0x41e00000, 0x4(%0)\n\t"
     371             :                         "movl %1, %c2(%0)\n"
     372             :                         "0:"
     373             :                         :
     374             :                         : "r"(&op1->value),
     375             :                           "n"(IS_DOUBLE),
     376             :                           "n"(ZVAL_OFFSETOF_TYPE)
     377             :                         : "cc");
     378             : #elif defined(__GNUC__) && defined(__x86_64__)
     379     4993747 :                 __asm__(
     380             :                         "incq (%0)\n\t"
     381             :                         "jno  0f\n\t"
     382             :                         "movl $0x0, (%0)\n\t"
     383             :                         "movl $0x43e00000, 0x4(%0)\n\t"
     384             :                         "movl %1, %c2(%0)\n"
     385             :                         "0:"
     386             :                         :
     387     4993747 :                         : "r"(&op1->value),
     388             :                           "n"(IS_DOUBLE),
     389             :                           "n"(ZVAL_OFFSETOF_TYPE)
     390             :                         : "cc");
     391             : #else
     392             :                 if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_LONG_MAX)) {
     393             :                         /* switch to double */
     394             :                         ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0);
     395             :                 } else {
     396             :                         Z_LVAL_P(op1)++;
     397             :                 }
     398             : #endif
     399     4993747 :                 return SUCCESS;
     400             :         }
     401           0 :         return increment_function(op1);
     402             : }
     403             : 
     404             : static zend_always_inline int fast_decrement_function(zval *op1)
     405             : {
     406      423493 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     407             : #if defined(__GNUC__) && defined(__i386__)
     408             :                 __asm__(
     409             :                         "decl (%0)\n\t"
     410             :                         "jno  0f\n\t"
     411             :                         "movl $0x00200000, (%0)\n\t"
     412             :                         "movl $0xc1e00000, 0x4(%0)\n\t"
     413             :                         "movl %1,%c2(%0)\n"
     414             :                         "0:"
     415             :                         :
     416             :                         : "r"(&op1->value),
     417             :                           "n"(IS_DOUBLE),
     418             :                           "n"(ZVAL_OFFSETOF_TYPE)
     419             :                         : "cc");
     420             : #elif defined(__GNUC__) && defined(__x86_64__)
     421      423493 :                 __asm__(
     422             :                         "decq (%0)\n\t"
     423             :                         "jno  0f\n\t"
     424             :                         "movl $0x00000000, (%0)\n\t"
     425             :                         "movl $0xc3e00000, 0x4(%0)\n\t"
     426             :                         "movl %1,%c2(%0)\n"
     427             :                         "0:"
     428             :                         :
     429      423493 :                         : "r"(&op1->value),
     430             :                           "n"(IS_DOUBLE),
     431             :                           "n"(ZVAL_OFFSETOF_TYPE)
     432             :                         : "cc");
     433             : #else
     434             :                 if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_LONG_MIN)) {
     435             :                         /* switch to double */
     436             :                         ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0);
     437             :                 } else {
     438             :                         Z_LVAL_P(op1)--;
     439             :                 }
     440             : #endif
     441      423493 :                 return SUCCESS;
     442             :         }
     443           0 :         return decrement_function(op1);
     444             : }
     445             : 
     446             : static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     447             : {
     448      741970 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     449      740239 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     450             : #if defined(__GNUC__) && defined(__i386__)
     451             :                 __asm__(
     452             :                         "movl      (%1), %%eax\n\t"
     453             :                         "addl   (%2), %%eax\n\t"
     454             :                         "jo     0f\n\t"     
     455             :                         "movl   %%eax, (%0)\n\t"
     456             :                         "movl   %3, %c5(%0)\n\t"
     457             :                         "jmp    1f\n"
     458             :                         "0:\n\t"
     459             :                         "fildl     (%1)\n\t"
     460             :                         "fildl     (%2)\n\t"
     461             :                         "faddp     %%st, %%st(1)\n\t"
     462             :                         "movl   %4, %c5(%0)\n\t"
     463             :                         "fstpl     (%0)\n"
     464             :                         "1:"
     465             :                         : 
     466             :                         : "r"(&result->value),
     467             :                           "r"(&op1->value),
     468             :                           "r"(&op2->value),
     469             :                           "n"(IS_LONG),
     470             :                           "n"(IS_DOUBLE),
     471             :                           "n"(ZVAL_OFFSETOF_TYPE)
     472             :                         : "eax","cc");
     473             : #elif defined(__GNUC__) && defined(__x86_64__)
     474      740143 :                 __asm__(
     475             :                         "movq      (%1), %%rax\n\t"
     476             :                         "addq   (%2), %%rax\n\t"
     477             :                         "jo     0f\n\t"     
     478             :                         "movq   %%rax, (%0)\n\t"
     479             :                         "movl   %3, %c5(%0)\n\t"
     480             :                         "jmp    1f\n"
     481             :                         "0:\n\t"
     482             :                         "fildq     (%1)\n\t"
     483             :                         "fildq     (%2)\n\t"
     484             :                         "faddp     %%st, %%st(1)\n\t"
     485             :                         "movl   %4, %c5(%0)\n\t"
     486             :                         "fstpl     (%0)\n"
     487             :                         "1:"
     488             :                         : 
     489      740143 :                         : "r"(&result->value),
     490      740143 :                           "r"(&op1->value),
     491      740143 :                           "r"(&op2->value),
     492             :                           "n"(IS_LONG),
     493             :                           "n"(IS_DOUBLE),
     494             :                           "n"(ZVAL_OFFSETOF_TYPE)
     495             :                         : "rax","cc");
     496             : #else
     497             :                         /*
     498             :                          * 'result' may alias with op1 or op2, so we need to
     499             :                          * ensure that 'result' is not updated until after we
     500             :                          * have read the values of op1 and op2.
     501             :                          */
     502             : 
     503             :                         if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) == (Z_LVAL_P(op2) & LONG_SIGN_MASK)
     504             :                                 && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != ((Z_LVAL_P(op1) + Z_LVAL_P(op2)) & LONG_SIGN_MASK))) {
     505             :                                 ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
     506             :                         } else {
     507             :                                 ZVAL_LONG(result, Z_LVAL_P(op1) + Z_LVAL_P(op2));
     508             :                         }
     509             : #endif
     510      740143 :                         return SUCCESS;
     511          96 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     512          78 :                         ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2));
     513          78 :                         return SUCCESS;
     514             :                 }
     515        1731 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
     516        1306 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     517         202 :                         ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2));
     518         202 :                         return SUCCESS;
     519        1104 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     520        1095 :                         ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2)));
     521        1095 :                         return SUCCESS;
     522             :                 }
     523             :         }
     524         452 :         return add_function(result, op1, op2 TSRMLS_CC);
     525             : }
     526             : 
     527             : static zend_always_inline int fast_sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     528             : {
     529      330074 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     530      217545 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     531             : #if defined(__GNUC__) && defined(__i386__)
     532             :                 __asm__(
     533             :                         "movl      (%1), %%eax\n\t"
     534             :                         "subl   (%2), %%eax\n\t"
     535             :                         "jo     0f\n\t"     
     536             :                         "movl   %%eax, (%0)\n\t"
     537             :                         "movl   %3, %c5(%0)\n\t"
     538             :                         "jmp    1f\n"
     539             :                         "0:\n\t"
     540             :                         "fildl     (%2)\n\t"
     541             :                         "fildl     (%1)\n\t"
     542             : #if defined(__clang__) && (__clang_major__ < 2 || (__clang_major__ == 2 && __clang_minor__ < 10))
     543             :                         "fsubp  %%st(1), %%st\n\t"  /* LLVM bug #9164 */
     544             : #else
     545             :                         "fsubp     %%st, %%st(1)\n\t"
     546             : #endif
     547             :                         "movl   %4, %c5(%0)\n\t"
     548             :                         "fstpl     (%0)\n"
     549             :                         "1:"
     550             :                         : 
     551             :                         : "r"(&result->value),
     552             :                           "r"(&op1->value),
     553             :                           "r"(&op2->value),
     554             :                           "n"(IS_LONG),
     555             :                           "n"(IS_DOUBLE),
     556             :                           "n"(ZVAL_OFFSETOF_TYPE)
     557             :                         : "eax","cc");
     558             : #elif defined(__GNUC__) && defined(__x86_64__)
     559      217466 :                 __asm__(
     560             :                         "movq      (%1), %%rax\n\t"
     561             :                         "subq   (%2), %%rax\n\t"
     562             :                         "jo     0f\n\t"     
     563             :                         "movq   %%rax, (%0)\n\t"
     564             :                         "movl   %3, %c5(%0)\n\t"
     565             :                         "jmp    1f\n"
     566             :                         "0:\n\t"
     567             :                         "fildq     (%2)\n\t"
     568             :                         "fildq     (%1)\n\t"
     569             : #if defined(__clang__) && (__clang_major__ < 2 || (__clang_major__ == 2 && __clang_minor__ < 10))
     570             :                         "fsubp  %%st(1), %%st\n\t"  /* LLVM bug #9164 */
     571             : #else
     572             :                         "fsubp     %%st, %%st(1)\n\t"
     573             : #endif
     574             :                         "movl   %4, %c5(%0)\n\t"
     575             :                         "fstpl     (%0)\n"
     576             :                         "1:"
     577             :                         : 
     578      217466 :                         : "r"(&result->value),
     579      217466 :                           "r"(&op1->value),
     580      217466 :                           "r"(&op2->value),
     581             :                           "n"(IS_LONG),
     582             :                           "n"(IS_DOUBLE),
     583             :                           "n"(ZVAL_OFFSETOF_TYPE)
     584             :                         : "rax","cc");
     585             : #else
     586             :                         ZVAL_LONG(result, Z_LVAL_P(op1) - Z_LVAL_P(op2));
     587             : 
     588             :                         if (UNEXPECTED((Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(op2) & LONG_SIGN_MASK)
     589             :                                 && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != (Z_LVAL_P(result) & LONG_SIGN_MASK))) {
     590             :                                 ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
     591             :                         }
     592             : #endif
     593      217466 :                         return SUCCESS;
     594          79 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     595          62 :                         ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2));
     596          62 :                         return SUCCESS;
     597             :                 }
     598      112529 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
     599      112309 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     600      112290 :                         ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2));
     601      112290 :                         return SUCCESS;
     602          19 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     603          19 :                         ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2)));
     604          19 :                         return SUCCESS;
     605             :                 }
     606             :         }
     607         237 :         return sub_function(result, op1, op2 TSRMLS_CC);
     608             : }
     609             : 
     610             : static zend_always_inline int fast_mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     611             : {
     612      444872 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     613      444406 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     614             :                         zend_long overflow;
     615             : 
     616      443789 :                         ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1), Z_LVAL_P(op2), Z_LVAL_P(result), Z_DVAL_P(result), overflow);
     617      443789 :                         Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG;
     618      443789 :                         return SUCCESS;
     619         617 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     620         614 :                         ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2));
     621         614 :                         return SUCCESS;
     622             :                 }
     623         466 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
     624         239 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     625         170 :                         ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2));
     626         170 :                         return SUCCESS;
     627          69 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     628          69 :                         ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2)));
     629          69 :                         return SUCCESS;
     630             :                 }
     631             :         }
     632         230 :         return mul_function(result, op1, op2 TSRMLS_CC);
     633             : }
     634             : 
     635             : static zend_always_inline int fast_div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     636             : {
     637             : #if 0
     638             :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG) && 0) {
     639             :                 if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     640             :                         if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
     641             :                                 zend_error(E_WARNING, "Division by zero");
     642             :                                 ZVAL_BOOL(result, 0);
     643             :                                 return FAILURE;
     644             :                         } else if (UNEXPECTED(Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) == ZEND_LONG_MIN)) {
     645             :                                 /* Prevent overflow error/crash */
     646             :                                 ZVAL_DOUBLE(result, (double) ZEND_LONG_MIN / -1);
     647             :                         } else if (EXPECTED(Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0)) {
     648             :                                 /* integer */
     649             :                                 ZVAL_LONG(result, Z_LVAL_P(op1) / Z_LVAL_P(op2));
     650             :                         } else {
     651             :                                 ZVAL_DOUBLE(result, ((double) Z_LVAL_P(op1)) / ((double)Z_LVAL_P(op2)));
     652             :                         }
     653             :                         return SUCCESS;
     654             :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     655             :                         if (UNEXPECTED(Z_DVAL_P(op2) == 0)) {
     656             :                                 zend_error(E_WARNING, "Division by zero");
     657             :                                 ZVAL_BOOL(result, 0);
     658             :                                 return FAILURE;
     659             :                         }
     660             :                         ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) / Z_DVAL_P(op2));
     661             :                         return SUCCESS;
     662             :                 }
     663             :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE) && 0) {
     664             :                 if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     665             :                         if (UNEXPECTED(Z_DVAL_P(op2) == 0)) {
     666             :                                 zend_error(E_WARNING, "Division by zero");
     667             :                                 ZVAL_BOOL(result, 0);
     668             :                                 return FAILURE;
     669             :                         }
     670             :                         ZVAL_DOUBLE(result, Z_DVAL_P(op1) / Z_DVAL_P(op2));
     671             :                         return SUCCESS;
     672             :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     673             :                         if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
     674             :                                 zend_error(E_WARNING, "Division by zero");
     675             :                                 ZVAL_BOOL(result, 0);
     676             :                                 return FAILURE;
     677             :                         }
     678             :                         ZVAL_DOUBLE(result, Z_DVAL_P(op1) / ((double)Z_LVAL_P(op2)));
     679             :                         return SUCCESS;
     680             :                 }
     681             :         }
     682             : #endif
     683      145904 :         return div_function(result, op1, op2 TSRMLS_CC);
     684             : }
     685             : 
     686             : static zend_always_inline int fast_mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     687             : {
     688       68564 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     689       68243 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     690       68224 :                         if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
     691          13 :                                 zend_error(E_WARNING, "Division by zero");
     692          13 :                                 ZVAL_BOOL(result, 0);
     693          13 :                                 return FAILURE;
     694       68211 :                         } else if (UNEXPECTED(Z_LVAL_P(op2) == -1)) {
     695             :                                 /* Prevent overflow error/crash if op1==ZEND_LONG_MIN */
     696          13 :                                 ZVAL_LONG(result, 0);
     697          13 :                                 return SUCCESS;
     698             :                         }
     699       68198 :                         ZVAL_LONG(result, Z_LVAL_P(op1) % Z_LVAL_P(op2));
     700       68198 :                         return SUCCESS;
     701             :                 }
     702             :         }
     703         340 :         return mod_function(result, op1, op2 TSRMLS_CC);
     704             : }
     705             : 
     706             : static zend_always_inline int fast_equal_check_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     707             : {
     708      504966 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     709        8066 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     710        7865 :                         return Z_LVAL_P(op1) == Z_LVAL_P(op2);
     711         201 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     712           8 :                         return ((double)Z_LVAL_P(op1)) == Z_DVAL_P(op2);
     713             :                 }
     714      496900 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
     715         316 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     716          16 :                         return Z_DVAL_P(op1) == Z_DVAL_P(op2);
     717         300 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     718         128 :                         return Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2));
     719             :                 }
     720      496584 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
     721      482773 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
     722      482122 :                         if (Z_STR_P(op1) == Z_STR_P(op2)) {
     723          46 :                                 return 1;
     724      482076 :                         } else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') {
     725      478256 :                                 if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) {
     726      435307 :                                         return 0;
     727             :                                 } else {
     728       42949 :                                         return memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0;
     729             :                                 }
     730             :                         } else {
     731        3820 :                                 zendi_smart_strcmp(result, op1, op2);
     732        3820 :                                 return Z_LVAL_P(result) == 0;
     733             :                         }
     734             :                 }
     735             :         }
     736       14827 :         compare_function(result, op1, op2 TSRMLS_CC);
     737       14827 :         return Z_LVAL_P(result) == 0;
     738             : }
     739             : 
     740             : static zend_always_inline void fast_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     741             : {
     742     2497546 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     743     1327196 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     744     1325824 :                         ZVAL_BOOL(result, Z_LVAL_P(op1) == Z_LVAL_P(op2));
     745             :                         return;
     746        1372 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     747          19 :                         ZVAL_BOOL(result, (double)Z_LVAL_P(op1) == Z_DVAL_P(op2));
     748             :                         return;
     749             :                 }
     750     1170350 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
     751          90 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     752          41 :                         ZVAL_BOOL(result, Z_DVAL_P(op1) == Z_DVAL_P(op2));
     753             :                         return;
     754          49 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     755          14 :                         ZVAL_BOOL(result, Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2)));
     756             :                         return;
     757             :                 }
     758     1170260 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
     759     1075724 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
     760     1075618 :                         if (Z_STR_P(op1) == Z_STR_P(op2)) {
     761        1081 :                                 ZVAL_TRUE(result);
     762             :                                 return;
     763     1074537 :                         } else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') {
     764      934411 :                                 if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) {
     765      425521 :                                         ZVAL_FALSE(result);
     766             :                                         return;
     767             :                                 } else {
     768      508890 :                                         ZVAL_BOOL(result, memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
     769             :                                         return;
     770             :                                 }
     771             :                         } else {
     772      140126 :                                 zendi_smart_strcmp(result, op1, op2);
     773      140126 :                                 ZVAL_BOOL(result, Z_LVAL_P(result) == 0);
     774             :                                 return;
     775             :                         }
     776             :                 }
     777             :         }
     778       96030 :         compare_function(result, op1, op2 TSRMLS_CC);
     779       96029 :         ZVAL_BOOL(result, Z_LVAL_P(result) == 0);
     780             : }
     781             : 
     782             : static zend_always_inline void fast_not_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     783             : {
     784      484263 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     785      108326 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     786      106681 :                         ZVAL_BOOL(result, Z_LVAL_P(op1) != Z_LVAL_P(op2));
     787             :                         return;
     788        1645 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     789          20 :                         ZVAL_BOOL(result, (double)Z_LVAL_P(op1) != Z_DVAL_P(op2));
     790             :                         return;
     791             :                 }
     792      375937 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
     793         110 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     794          13 :                         ZVAL_BOOL(result, Z_DVAL_P(op1) != Z_DVAL_P(op2));
     795             :                         return;
     796          97 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     797           0 :                         ZVAL_BOOL(result, Z_DVAL_P(op1) != ((double)Z_LVAL_P(op2)));
     798             :                         return;
     799             :                 }
     800      375827 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
     801      182303 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
     802      178914 :                         if (Z_STR_P(op1) == Z_STR_P(op2)) {
     803         114 :                                 ZVAL_FALSE(result);
     804             :                                 return;
     805      178800 :                         } else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') {
     806       33338 :                                 if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) {
     807       13607 :                                         ZVAL_TRUE(result);
     808             :                                         return;
     809             :                                 } else {
     810       19731 :                                         ZVAL_BOOL(result, memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
     811             :                                         return;
     812             :                                 }
     813             :                         } else {
     814      145462 :                                 zendi_smart_strcmp(result, op1, op2);
     815      145462 :                                 ZVAL_BOOL(result, Z_LVAL_P(result) != 0);
     816             :                                 return;
     817             :                         }
     818             :                 }
     819             :         }
     820      198635 :         compare_function(result, op1, op2 TSRMLS_CC);
     821      198635 :         ZVAL_BOOL(result, Z_LVAL_P(result) != 0);
     822             : }
     823             : 
     824             : static zend_always_inline void fast_is_smaller_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     825             : {
     826     7505559 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     827     7104228 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     828     6860474 :                         ZVAL_BOOL(result, Z_LVAL_P(op1) < Z_LVAL_P(op2));
     829             :                         return;
     830      243754 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     831      209909 :                         ZVAL_BOOL(result, (double)Z_LVAL_P(op1) < Z_DVAL_P(op2));
     832             :                         return;
     833             :                 }
     834      401331 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
     835      112469 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     836         188 :                         ZVAL_BOOL(result, Z_DVAL_P(op1) < Z_DVAL_P(op2));
     837             :                         return;
     838      112281 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     839      112247 :                         ZVAL_BOOL(result, Z_DVAL_P(op1) < ((double)Z_LVAL_P(op2)));
     840             :                         return;
     841             :                 }
     842             :         }
     843      322741 :         compare_function(result, op1, op2 TSRMLS_CC);
     844      322741 :         ZVAL_BOOL(result, Z_LVAL_P(result) < 0);
     845             : }
     846             : 
     847             : static zend_always_inline void fast_is_smaller_or_equal_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     848             : {
     849      578448 :         if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
     850      477818 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     851      461763 :                         ZVAL_BOOL(result, Z_LVAL_P(op1) <= Z_LVAL_P(op2));
     852             :                         return;
     853       16055 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     854       15947 :                         ZVAL_BOOL(result, (double)Z_LVAL_P(op1) <= Z_DVAL_P(op2));
     855             :                         return;
     856             :                 }
     857      100630 :         } else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
     858          86 :                 if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
     859          19 :                         ZVAL_BOOL(result, Z_DVAL_P(op1) <= Z_DVAL_P(op2));
     860             :                         return;
     861          67 :                 } else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
     862          25 :                         ZVAL_BOOL(result, Z_DVAL_P(op1) <= ((double)Z_LVAL_P(op2)));
     863             :                         return;
     864             :                 }
     865             :         }
     866      100694 :         compare_function(result, op1, op2 TSRMLS_CC);
     867      100694 :         ZVAL_BOOL(result, Z_LVAL_P(result) <= 0);
     868             : }
     869             : 
     870             : static zend_always_inline void fast_is_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     871             : {
     872     3447344 :         if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
     873     2433881 :                 ZVAL_BOOL(result, 0);
     874             :                 return;
     875             :         }
     876     1013463 :         is_identical_function(result, op1, op2 TSRMLS_CC);
     877             : }
     878             : 
     879             : static zend_always_inline void fast_is_not_identical_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
     880             : {
     881      534165 :         if (Z_TYPE_P(op1) != Z_TYPE_P(op2)) {
     882      477963 :                 ZVAL_BOOL(result, 1);
     883             :                 return;
     884             :         }
     885       56202 :         is_identical_function(result, op1, op2 TSRMLS_CC);
     886       56202 :         ZVAL_BOOL(result, Z_TYPE_P(result) != IS_TRUE);
     887             : }
     888             : 
     889             : #define ZEND_TRY_BINARY_OBJECT_OPERATION(opcode)                                                  \
     890             :         if (Z_TYPE_P(op1) == IS_OBJECT && Z_OBJ_HANDLER_P(op1, do_operation)) {                       \
     891             :                 if (SUCCESS == Z_OBJ_HANDLER_P(op1, do_operation)(opcode, result, op1, op2 TSRMLS_CC)) {  \
     892             :                         return SUCCESS;                                                                       \
     893             :                 }                                                                                         \
     894             :         } else if (Z_TYPE_P(op2) == IS_OBJECT && Z_OBJ_HANDLER_P(op2, do_operation)) {                \
     895             :                 if (SUCCESS == Z_OBJ_HANDLER_P(op2, do_operation)(opcode, result, op1, op2 TSRMLS_CC)) {  \
     896             :                         return SUCCESS;                                                                       \
     897             :                 }                                                                                         \
     898             :         }
     899             : 
     900             : #define ZEND_TRY_UNARY_OBJECT_OPERATION(opcode)                                                   \
     901             :         if (Z_TYPE_P(op1) == IS_OBJECT && Z_OBJ_HANDLER_P(op1, do_operation)                          \
     902             :          && SUCCESS == Z_OBJ_HANDLER_P(op1, do_operation)(opcode, result, op1, NULL TSRMLS_CC)        \
     903             :         ) {                                                                                           \
     904             :                 return SUCCESS;                                                                           \
     905             :         }
     906             : 
     907             : /* buf points to the END of the buffer */
     908             : static zend_always_inline char *zend_print_ulong_to_buf(char *buf, zend_ulong num) {
     909     1387641 :         *buf = '\0';
     910             :         do {
     911     2437455 :                 *--buf = (char) (num % 10) + '0';
     912     2437455 :                 num /= 10;
     913     2437455 :         } while (num > 0);
     914     1387641 :         return buf;
     915             : }
     916             : 
     917             : /* buf points to the END of the buffer */
     918             : static zend_always_inline char *zend_print_long_to_buf(char *buf, zend_long num) {
     919     1005713 :         if (num < 0) {
     920       11522 :             char *result = zend_print_ulong_to_buf(buf, ~((zend_ulong) num) + 1);
     921        5761 :             *--result = '-';
     922        5761 :                 return result;
     923             :         } else {
     924     1999904 :             return zend_print_ulong_to_buf(buf, num);
     925             :         }
     926             : }
     927             : 
     928             : ZEND_API zend_string *zend_long_to_str(zend_long num);
     929             : 
     930             : END_EXTERN_C()
     931             : 
     932             : #endif
     933             : 
     934             : /*
     935             :  * Local variables:
     936             :  * tab-width: 4
     937             :  * c-basic-offset: 4
     938             :  * indent-tabs-mode: t
     939             :  * End:
     940             :  */

Generated by: LCOV version 1.10

Generated at Sat, 27 Sep 2014 16:43:05 +0000 (2 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.