fixed # 2247: Using functions instead of macros to speeding up building for JSB project.