1/* Copyright JS Foundation and other contributors, http://js.foundation 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#ifndef ECMA_ALLOC_H 17#define ECMA_ALLOC_H 18 19#include "ecma-globals.h" 20 21/** \addtogroup ecma ECMA 22 * @{ 23 * 24 * \addtogroup ecmaalloc Routines for allocation/freeing memory for ECMA data types 25 * @{ 26 */ 27 28/** 29 * Allocate memory for ecma-object 30 * 31 * @return pointer to allocated memory 32 */ 33ecma_object_t *ecma_alloc_object (void); 34 35/** 36 * Dealloc memory from an ecma-object 37 */ 38void ecma_dealloc_object (ecma_object_t *object_p); 39 40/** 41 * Allocate memory for extended object 42 * 43 * @return pointer to allocated memory 44 */ 45ecma_extended_object_t *ecma_alloc_extended_object (size_t size); 46 47/** 48 * Dealloc memory of an extended object 49 */ 50void ecma_dealloc_extended_object (ecma_object_t *object_p, size_t size); 51 52/** 53 * Allocate memory for ecma-number 54 * 55 * @return pointer to allocated memory 56 */ 57ecma_number_t *ecma_alloc_number (void); 58 59/** 60 * Dealloc memory from an ecma-number 61 */ 62void ecma_dealloc_number (ecma_number_t *number_p); 63 64/** 65 * Allocate memory for ecma-string descriptor 66 * 67 * @return pointer to allocated memory 68 */ 69ecma_string_t *ecma_alloc_string (void); 70 71/** 72 * Dealloc memory from ecma-string descriptor 73 */ 74void ecma_dealloc_string (ecma_string_t *string_p); 75 76/** 77 * Allocate memory for extended ecma-string descriptor 78 * 79 * @return pointer to allocated memory 80 */ 81ecma_extended_string_t *ecma_alloc_extended_string (void); 82 83/** 84 * Dealloc memory from extended ecma-string descriptor 85 */ 86void ecma_dealloc_extended_string (ecma_extended_string_t *string_p); 87 88/** 89 * Allocate memory for string with character data 90 * 91 * @return pointer to allocated memory 92 */ 93ecma_string_t *ecma_alloc_string_buffer (size_t size); 94 95/** 96 * Dealloc memory of a string with character data 97 */ 98void ecma_dealloc_string_buffer (ecma_string_t *string_p, size_t size); 99 100/** 101 * Allocate memory for ecma-property pair 102 * 103 * @return pointer to allocated memory 104 */ 105ecma_property_pair_t *ecma_alloc_property_pair (void); 106 107/** 108 * Dealloc memory from an ecma-property pair 109 */ 110void ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p); 111 112/** 113 * @} 114 * @} 115 */ 116 117#endif /* !ECMA_ALLOC_H */ 118