Line | Count | Source |
1 | | |
2 | | /* |
3 | | * Copyright (C) Igor Sysoev |
4 | | * Copyright (C) NGINX, Inc. |
5 | | */ |
6 | | |
7 | | #ifndef _NJS_ARRAY_H_INCLUDED_ |
8 | | #define _NJS_ARRAY_H_INCLUDED_ |
9 | | |
10 | | |
11 | | #define NJS_ARRAY_MAX_INDEX 0xffffffff |
12 | | #define NJS_ARRAY_INVALID_INDEX NJS_ARRAY_MAX_INDEX |
13 | | |
14 | 1.33M | #define NJS_ARRAY_SPARE 8 |
15 | 9.37k | #define NJS_ARRAY_FAST_OBJECT_LENGTH (1024) |
16 | 942k | #define NJS_ARRAY_LARGE_OBJECT_LENGTH (32768) |
17 | 8.29k | #define NJS_ARRAY_FLAT_MAX_LENGTH (1048576) |
18 | | |
19 | 9.37k | #define njs_fast_object(_sz) ((_sz) <= NJS_ARRAY_FAST_OBJECT_LENGTH) |
20 | | |
21 | | |
22 | | njs_array_t *njs_array_alloc(njs_vm_t *vm, njs_bool_t flat, uint64_t length, |
23 | | uint32_t spare); |
24 | | void njs_array_destroy(njs_vm_t *vm, njs_array_t *array); |
25 | | njs_int_t njs_array_add(njs_vm_t *vm, njs_array_t *array, njs_value_t *value); |
26 | | njs_int_t njs_array_convert_to_slow_array(njs_vm_t *vm, njs_array_t *array); |
27 | | njs_int_t njs_array_length_redefine(njs_vm_t *vm, njs_value_t *value, |
28 | | uint32_t length, int writable); |
29 | | njs_int_t njs_array_length_set(njs_vm_t *vm, njs_value_t *value, |
30 | | njs_object_prop_t *prev, njs_value_t *setval); |
31 | | njs_array_t *njs_array_keys(njs_vm_t *vm, njs_value_t *array, njs_bool_t all); |
32 | | njs_array_t *njs_array_indices(njs_vm_t *vm, njs_value_t *object); |
33 | | njs_int_t njs_array_string_add(njs_vm_t *vm, njs_array_t *array, |
34 | | const u_char *start, size_t size, size_t length); |
35 | | njs_int_t njs_array_expand(njs_vm_t *vm, njs_array_t *array, uint32_t prepend, |
36 | | uint32_t append); |
37 | | njs_int_t njs_array_prototype_to_string(njs_vm_t *vm, njs_value_t *args, |
38 | | njs_uint_t nargs, njs_index_t unused, njs_value_t *retval); |
39 | | int njs_array_indices_handler_nums(const void *first, const void *second, |
40 | | void *ctx); |
41 | | |
42 | | |
43 | | njs_inline njs_value_t * |
44 | | njs_array_push(njs_vm_t *vm, njs_array_t *array) |
45 | 27.6k | { |
46 | 27.6k | njs_int_t ret; |
47 | | |
48 | 27.6k | ret = njs_array_expand(vm, array, 0, 1); |
49 | 27.6k | if (njs_slow_path(ret != NJS_OK)) { |
50 | 0 | return NULL; |
51 | 0 | } |
52 | | |
53 | 27.6k | return &array->start[array->length++]; |
54 | 27.6k | } Unexecuted instantiation: njs_arr.c:njs_array_push Unexecuted instantiation: njs_rbtree.c:njs_array_push Unexecuted instantiation: njs_mp.c:njs_array_push Unexecuted instantiation: njs_sprintf.c:njs_array_push Unexecuted instantiation: njs_value.c:njs_array_push Unexecuted instantiation: njs_atom.c:njs_array_push Unexecuted instantiation: njs_vm.c:njs_array_push Unexecuted instantiation: njs_vmcode.c:njs_array_push Unexecuted instantiation: njs_parser.c:njs_array_push Unexecuted instantiation: njs_variable.c:njs_array_push Unexecuted instantiation: njs_scope.c:njs_array_push Unexecuted instantiation: njs_generator.c:njs_array_push Unexecuted instantiation: njs_disassembler.c:njs_array_push Unexecuted instantiation: njs_module.c:njs_array_push Unexecuted instantiation: njs_extern.c:njs_array_push Unexecuted instantiation: njs_number.c:njs_array_push Unexecuted instantiation: njs_symbol.c:njs_array_push njs_string.c:njs_array_push Line | Count | Source | 45 | 27.6k | { | 46 | 27.6k | njs_int_t ret; | 47 | | | 48 | 27.6k | ret = njs_array_expand(vm, array, 0, 1); | 49 | 27.6k | if (njs_slow_path(ret != NJS_OK)) { | 50 | 0 | return NULL; | 51 | 0 | } | 52 | | | 53 | 27.6k | return &array->start[array->length++]; | 54 | 27.6k | } |
Unexecuted instantiation: njs_object.c:njs_array_push Unexecuted instantiation: njs_object_prop.c:njs_array_push Unexecuted instantiation: njs_array.c:njs_array_push Unexecuted instantiation: njs_json.c:njs_array_push Unexecuted instantiation: njs_function.c:njs_array_push njs_regexp.c:njs_array_push Line | Count | Source | 45 | 1 | { | 46 | 1 | njs_int_t ret; | 47 | | | 48 | 1 | ret = njs_array_expand(vm, array, 0, 1); | 49 | 1 | if (njs_slow_path(ret != NJS_OK)) { | 50 | 0 | return NULL; | 51 | 0 | } | 52 | | | 53 | 1 | return &array->start[array->length++]; | 54 | 1 | } |
Unexecuted instantiation: njs_date.c:njs_array_push Unexecuted instantiation: njs_error.c:njs_array_push Unexecuted instantiation: njs_array_buffer.c:njs_array_push Unexecuted instantiation: njs_typed_array.c:njs_array_push Unexecuted instantiation: njs_promise.c:njs_array_push Unexecuted instantiation: njs_iterator.c:njs_array_push Unexecuted instantiation: njs_async.c:njs_array_push Unexecuted instantiation: njs_builtin.c:njs_array_push Unexecuted instantiation: njs_regex.c:njs_array_push Unexecuted instantiation: njs_buffer.c:njs_array_push Unexecuted instantiation: njs_modules.c:njs_array_push Unexecuted instantiation: njs_dtoa.c:njs_array_push Unexecuted instantiation: njs_dtoa_fixed.c:njs_array_push Unexecuted instantiation: njs_strtod.c:njs_array_push Unexecuted instantiation: njs_djb_hash.c:njs_array_push Unexecuted instantiation: njs_utf8.c:njs_array_push Unexecuted instantiation: njs_utf16.c:njs_array_push Unexecuted instantiation: njs_flathsh.c:njs_array_push Unexecuted instantiation: njs_trace.c:njs_array_push Unexecuted instantiation: njs_malloc.c:njs_array_push Unexecuted instantiation: njs_utils.c:njs_array_push Unexecuted instantiation: njs_chb.c:njs_array_push Unexecuted instantiation: njs_lexer.c:njs_array_push Unexecuted instantiation: njs_boolean.c:njs_array_push Unexecuted instantiation: njs_math.c:njs_array_push Unexecuted instantiation: njs_encoding.c:njs_array_push Unexecuted instantiation: njs_diyfp.c:njs_array_push Unexecuted instantiation: njs_str.c:njs_array_push Unexecuted instantiation: njs_random.c:njs_array_push |
55 | | |
56 | | |
57 | | extern const njs_object_init_t njs_array_instance_init; |
58 | | extern const njs_object_type_init_t njs_array_type_init; |
59 | | |
60 | | |
61 | | #endif /* _NJS_ARRAY_H_INCLUDED_ */ |