LCOV - code coverage report
Current view: top level - src - contexts.h (source / functions) Hit Total Coverage
Test: app.info Lines: 10 10 100.0 %
Date: 2017-04-26 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // Copyright 2012 the V8 project authors. All rights reserved.
       2             : // Use of this source code is governed by a BSD-style license that can be
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_CONTEXTS_H_
       6             : #define V8_CONTEXTS_H_
       7             : 
       8             : #include "src/objects.h"
       9             : 
      10             : namespace v8 {
      11             : namespace internal {
      12             : 
      13             : class RegExpMatchInfo;
      14             : 
      15             : enum ContextLookupFlags {
      16             :   FOLLOW_CONTEXT_CHAIN = 1 << 0,
      17             :   FOLLOW_PROTOTYPE_CHAIN = 1 << 1,
      18             :   STOP_AT_DECLARATION_SCOPE = 1 << 2,
      19             :   SKIP_WITH_CONTEXT = 1 << 3,
      20             : 
      21             :   DONT_FOLLOW_CHAINS = 0,
      22             :   FOLLOW_CHAINS = FOLLOW_CONTEXT_CHAIN | FOLLOW_PROTOTYPE_CHAIN,
      23             :   LEXICAL_TEST =
      24             :       FOLLOW_CONTEXT_CHAIN | STOP_AT_DECLARATION_SCOPE | SKIP_WITH_CONTEXT,
      25             : };
      26             : 
      27             : 
      28             : // Heap-allocated activation contexts.
      29             : //
      30             : // Contexts are implemented as FixedArray objects; the Context
      31             : // class is a convenience interface casted on a FixedArray object.
      32             : //
      33             : // Note: Context must have no virtual functions and Context objects
      34             : // must always be allocated via Heap::AllocateContext() or
      35             : // Factory::NewContext.
      36             : 
      37             : #define NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(V)                               \
      38             :   V(ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX, JSFunction,                          \
      39             :     async_function_await_caught)                                            \
      40             :   V(ASYNC_FUNCTION_AWAIT_UNCAUGHT_INDEX, JSFunction,                        \
      41             :     async_function_await_uncaught)                                          \
      42             :   V(ASYNC_FUNCTION_PROMISE_CREATE_INDEX, JSFunction,                        \
      43             :     async_function_promise_create)                                          \
      44             :   V(ASYNC_FUNCTION_PROMISE_RELEASE_INDEX, JSFunction,                       \
      45             :     async_function_promise_release)                                         \
      46             :   V(IS_ARRAYLIKE, JSFunction, is_arraylike)                                 \
      47             :   V(GENERATOR_NEXT_INTERNAL, JSFunction, generator_next_internal)           \
      48             :   V(GET_TEMPLATE_CALL_SITE_INDEX, JSFunction, get_template_call_site)       \
      49             :   V(MAKE_ERROR_INDEX, JSFunction, make_error)                               \
      50             :   V(MAKE_RANGE_ERROR_INDEX, JSFunction, make_range_error)                   \
      51             :   V(MAKE_SYNTAX_ERROR_INDEX, JSFunction, make_syntax_error)                 \
      52             :   V(MAKE_TYPE_ERROR_INDEX, JSFunction, make_type_error)                     \
      53             :   V(MAKE_URI_ERROR_INDEX, JSFunction, make_uri_error)                       \
      54             :   V(OBJECT_CREATE, JSFunction, object_create)                               \
      55             :   V(OBJECT_DEFINE_PROPERTIES, JSFunction, object_define_properties)         \
      56             :   V(OBJECT_DEFINE_PROPERTY, JSFunction, object_define_property)             \
      57             :   V(OBJECT_FREEZE, JSFunction, object_freeze)                               \
      58             :   V(OBJECT_GET_PROTOTYPE_OF, JSFunction, object_get_prototype_of)           \
      59             :   V(OBJECT_IS_EXTENSIBLE, JSFunction, object_is_extensible)                 \
      60             :   V(OBJECT_IS_FROZEN, JSFunction, object_is_frozen)                         \
      61             :   V(OBJECT_IS_SEALED, JSFunction, object_is_sealed)                         \
      62             :   V(OBJECT_KEYS, JSFunction, object_keys)                                   \
      63             :   V(REGEXP_INTERNAL_MATCH, JSFunction, regexp_internal_match)               \
      64             :   V(REFLECT_APPLY_INDEX, JSFunction, reflect_apply)                         \
      65             :   V(REFLECT_CONSTRUCT_INDEX, JSFunction, reflect_construct)                 \
      66             :   V(REFLECT_DEFINE_PROPERTY_INDEX, JSFunction, reflect_define_property)     \
      67             :   V(REFLECT_DELETE_PROPERTY_INDEX, JSFunction, reflect_delete_property)     \
      68             :   V(SPREAD_ARGUMENTS_INDEX, JSFunction, spread_arguments)                   \
      69             :   V(SPREAD_ITERABLE_INDEX, JSFunction, spread_iterable)                     \
      70             :   V(TYPED_ARRAY_CONSTRUCT_BY_ARRAY_BUFFER_INDEX, JSFunction,                \
      71             :     typed_array_construct_by_array_buffer)                                  \
      72             :   V(TYPED_ARRAY_CONSTRUCT_BY_ARRAY_LIKE_INDEX, JSFunction,                  \
      73             :     typed_array_construct_by_array_like)                                    \
      74             :   V(TYPED_ARRAY_CONSTRUCT_BY_LENGTH_INDEX, JSFunction,                      \
      75             :     typed_array_construct_by_length)                                        \
      76             :   V(MATH_FLOOR_INDEX, JSFunction, math_floor)                               \
      77             :   V(MATH_POW_INDEX, JSFunction, math_pow)                                   \
      78             :   V(NEW_PROMISE_CAPABILITY_INDEX, JSFunction, new_promise_capability)       \
      79             :   V(PROMISE_INTERNAL_CONSTRUCTOR_INDEX, JSFunction,                         \
      80             :     promise_internal_constructor)                                           \
      81             :   V(PROMISE_INTERNAL_REJECT_INDEX, JSFunction, promise_internal_reject)     \
      82             :   V(IS_PROMISE_INDEX, JSFunction, is_promise)                               \
      83             :   V(PROMISE_RESOLVE_INDEX, JSFunction, promise_resolve)                     \
      84             :   V(PROMISE_THEN_INDEX, JSFunction, promise_then)                           \
      85             :   V(PROMISE_HANDLE_INDEX, JSFunction, promise_handle)                       \
      86             :   V(PROMISE_HANDLE_REJECT_INDEX, JSFunction, promise_handle_reject)         \
      87             :   V(ASYNC_GENERATOR_AWAIT_CAUGHT, JSFunction, async_generator_await_caught) \
      88             :   V(ASYNC_GENERATOR_AWAIT_UNCAUGHT, JSFunction, async_generator_await_uncaught)
      89             : 
      90             : #define NATIVE_CONTEXT_IMPORTED_FIELDS(V)                                     \
      91             :   V(ARRAY_CONCAT_INDEX, JSFunction, array_concat)                             \
      92             :   V(ARRAY_POP_INDEX, JSFunction, array_pop)                                   \
      93             :   V(ARRAY_PUSH_INDEX, JSFunction, array_push)                                 \
      94             :   V(ARRAY_SHIFT_INDEX, JSFunction, array_shift)                               \
      95             :   V(ARRAY_SPLICE_INDEX, JSFunction, array_splice)                             \
      96             :   V(ARRAY_SLICE_INDEX, JSFunction, array_slice)                               \
      97             :   V(ARRAY_UNSHIFT_INDEX, JSFunction, array_unshift)                           \
      98             :   V(ARRAY_ENTRIES_ITERATOR_INDEX, JSFunction, array_entries_iterator)         \
      99             :   V(ARRAY_FOR_EACH_ITERATOR_INDEX, JSFunction, array_for_each_iterator)       \
     100             :   V(ARRAY_KEYS_ITERATOR_INDEX, JSFunction, array_keys_iterator)               \
     101             :   V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator)           \
     102             :   V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap)                     \
     103             :   V(ERROR_FUNCTION_INDEX, JSFunction, error_function)                         \
     104             :   V(ERROR_TO_STRING, JSFunction, error_to_string)                             \
     105             :   V(EVAL_ERROR_FUNCTION_INDEX, JSFunction, eval_error_function)               \
     106             :   V(GLOBAL_EVAL_FUN_INDEX, JSFunction, global_eval_fun)                       \
     107             :   V(GLOBAL_PROXY_FUNCTION_INDEX, JSFunction, global_proxy_function)           \
     108             :   V(MAP_DELETE_METHOD_INDEX, JSFunction, map_delete)                          \
     109             :   V(MAP_GET_METHOD_INDEX, JSFunction, map_get)                                \
     110             :   V(MAP_HAS_METHOD_INDEX, JSFunction, map_has)                                \
     111             :   V(MAP_SET_METHOD_INDEX, JSFunction, map_set)                                \
     112             :   V(FUNCTION_HAS_INSTANCE_INDEX, JSFunction, function_has_instance)           \
     113             :   V(OBJECT_VALUE_OF, JSFunction, object_value_of)                             \
     114             :   V(OBJECT_TO_STRING, JSFunction, object_to_string)                           \
     115             :   V(PROMISE_CATCH_INDEX, JSFunction, promise_catch)                           \
     116             :   V(PROMISE_FUNCTION_INDEX, JSFunction, promise_function)                     \
     117             :   V(RANGE_ERROR_FUNCTION_INDEX, JSFunction, range_error_function)             \
     118             :   V(REFERENCE_ERROR_FUNCTION_INDEX, JSFunction, reference_error_function)     \
     119             :   V(SET_ADD_METHOD_INDEX, JSFunction, set_add)                                \
     120             :   V(SET_DELETE_METHOD_INDEX, JSFunction, set_delete)                          \
     121             :   V(SET_HAS_METHOD_INDEX, JSFunction, set_has)                                \
     122             :   V(SYNTAX_ERROR_FUNCTION_INDEX, JSFunction, syntax_error_function)           \
     123             :   V(TYPE_ERROR_FUNCTION_INDEX, JSFunction, type_error_function)               \
     124             :   V(URI_ERROR_FUNCTION_INDEX, JSFunction, uri_error_function)                 \
     125             :   V(WASM_COMPILE_ERROR_FUNCTION_INDEX, JSFunction,                            \
     126             :     wasm_compile_error_function)                                              \
     127             :   V(WASM_LINK_ERROR_FUNCTION_INDEX, JSFunction, wasm_link_error_function)     \
     128             :   V(WASM_RUNTIME_ERROR_FUNCTION_INDEX, JSFunction, wasm_runtime_error_function)
     129             : 
     130             : #define NATIVE_CONTEXT_JS_ARRAY_ITERATOR_MAPS(V)                               \
     131             :   V(TYPED_ARRAY_KEY_ITERATOR_MAP_INDEX, Map, typed_array_key_iterator_map)     \
     132             :   V(FAST_ARRAY_KEY_ITERATOR_MAP_INDEX, Map, fast_array_key_iterator_map)       \
     133             :   V(GENERIC_ARRAY_KEY_ITERATOR_MAP_INDEX, Map, array_key_iterator_map)         \
     134             :                                                                                \
     135             :   V(UINT8_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                             \
     136             :     uint8_array_key_value_iterator_map)                                        \
     137             :   V(INT8_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                              \
     138             :     int8_array_key_value_iterator_map)                                         \
     139             :   V(UINT16_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                            \
     140             :     uint16_array_key_value_iterator_map)                                       \
     141             :   V(INT16_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                             \
     142             :     int16_array_key_value_iterator_map)                                        \
     143             :   V(UINT32_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                            \
     144             :     uint32_array_key_value_iterator_map)                                       \
     145             :   V(INT32_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                             \
     146             :     int32_array_key_value_iterator_map)                                        \
     147             :   V(FLOAT32_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                           \
     148             :     float32_array_key_value_iterator_map)                                      \
     149             :   V(FLOAT64_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                           \
     150             :     float64_array_key_value_iterator_map)                                      \
     151             :   V(UINT8_CLAMPED_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                     \
     152             :     uint8_clamped_array_key_value_iterator_map)                                \
     153             :                                                                                \
     154             :   V(FAST_SMI_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                          \
     155             :     fast_smi_array_key_value_iterator_map)                                     \
     156             :   V(FAST_HOLEY_SMI_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                    \
     157             :     fast_holey_smi_array_key_value_iterator_map)                               \
     158             :   V(FAST_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                              \
     159             :     fast_array_key_value_iterator_map)                                         \
     160             :   V(FAST_HOLEY_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                        \
     161             :     fast_holey_array_key_value_iterator_map)                                   \
     162             :   V(FAST_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                       \
     163             :     fast_double_array_key_value_iterator_map)                                  \
     164             :   V(FAST_HOLEY_DOUBLE_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                 \
     165             :     fast_holey_double_array_key_value_iterator_map)                            \
     166             :   V(GENERIC_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX, Map,                           \
     167             :     array_key_value_iterator_map)                                              \
     168             :                                                                                \
     169             :   V(UINT8_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map, uint8_array_value_iterator_map) \
     170             :   V(INT8_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map, int8_array_value_iterator_map)   \
     171             :   V(UINT16_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map,                                \
     172             :     uint16_array_value_iterator_map)                                           \
     173             :   V(INT16_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map, int16_array_value_iterator_map) \
     174             :   V(UINT32_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map,                                \
     175             :     uint32_array_value_iterator_map)                                           \
     176             :   V(INT32_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map, int32_array_value_iterator_map) \
     177             :   V(FLOAT32_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map,                               \
     178             :     float32_array_value_iterator_map)                                          \
     179             :   V(FLOAT64_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map,                               \
     180             :     float64_array_value_iterator_map)                                          \
     181             :   V(UINT8_CLAMPED_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map,                         \
     182             :     uint8_clamped_array_value_iterator_map)                                    \
     183             :                                                                                \
     184             :   V(FAST_SMI_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map,                              \
     185             :     fast_smi_array_value_iterator_map)                                         \
     186             :   V(FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map,                        \
     187             :     fast_holey_smi_array_value_iterator_map)                                   \
     188             :   V(FAST_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map, fast_array_value_iterator_map)   \
     189             :   V(FAST_HOLEY_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map,                            \
     190             :     fast_holey_array_value_iterator_map)                                       \
     191             :   V(FAST_DOUBLE_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map,                           \
     192             :     fast_double_array_value_iterator_map)                                      \
     193             :   V(FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map,                     \
     194             :     fast_holey_double_array_value_iterator_map)                                \
     195             :   V(GENERIC_ARRAY_VALUE_ITERATOR_MAP_INDEX, Map, array_value_iterator_map)
     196             : 
     197             : #define NATIVE_CONTEXT_FIELDS(V)                                               \
     198             :   V(GLOBAL_PROXY_INDEX, JSObject, global_proxy_object)                         \
     199             :   V(EMBEDDER_DATA_INDEX, FixedArray, embedder_data)                            \
     200             :   /* Below is alpha-sorted */                                                  \
     201             :   V(ACCESSOR_PROPERTY_DESCRIPTOR_MAP_INDEX, Map,                               \
     202             :     accessor_property_descriptor_map)                                          \
     203             :   V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings)    \
     204             :   V(ARRAY_BUFFER_FUN_INDEX, JSFunction, array_buffer_fun)                      \
     205             :   V(ARRAY_BUFFER_MAP_INDEX, Map, array_buffer_map)                             \
     206             :   V(ARRAY_BUFFER_NOINIT_FUN_INDEX, JSFunction, array_buffer_noinit_fun)        \
     207             :   V(ARRAY_FUNCTION_INDEX, JSFunction, array_function)                          \
     208             :   V(ASYNC_FROM_SYNC_ITERATOR_MAP_INDEX, Map, async_from_sync_iterator_map)     \
     209             :   V(ASYNC_FUNCTION_AWAIT_REJECT_SHARED_FUN, SharedFunctionInfo,                \
     210             :     async_function_await_reject_shared_fun)                                    \
     211             :   V(ASYNC_FUNCTION_AWAIT_RESOLVE_SHARED_FUN, SharedFunctionInfo,               \
     212             :     async_function_await_resolve_shared_fun)                                   \
     213             :   V(ASYNC_FUNCTION_FUNCTION_INDEX, JSFunction, async_function_constructor)     \
     214             :   V(ASYNC_GENERATOR_FUNCTION_FUNCTION_INDEX, JSFunction,                       \
     215             :     async_generator_function_function)                                         \
     216             :   V(ASYNC_ITERATOR_VALUE_UNWRAP_SHARED_FUN, SharedFunctionInfo,                \
     217             :     async_iterator_value_unwrap_shared_fun)                                    \
     218             :   V(ASYNC_GENERATOR_AWAIT_REJECT_SHARED_FUN, SharedFunctionInfo,               \
     219             :     async_generator_await_reject_shared_fun)                                   \
     220             :   V(ASYNC_GENERATOR_AWAIT_RESOLVE_SHARED_FUN, SharedFunctionInfo,              \
     221             :     async_generator_await_resolve_shared_fun)                                  \
     222             :   V(BOOLEAN_FUNCTION_INDEX, JSFunction, boolean_function)                      \
     223             :   V(BOUND_FUNCTION_WITH_CONSTRUCTOR_MAP_INDEX, Map,                            \
     224             :     bound_function_with_constructor_map)                                       \
     225             :   V(BOUND_FUNCTION_WITHOUT_CONSTRUCTOR_MAP_INDEX, Map,                         \
     226             :     bound_function_without_constructor_map)                                    \
     227             :   V(CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, JSFunction,                            \
     228             :     call_as_constructor_delegate)                                              \
     229             :   V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate)    \
     230             :   V(CALLSITE_FUNCTION_INDEX, JSFunction, callsite_function)                    \
     231             :   V(CONTEXT_EXTENSION_FUNCTION_INDEX, JSFunction, context_extension_function)  \
     232             :   V(CURRENT_MODULE_INDEX, Module, current_module)                              \
     233             :   V(DATA_PROPERTY_DESCRIPTOR_MAP_INDEX, Map, data_property_descriptor_map)     \
     234             :   V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun)                            \
     235             :   V(DATE_FUNCTION_INDEX, JSFunction, date_function)                            \
     236             :   V(DEBUG_CONTEXT_ID_INDEX, Object, debug_context_id)                          \
     237             :   V(ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX, Object,                     \
     238             :     error_message_for_code_gen_from_strings)                                   \
     239             :   V(ERRORS_THROWN_INDEX, Smi, errors_thrown)                                   \
     240             :   V(EXTRAS_EXPORTS_OBJECT_INDEX, JSObject, extras_binding_object)              \
     241             :   V(EXTRAS_UTILS_OBJECT_INDEX, Object, extras_utils_object)                    \
     242             :   V(FAST_ALIASED_ARGUMENTS_MAP_INDEX, Map, fast_aliased_arguments_map)         \
     243             :   V(FAST_TEMPLATE_INSTANTIATIONS_CACHE_INDEX, FixedArray,                      \
     244             :     fast_template_instantiations_cache)                                        \
     245             :   V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun)                    \
     246             :   V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun)                    \
     247             :   V(FUNCTION_FUNCTION_INDEX, JSFunction, function_function)                    \
     248             :   V(GENERATOR_FUNCTION_FUNCTION_INDEX, JSFunction,                             \
     249             :     generator_function_function)                                               \
     250             :   V(GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map, generator_object_prototype_map) \
     251             :   V(ASYNC_GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map,                           \
     252             :     async_generator_object_prototype_map)                                      \
     253             :   V(INITIAL_ARRAY_ITERATOR_PROTOTYPE_INDEX, JSObject,                          \
     254             :     initial_array_iterator_prototype)                                          \
     255             :   V(INITIAL_ARRAY_ITERATOR_PROTOTYPE_MAP_INDEX, Map,                           \
     256             :     initial_array_iterator_prototype_map)                                      \
     257             :   V(INITIAL_ARRAY_PROTOTYPE_INDEX, JSObject, initial_array_prototype)          \
     258             :   V(INITIAL_GENERATOR_PROTOTYPE_INDEX, JSObject, initial_generator_prototype)  \
     259             :   V(INITIAL_ASYNC_GENERATOR_PROTOTYPE_INDEX, JSObject,                         \
     260             :     initial_async_generator_prototype)                                         \
     261             :   V(INITIAL_ITERATOR_PROTOTYPE_INDEX, JSObject, initial_iterator_prototype)    \
     262             :   V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype)        \
     263             :   V(INT16_ARRAY_FUN_INDEX, JSFunction, int16_array_fun)                        \
     264             :   V(INT32_ARRAY_FUN_INDEX, JSFunction, int32_array_fun)                        \
     265             :   V(INT8_ARRAY_FUN_INDEX, JSFunction, int8_array_fun)                          \
     266             :   V(INTERNAL_ARRAY_FUNCTION_INDEX, JSFunction, internal_array_function)        \
     267             :   V(ITERATOR_RESULT_MAP_INDEX, Map, iterator_result_map)                       \
     268             :   V(INTL_DATE_TIME_FORMAT_FUNCTION_INDEX, JSFunction,                          \
     269             :     intl_date_time_format_function)                                            \
     270             :   V(INTL_NUMBER_FORMAT_FUNCTION_INDEX, JSFunction,                             \
     271             :     intl_number_format_function)                                               \
     272             :   V(INTL_COLLATOR_FUNCTION_INDEX, JSFunction, intl_collator_function)          \
     273             :   V(INTL_V8_BREAK_ITERATOR_FUNCTION_INDEX, JSFunction,                         \
     274             :     intl_v8_break_iterator_function)                                           \
     275             :   V(JS_ARRAY_FAST_SMI_ELEMENTS_MAP_INDEX, Map,                                 \
     276             :     js_array_fast_smi_elements_map_index)                                      \
     277             :   V(JS_ARRAY_FAST_HOLEY_SMI_ELEMENTS_MAP_INDEX, Map,                           \
     278             :     js_array_fast_holey_smi_elements_map_index)                                \
     279             :   V(JS_ARRAY_FAST_ELEMENTS_MAP_INDEX, Map, js_array_fast_elements_map_index)   \
     280             :   V(JS_ARRAY_FAST_HOLEY_ELEMENTS_MAP_INDEX, Map,                               \
     281             :     js_array_fast_holey_elements_map_index)                                    \
     282             :   V(JS_ARRAY_FAST_DOUBLE_ELEMENTS_MAP_INDEX, Map,                              \
     283             :     js_array_fast_double_elements_map_index)                                   \
     284             :   V(JS_ARRAY_FAST_HOLEY_DOUBLE_ELEMENTS_MAP_INDEX, Map,                        \
     285             :     js_array_fast_holey_double_elements_map_index)                             \
     286             :   V(JS_MAP_FUN_INDEX, JSFunction, js_map_fun)                                  \
     287             :   V(JS_MAP_MAP_INDEX, Map, js_map_map)                                         \
     288             :   V(JS_MODULE_NAMESPACE_MAP, Map, js_module_namespace_map)                     \
     289             :   V(JS_SET_FUN_INDEX, JSFunction, js_set_fun)                                  \
     290             :   V(JS_SET_MAP_INDEX, Map, js_set_map)                                         \
     291             :   V(JS_WEAK_MAP_FUN_INDEX, JSFunction, js_weak_map_fun)                        \
     292             :   V(JS_WEAK_SET_FUN_INDEX, JSFunction, js_weak_set_fun)                        \
     293             :   V(MAP_CACHE_INDEX, Object, map_cache)                                        \
     294             :   V(MAP_ITERATOR_MAP_INDEX, Map, map_iterator_map)                             \
     295             :   V(MATH_RANDOM_INDEX_INDEX, Smi, math_random_index)                           \
     296             :   V(MATH_RANDOM_CACHE_INDEX, Object, math_random_cache)                        \
     297             :   V(MESSAGE_LISTENERS_INDEX, TemplateList, message_listeners)                  \
     298             :   V(NATIVES_UTILS_OBJECT_INDEX, Object, natives_utils_object)                  \
     299             :   V(NORMALIZED_MAP_CACHE_INDEX, Object, normalized_map_cache)                  \
     300             :   V(NUMBER_FUNCTION_INDEX, JSFunction, number_function)                        \
     301             :   V(OBJECT_FUNCTION_INDEX, JSFunction, object_function)                        \
     302             :   V(OBJECT_FUNCTION_PROTOTYPE_MAP_INDEX, Map, object_function_prototype_map)   \
     303             :   V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function)    \
     304             :   V(OSR_CODE_TABLE_INDEX, FixedArray, osr_code_table)                          \
     305             :   V(PROXY_CALLABLE_MAP_INDEX, Map, proxy_callable_map)                         \
     306             :   V(PROXY_CONSTRUCTOR_MAP_INDEX, Map, proxy_constructor_map)                   \
     307             :   V(PROXY_FUNCTION_INDEX, JSFunction, proxy_function)                          \
     308             :   V(PROXY_FUNCTION_MAP_INDEX, Map, proxy_function_map)                         \
     309             :   V(PROXY_MAP_INDEX, Map, proxy_map)                                           \
     310             :   V(PROMISE_GET_CAPABILITIES_EXECUTOR_SHARED_FUN, SharedFunctionInfo,          \
     311             :     promise_get_capabilities_executor_shared_fun)                              \
     312             :   V(PROMISE_RESOLVE_SHARED_FUN, SharedFunctionInfo,                            \
     313             :     promise_resolve_shared_fun)                                                \
     314             :   V(PROMISE_REJECT_SHARED_FUN, SharedFunctionInfo, promise_reject_shared_fun)  \
     315             :   V(PROMISE_THEN_FINALLY_SHARED_FUN, SharedFunctionInfo,                       \
     316             :     promise_then_finally_shared_fun)                                           \
     317             :   V(PROMISE_CATCH_FINALLY_SHARED_FUN, SharedFunctionInfo,                      \
     318             :     promise_catch_finally_shared_fun)                                          \
     319             :   V(PROMISE_VALUE_THUNK_FINALLY_SHARED_FUN, SharedFunctionInfo,                \
     320             :     promise_value_thunk_finally_shared_fun)                                    \
     321             :   V(PROMISE_THROWER_FINALLY_SHARED_FUN, SharedFunctionInfo,                    \
     322             :     promise_thrower_finally_shared_fun)                                        \
     323             :   V(PROMISE_PROTOTYPE_MAP_INDEX, Map, promise_prototype_map)                   \
     324             :   V(REGEXP_EXEC_FUNCTION_INDEX, JSFunction, regexp_exec_function)              \
     325             :   V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function)                        \
     326             :   V(REGEXP_LAST_MATCH_INFO_INDEX, RegExpMatchInfo, regexp_last_match_info)     \
     327             :   V(REGEXP_INTERNAL_MATCH_INFO_INDEX, RegExpMatchInfo,                         \
     328             :     regexp_internal_match_info)                                                \
     329             :   V(REGEXP_PROTOTYPE_MAP_INDEX, Map, regexp_prototype_map)                     \
     330             :   V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map)                           \
     331             :   V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table)      \
     332             :   V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function)                        \
     333             :   V(SECURITY_TOKEN_INDEX, Object, security_token)                              \
     334             :   V(SELF_WEAK_CELL_INDEX, WeakCell, self_weak_cell)                            \
     335             :   V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map)                             \
     336             :   V(SHARED_ARRAY_BUFFER_FUN_INDEX, JSFunction, shared_array_buffer_fun)        \
     337             :   V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map)                     \
     338             :   V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map)                       \
     339             :   V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map,                          \
     340             :     sloppy_function_without_prototype_map)                                     \
     341             :   V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map,                    \
     342             :     sloppy_function_with_readonly_prototype_map)                               \
     343             :   V(SLOW_ALIASED_ARGUMENTS_MAP_INDEX, Map, slow_aliased_arguments_map)         \
     344             :   V(SLOW_OBJECT_WITH_NULL_PROTOTYPE_MAP, Map,                                  \
     345             :     slow_object_with_null_prototype_map)                                       \
     346             :   V(SLOW_TEMPLATE_INSTANTIATIONS_CACHE_INDEX, UnseededNumberDictionary,        \
     347             :     slow_template_instantiations_cache)                                        \
     348             :   V(STRICT_ARGUMENTS_MAP_INDEX, Map, strict_arguments_map)                     \
     349             :   V(ASYNC_FUNCTION_MAP_INDEX, Map, async_function_map)                         \
     350             :   V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map)                       \
     351             :   V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map,                          \
     352             :     strict_function_without_prototype_map)                                     \
     353             :   V(GENERATOR_FUNCTION_MAP_INDEX, Map, generator_function_map)                 \
     354             :   V(ASYNC_GENERATOR_FUNCTION_MAP_INDEX, Map, async_generator_function_map)     \
     355             :   V(CLASS_FUNCTION_MAP_INDEX, Map, class_function_map)                         \
     356             :   V(STRING_FUNCTION_INDEX, JSFunction, string_function)                        \
     357             :   V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map)   \
     358             :   V(STRING_ITERATOR_MAP_INDEX, Map, string_iterator_map)                       \
     359             :   V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function)                        \
     360             :   V(NATIVE_FUNCTION_MAP_INDEX, Map, native_function_map)                       \
     361             :   V(WASM_FUNCTION_MAP_INDEX, Map, wasm_function_map)                           \
     362             :   V(WASM_INSTANCE_CONSTRUCTOR_INDEX, JSFunction, wasm_instance_constructor)    \
     363             :   V(WASM_INSTANCE_SYM_INDEX, Symbol, wasm_instance_sym)                        \
     364             :   V(WASM_MEMORY_CONSTRUCTOR_INDEX, JSFunction, wasm_memory_constructor)        \
     365             :   V(WASM_MEMORY_SYM_INDEX, Symbol, wasm_memory_sym)                            \
     366             :   V(WASM_MODULE_CONSTRUCTOR_INDEX, JSFunction, wasm_module_constructor)        \
     367             :   V(WASM_MODULE_SYM_INDEX, Symbol, wasm_module_sym)                            \
     368             :   V(WASM_TABLE_CONSTRUCTOR_INDEX, JSFunction, wasm_table_constructor)          \
     369             :   V(WASM_TABLE_SYM_INDEX, Symbol, wasm_table_sym)                              \
     370             :   V(TYPED_ARRAY_FUN_INDEX, JSFunction, typed_array_function)                   \
     371             :   V(TYPED_ARRAY_PROTOTYPE_INDEX, JSObject, typed_array_prototype)              \
     372             :   V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun)                      \
     373             :   V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun)                      \
     374             :   V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun)                        \
     375             :   V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun)        \
     376             :   V(EXPORTS_CONTAINER, Object, exports_container)                              \
     377             :   NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(V)                                        \
     378             :   NATIVE_CONTEXT_IMPORTED_FIELDS(V)                                            \
     379             :   NATIVE_CONTEXT_JS_ARRAY_ITERATOR_MAPS(V)
     380             : 
     381             : // A table of all script contexts. Every loaded top-level script with top-level
     382             : // lexical declarations contributes its ScriptContext into this table.
     383             : //
     384             : // The table is a fixed array, its first slot is the current used count and
     385             : // the subsequent slots 1..used contain ScriptContexts.
     386             : class ScriptContextTable : public FixedArray {
     387             :  public:
     388             :   // Conversions.
     389             :   static inline ScriptContextTable* cast(Object* context);
     390             : 
     391             :   struct LookupResult {
     392             :     int context_index;
     393             :     int slot_index;
     394             :     VariableMode mode;
     395             :     InitializationFlag init_flag;
     396             :     MaybeAssignedFlag maybe_assigned_flag;
     397             :   };
     398             : 
     399             :   inline int used() const;
     400             :   inline void set_used(int used);
     401             : 
     402             :   static inline Handle<Context> GetContext(Handle<ScriptContextTable> table,
     403             :                                            int i);
     404             : 
     405             :   // Lookup a variable `name` in a ScriptContextTable.
     406             :   // If it returns true, the variable is found and `result` contains
     407             :   // valid information about its location.
     408             :   // If it returns false, `result` is untouched.
     409             :   MUST_USE_RESULT
     410             :   static bool Lookup(Handle<ScriptContextTable> table, Handle<String> name,
     411             :                      LookupResult* result);
     412             : 
     413             :   MUST_USE_RESULT
     414             :   static Handle<ScriptContextTable> Extend(Handle<ScriptContextTable> table,
     415             :                                            Handle<Context> script_context);
     416             : 
     417             :   static int GetContextOffset(int context_index) {
     418       14992 :     return kFirstContextOffset + context_index * kPointerSize;
     419             :   }
     420             : 
     421             :  private:
     422             :   static const int kUsedSlot = 0;
     423             :   static const int kFirstContextSlot = kUsedSlot + 1;
     424             :   static const int kFirstContextOffset =
     425             :       FixedArray::kHeaderSize + kFirstContextSlot * kPointerSize;
     426             : 
     427             :   DISALLOW_IMPLICIT_CONSTRUCTORS(ScriptContextTable);
     428             : };
     429             : 
     430             : // JSFunctions are pairs (context, function code), sometimes also called
     431             : // closures. A Context object is used to represent function contexts and
     432             : // dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak).
     433             : //
     434             : // At runtime, the contexts build a stack in parallel to the execution
     435             : // stack, with the top-most context being the current context. All contexts
     436             : // have the following slots:
     437             : //
     438             : // [ closure   ]  This is the current function. It is the same for all
     439             : //                contexts inside a function. It provides access to the
     440             : //                incoming context (i.e., the outer context, which may
     441             : //                or may not become the current function's context), and
     442             : //                it provides access to the functions code and thus it's
     443             : //                scope information, which in turn contains the names of
     444             : //                statically allocated context slots. The names are needed
     445             : //                for dynamic lookups in the presence of 'with' or 'eval'.
     446             : //
     447             : // [ previous  ]  A pointer to the previous context.
     448             : //
     449             : // [ extension ]  Additional data.
     450             : //
     451             : //                For script contexts, it contains the respective ScopeInfo.
     452             : //
     453             : //                For catch contexts, it contains a ContextExtension object
     454             : //                consisting of the ScopeInfo and the name of the catch
     455             : //                variable.
     456             : //
     457             : //                For module contexts, it contains the module object.
     458             : //
     459             : //                For block contexts, it contains either the respective
     460             : //                ScopeInfo or a ContextExtension object consisting of the
     461             : //                ScopeInfo and an "extension object" (see below).
     462             : //
     463             : //                For with contexts, it contains a ContextExtension object
     464             : //                consisting of the ScopeInfo and an "extension object".
     465             : //
     466             : //                An "extension object" is used to dynamically extend a context
     467             : //                with additional variables, namely in the implementation of the
     468             : //                'with' construct and the 'eval' construct.  For instance,
     469             : //                Context::Lookup also searches the extension object for
     470             : //                properties.  (Storing the extension object is the original
     471             : //                purpose of this context slot, hence the name.)
     472             : //
     473             : // [ native_context ]  A pointer to the native context.
     474             : //
     475             : // In addition, function contexts may have statically allocated context slots
     476             : // to store local variables/functions that are accessed from inner functions
     477             : // (via static context addresses) or through 'eval' (dynamic context lookups).
     478             : // The native context contains additional slots for fast access to native
     479             : // properties.
     480             : //
     481             : // Finally, with Harmony scoping, the JSFunction representing a top level
     482             : // script will have the ScriptContext rather than a FunctionContext.
     483             : // Script contexts from all top-level scripts are gathered in
     484             : // ScriptContextTable.
     485             : 
     486             : class Context: public FixedArray {
     487             :  public:
     488             :   // Conversions.
     489             :   static inline Context* cast(Object* context);
     490             : 
     491             :   // The default context slot layout; indices are FixedArray slot indices.
     492             :   enum Field {
     493             :     // These slots are in all contexts.
     494             :     CLOSURE_INDEX,
     495             :     PREVIOUS_INDEX,
     496             :     // The extension slot is used for either the global object (in native
     497             :     // contexts), eval extension object (function contexts), subject of with
     498             :     // (with contexts), or the variable name (catch contexts), the serialized
     499             :     // scope info (block contexts), or the module instance (module contexts).
     500             :     EXTENSION_INDEX,
     501             :     NATIVE_CONTEXT_INDEX,
     502             : 
     503             :     // These slots are only in native contexts.
     504             : #define NATIVE_CONTEXT_SLOT(index, type, name) index,
     505             :     NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_SLOT)
     506             : #undef NATIVE_CONTEXT_SLOT
     507             : 
     508             :     // Properties from here are treated as weak references by the full GC.
     509             :     // Scavenge treats them as strong references.
     510             :     OPTIMIZED_FUNCTIONS_LIST,  // Weak.
     511             :     OPTIMIZED_CODE_LIST,       // Weak.
     512             :     DEOPTIMIZED_CODE_LIST,     // Weak.
     513             :     NEXT_CONTEXT_LINK,         // Weak.
     514             : 
     515             :     // Total number of slots.
     516             :     NATIVE_CONTEXT_SLOTS,
     517             :     FIRST_WEAK_SLOT = OPTIMIZED_FUNCTIONS_LIST,
     518             :     FIRST_JS_ARRAY_MAP_SLOT = JS_ARRAY_FAST_SMI_ELEMENTS_MAP_INDEX,
     519             : 
     520             :     MIN_CONTEXT_SLOTS = GLOBAL_PROXY_INDEX,
     521             :     // This slot holds the thrown value in catch contexts.
     522             :     THROWN_OBJECT_INDEX = MIN_CONTEXT_SLOTS,
     523             : 
     524             :     // These slots hold values in debug evaluate contexts.
     525             :     WRAPPED_CONTEXT_INDEX = MIN_CONTEXT_SLOTS,
     526             :     WHITE_LIST_INDEX = MIN_CONTEXT_SLOTS + 1
     527             :   };
     528             : 
     529             :   void ResetErrorsThrown();
     530             :   void IncrementErrorsThrown();
     531             :   int GetErrorsThrown();
     532             : 
     533             :   // Direct slot access.
     534             :   inline JSFunction* closure();
     535             :   inline void set_closure(JSFunction* closure);
     536             : 
     537             :   inline Context* previous();
     538             :   inline void set_previous(Context* context);
     539             : 
     540             :   inline Object* next_context_link();
     541             : 
     542             :   inline bool has_extension();
     543             :   inline HeapObject* extension();
     544             :   inline void set_extension(HeapObject* object);
     545             :   JSObject* extension_object();
     546             :   JSReceiver* extension_receiver();
     547             :   ScopeInfo* scope_info();
     548             :   String* catch_name();
     549             : 
     550             :   // Find the module context (assuming there is one) and return the associated
     551             :   // module object.
     552             :   Module* module();
     553             : 
     554             :   // Get the context where var declarations will be hoisted to, which
     555             :   // may be the context itself.
     556             :   Context* declaration_context();
     557             :   bool is_declaration_context();
     558             : 
     559             :   // Get the next closure's context on the context chain.
     560             :   Context* closure_context();
     561             : 
     562             :   // Returns a JSGlobalProxy object or null.
     563             :   JSObject* global_proxy();
     564             :   void set_global_proxy(JSObject* global);
     565             : 
     566             :   // Get the JSGlobalObject object.
     567             :   V8_EXPORT_PRIVATE JSGlobalObject* global_object();
     568             : 
     569             :   // Get the script context by traversing the context chain.
     570             :   Context* script_context();
     571             : 
     572             :   // Compute the native context.
     573             :   inline Context* native_context();
     574             :   inline void set_native_context(Context* context);
     575             : 
     576             :   // Predicates for context types.  IsNativeContext is also defined on Object
     577             :   // because we frequently have to know if arbitrary objects are natives
     578             :   // contexts.
     579             :   inline bool IsNativeContext();
     580             :   inline bool IsFunctionContext();
     581             :   inline bool IsCatchContext();
     582             :   inline bool IsWithContext();
     583             :   inline bool IsDebugEvaluateContext();
     584             :   inline bool IsBlockContext();
     585             :   inline bool IsModuleContext();
     586             :   inline bool IsEvalContext();
     587             :   inline bool IsScriptContext();
     588             : 
     589             :   inline bool HasSameSecurityTokenAs(Context* that);
     590             : 
     591             :   // Removes a specific optimized code object from the optimized code map.
     592             :   // In case of non-OSR the code reference is cleared from the cache entry but
     593             :   // the entry itself is left in the map in order to proceed sharing literals.
     594             :   void EvictFromOptimizedCodeMap(Code* optimized_code, const char* reason);
     595             : 
     596             :   // Clear optimized code map.
     597             :   void ClearOptimizedCodeMap();
     598             : 
     599             :   // A native context keeps track of all osrd optimized functions.
     600             :   inline bool OptimizedCodeMapIsCleared();
     601             :   Code* SearchOptimizedCodeMap(SharedFunctionInfo* shared,
     602             :                                BailoutId osr_ast_id);
     603             :   int SearchOptimizedCodeMapEntry(SharedFunctionInfo* shared,
     604             :                                   BailoutId osr_ast_id);
     605             : 
     606             :   static void AddToOptimizedCodeMap(Handle<Context> native_context,
     607             :                                     Handle<SharedFunctionInfo> shared,
     608             :                                     Handle<Code> code,
     609             :                                     BailoutId osr_ast_id);
     610             : 
     611             :   // A native context holds a list of all functions with optimized code.
     612             :   void AddOptimizedFunction(JSFunction* function);
     613             :   void RemoveOptimizedFunction(JSFunction* function);
     614             :   void SetOptimizedFunctionsListHead(Object* head);
     615             :   Object* OptimizedFunctionsListHead();
     616             : 
     617             :   // The native context also stores a list of all optimized code and a
     618             :   // list of all deoptimized code, which are needed by the deoptimizer.
     619             :   void AddOptimizedCode(Code* code);
     620             :   void SetOptimizedCodeListHead(Object* head);
     621             :   Object* OptimizedCodeListHead();
     622             :   void SetDeoptimizedCodeListHead(Object* head);
     623             :   Object* DeoptimizedCodeListHead();
     624             : 
     625             :   Handle<Object> ErrorMessageForCodeGenerationFromStrings();
     626             : 
     627             :   static int ImportedFieldIndexForName(Handle<String> name);
     628             :   static int IntrinsicIndexForName(Handle<String> name);
     629             :   static int IntrinsicIndexForName(const unsigned char* name, int length);
     630             : 
     631             : #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \
     632             :   inline void set_##name(type* value);                    \
     633             :   inline bool is_##name(type* value);                     \
     634             :   inline type* name();
     635             :   NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSORS)
     636             : #undef NATIVE_CONTEXT_FIELD_ACCESSORS
     637             : 
     638             :   // Lookup the slot called name, starting with the current context.
     639             :   // There are three possibilities:
     640             :   //
     641             :   // 1) result->IsContext():
     642             :   //    The binding was found in a context.  *index is always the
     643             :   //    non-negative slot index.  *attributes is NONE for var and let
     644             :   //    declarations, READ_ONLY for const declarations (never ABSENT).
     645             :   //
     646             :   // 2) result->IsJSObject():
     647             :   //    The binding was found as a named property in a context extension
     648             :   //    object (i.e., was introduced via eval), as a property on the subject
     649             :   //    of with, or as a property of the global object.  *index is -1 and
     650             :   //    *attributes is not ABSENT.
     651             :   //
     652             :   // 3) result.is_null():
     653             :   //    There was no binding found, *index is always -1 and *attributes is
     654             :   //    always ABSENT.
     655             :   Handle<Object> Lookup(Handle<String> name, ContextLookupFlags flags,
     656             :                         int* index, PropertyAttributes* attributes,
     657             :                         InitializationFlag* init_flag,
     658             :                         VariableMode* variable_mode);
     659             : 
     660             :   // Code generation support.
     661             :   static int SlotOffset(int index) {
     662     3919966 :     return kHeaderSize + index * kPointerSize - kHeapObjectTag;
     663             :   }
     664             : 
     665    25955528 :   static int FunctionMapIndex(LanguageMode language_mode, FunctionKind kind) {
     666             :     // Note: Must be kept in sync with the FastNewClosure builtin.
     667    25955528 :     if (IsGeneratorFunction(kind)) {
     668             :       return IsAsyncFunction(kind) ? ASYNC_GENERATOR_FUNCTION_MAP_INDEX
     669       10429 :                                    : GENERATOR_FUNCTION_MAP_INDEX;
     670             :     }
     671             : 
     672    25945099 :     if (IsAsyncFunction(kind)) {
     673             :       return ASYNC_FUNCTION_MAP_INDEX;
     674             :     }
     675             : 
     676    25936744 :     if (IsClassConstructor(kind)) {
     677             :       // Like the strict function map, but with no 'name' accessor. 'name'
     678             :       // needs to be the last property and it is added during instantiation,
     679             :       // in case a static property with the same name exists"
     680             :       return CLASS_FUNCTION_MAP_INDEX;
     681             :     }
     682             : 
     683    71781942 :     if (IsArrowFunction(kind) || IsConciseMethod(kind) ||
     684             :         IsAccessorFunction(kind)) {
     685             :       return STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX;
     686             :     }
     687             : 
     688             :     return is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX
     689    22700188 :                                     : SLOPPY_FUNCTION_MAP_INDEX;
     690             :   }
     691             : 
     692             :   static int ArrayMapIndex(ElementsKind elements_kind) {
     693             :     DCHECK(IsFastElementsKind(elements_kind));
     694    23970906 :     return elements_kind + FIRST_JS_ARRAY_MAP_SLOT;
     695             :   }
     696             : 
     697             :   static const int kSize = kHeaderSize + NATIVE_CONTEXT_SLOTS * kPointerSize;
     698             :   static const int kNotFound = -1;
     699             : 
     700             :   // GC support.
     701             :   typedef FixedBodyDescriptor<
     702             :       kHeaderSize, kSize, kSize> ScavengeBodyDescriptor;
     703             : 
     704             :   typedef FixedBodyDescriptor<
     705             :       kHeaderSize,
     706             :       kHeaderSize + FIRST_WEAK_SLOT * kPointerSize,
     707             :       kSize> MarkCompactBodyDescriptor;
     708             : 
     709             :  private:
     710             : #ifdef DEBUG
     711             :   // Bootstrapping-aware type checks.
     712             :   V8_EXPORT_PRIVATE static bool IsBootstrappingOrNativeContext(Isolate* isolate,
     713             :                                                                Object* object);
     714             :   static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid);
     715             : #endif
     716             : 
     717             :   STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize);
     718             :   STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex);
     719             : };
     720             : 
     721             : typedef Context::Field ContextField;
     722             : 
     723             : }  // namespace internal
     724             : }  // namespace v8
     725             : 
     726             : #endif  // V8_CONTEXTS_H_

Generated by: LCOV version 1.10