Refactoring function call operations to return 'normal' completion values instead of 'return' completion values. Removing ECMA_FUNCTION_CALL macro.

This commit is contained in:
Ruben Ayrapetyan
2014-09-24 14:21:03 +04:00
parent 3a31bf6eb1
commit 25ec2bea17
9 changed files with 58 additions and 89 deletions
+3 -32
View File
@@ -39,42 +39,13 @@
{ \
JERRY_ASSERT(ecma_is_completion_value_normal (var))
/**
* The macro defines function call block that executes function call 'op',
* assigns call's completion value to 'var', and checks for exceptions
* that might be thrown during initialization.
*
* If no return values is not return completion value,
* then code after the function call block is executed.
* Otherwise, completion value is just copied to return_value.
*
* Note:
* Each ECMA_FUNCTION_CALL should have it's own corresponding ECMA_FINALIZE
* statement with same argument as corresponding ECMA_FUNCTION_CALL's first argument.
*/
#define ECMA_FUNCTION_CALL(var, op, return_value) \
ecma_completion_value_t var = op; \
if (unlikely (!ecma_is_completion_value_return (var))) \
{ \
return_value = ecma_copy_completion_value (var); \
} \
else \
{ \
JERRY_ASSERT(!ecma_is_completion_value_normal (var))
/**
* The define is not used. It is just for vera++ style checker that wants to find closing pair for all opening braces
*/
#define ECMA_FUNCTION_CALL_CLOSING_BRACKET_FOR_VERA_STYLE_CHECKER }
/**
* The macro marks end of code block that is defined by corresponding
* ECMA_TRY_CATCH / ECMA_FUNCTION_CALL and frees variable, initialized
* by the ECMA_TRY_CATCH / ECMA_FUNCTION_CALL.
* ECMA_TRY_CATCH and frees variable, initialized by the ECMA_TRY_CATCH.
*
* Note:
* Each ECMA_TRY_CATCH / ECMA_FUNCTION_CALL should be followed by ECMA_FINALIZE with same argument
* as corresponding ECMA_TRY_CATCH's / ECMA_FUNCTION_CALL's first argument.
* Each ECMA_TRY_CATCH should be followed by ECMA_FINALIZE with same argument
* as corresponding ECMA_TRY_CATCH's first argument.
*/
#define ECMA_FINALIZE(var) } \
ecma_free_completion_value (var)