v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
contexts.h
Go to the documentation of this file.
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_OBJECTS_CONTEXTS_H_
6#define V8_OBJECTS_CONTEXTS_H_
7
14
15// Has to be the last include (doesn't have include guards):
17
18namespace v8 {
19namespace internal {
20
21class ContextSidePropertyCell;
22class JSGlobalObject;
23class JSGlobalProxy;
24class MicrotaskQueue;
25class NativeContext;
26class RegExpMatchInfo;
27struct VariableLookupResult;
28
36
37// Heap-allocated activation contexts.
38//
39// Contexts are implemented as FixedArray-like objects having a fixed
40// header with a set of common fields.
41//
42// Note: Context must have no virtual functions and Context objects
43// must always be allocated via Heap::AllocateContext() or
44// Factory::NewContext.
45
46#define NATIVE_CONTEXT_FIELDS(V) \
47 V(GLOBAL_PROXY_INDEX, JSGlobalProxy, global_proxy_object) \
48 /* TODO(ishell): Actually we store exactly EmbedderDataArray here but */ \
49 /* it's already UBSan-fiendly and doesn't require a star... So declare */ \
50 /* it as a HeapObject for now. */ \
51 V(EMBEDDER_DATA_INDEX, HeapObject, embedder_data) \
52 V(CONTINUATION_PRESERVED_EMBEDDER_DATA_INDEX, HeapObject, \
53 continuation_preserved_embedder_data) \
54 V(GENERATOR_NEXT_INTERNAL, JSFunction, generator_next_internal) \
55 V(ASYNC_MODULE_EVALUATE_INTERNAL, JSFunction, \
56 async_module_evaluate_internal) \
57 V(REFLECT_APPLY_INDEX, JSFunction, reflect_apply) \
58 V(REFLECT_CONSTRUCT_INDEX, JSFunction, reflect_construct) \
59 V(PERFORM_PROMISE_THEN_INDEX, JSFunction, perform_promise_then) \
60 V(PROMISE_THEN_INDEX, JSFunction, promise_then) \
61 V(PROMISE_RESOLVE_INDEX, JSFunction, promise_resolve) \
62 V(FUNCTION_PROTOTYPE_APPLY_INDEX, JSFunction, function_prototype_apply) \
63 /* TypedArray constructors - these must stay in order! */ \
64 V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \
65 V(INT8_ARRAY_FUN_INDEX, JSFunction, int8_array_fun) \
66 V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \
67 V(INT16_ARRAY_FUN_INDEX, JSFunction, int16_array_fun) \
68 V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \
69 V(INT32_ARRAY_FUN_INDEX, JSFunction, int32_array_fun) \
70 V(BIGUINT64_ARRAY_FUN_INDEX, JSFunction, biguint64_array_fun) \
71 V(BIGINT64_ARRAY_FUN_INDEX, JSFunction, bigint64_array_fun) \
72 V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \
73 V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun) \
74 V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun) \
75 V(FLOAT16_ARRAY_FUN_INDEX, JSFunction, float16_array_fun) \
76 V(RAB_GSAB_UINT8_ARRAY_MAP_INDEX, Map, rab_gsab_uint8_array_map) \
77 V(RAB_GSAB_INT8_ARRAY_MAP_INDEX, Map, rab_gsab_int8_array_map) \
78 V(RAB_GSAB_UINT16_ARRAY_MAP_INDEX, Map, rab_gsab_uint16_array_map) \
79 V(RAB_GSAB_INT16_ARRAY_MAP_INDEX, Map, rab_gsab_int16_array_map) \
80 V(RAB_GSAB_UINT32_ARRAY_MAP_INDEX, Map, rab_gsab_uint32_array_map) \
81 V(RAB_GSAB_INT32_ARRAY_MAP_INDEX, Map, rab_gsab_int32_array_map) \
82 V(RAB_GSAB_BIGUINT64_ARRAY_MAP_INDEX, Map, rab_gsab_biguint64_array_map) \
83 V(RAB_GSAB_BIGINT64_ARRAY_MAP_INDEX, Map, rab_gsab_bigint64_array_map) \
84 V(RAB_GSAB_UINT8_CLAMPED_ARRAY_MAP_INDEX, Map, \
85 rab_gsab_uint8_clamped_array_map) \
86 V(RAB_GSAB_FLOAT32_ARRAY_MAP_INDEX, Map, rab_gsab_float32_array_map) \
87 V(RAB_GSAB_FLOAT64_ARRAY_MAP_INDEX, Map, rab_gsab_float64_array_map) \
88 V(RAB_GSAB_FLOAT16_ARRAY_MAP_INDEX, Map, rab_gsab_float16_array_map) \
89 /* Below is alpha-sorted */ \
90 V(ABSTRACT_MODULE_SOURCE_FUNCTION_INDEX, JSFunction, \
91 abstract_module_source_function) \
92 V(ABSTRACT_MODULE_SOURCE_PROTOTYPE_INDEX, JSObject, \
93 abstract_module_source_prototype) \
94 V(ACCESSOR_PROPERTY_DESCRIPTOR_MAP_INDEX, Map, \
95 accessor_property_descriptor_map) \
96 V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings) \
97 V(ARRAY_BUFFER_FUN_INDEX, JSFunction, array_buffer_fun) \
98 V(ARRAY_BUFFER_MAP_INDEX, Map, array_buffer_map) \
99 V(ARRAY_BUFFER_NOINIT_FUN_INDEX, JSFunction, array_buffer_noinit_fun) \
100 V(ARRAY_FUNCTION_INDEX, JSFunction, array_function) \
101 V(ARRAY_JOIN_STACK_INDEX, HeapObject, array_join_stack) \
102 V(ARRAY_FROM_ASYNC_INDEX, JSFunction, from_async) \
103 V(ASYNC_FROM_SYNC_ITERATOR_MAP_INDEX, Map, async_from_sync_iterator_map) \
104 V(ASYNC_FUNCTION_FUNCTION_INDEX, JSFunction, async_function_constructor) \
105 V(ASYNC_FUNCTION_OBJECT_MAP_INDEX, Map, async_function_object_map) \
106 V(ASYNC_GENERATOR_FUNCTION_FUNCTION_INDEX, JSFunction, \
107 async_generator_function_function) \
108 V(BIGINT_FUNCTION_INDEX, JSFunction, bigint_function) \
109 V(BOOLEAN_FUNCTION_INDEX, JSFunction, boolean_function) \
110 V(BOUND_FUNCTION_WITH_CONSTRUCTOR_MAP_INDEX, Map, \
111 bound_function_with_constructor_map) \
112 V(BOUND_FUNCTION_WITHOUT_CONSTRUCTOR_MAP_INDEX, Map, \
113 bound_function_without_constructor_map) \
114 V(CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, JSFunction, \
115 call_as_constructor_delegate) \
116 V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \
117 V(CALLSITE_FUNCTION_INDEX, JSFunction, callsite_function) \
118 V(CONTEXT_EXTENSION_FUNCTION_INDEX, JSFunction, context_extension_function) \
119 V(DATA_PROPERTY_DESCRIPTOR_MAP_INDEX, Map, data_property_descriptor_map) \
120 V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun) \
121 V(DATE_FUNCTION_INDEX, JSFunction, date_function) \
122 V(DEBUG_CONTEXT_ID_INDEX, (UnionOf<Smi, Undefined>), debug_context_id) \
123 V(EMPTY_FUNCTION_INDEX, JSFunction, empty_function) \
124 V(ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX, Object, \
125 error_message_for_code_gen_from_strings) \
126 V(ERROR_MESSAGE_FOR_WASM_CODE_GEN_INDEX, Object, \
127 error_message_for_wasm_code_gen) \
128 V(ERRORS_THROWN_INDEX, Smi, errors_thrown) \
129 V(EXTRAS_BINDING_OBJECT_INDEX, JSObject, extras_binding_object) \
130 V(FAST_ALIASED_ARGUMENTS_MAP_INDEX, Map, fast_aliased_arguments_map) \
131 V(FAST_TEMPLATE_INSTANTIATIONS_CACHE_INDEX, FixedArray, \
132 fast_template_instantiations_cache) \
133 V(FUNCTION_FUNCTION_INDEX, JSFunction, function_function) \
134 V(FUNCTION_PROTOTYPE_INDEX, JSObject, function_prototype) \
135 V(GENERATOR_FUNCTION_FUNCTION_INDEX, JSFunction, \
136 generator_function_function) \
137 V(GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map, generator_object_prototype_map) \
138 V(ASYNC_GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map, \
139 async_generator_object_prototype_map) \
140 V(INITIAL_ARRAY_ITERATOR_MAP_INDEX, Map, initial_array_iterator_map) \
141 V(INITIAL_ARRAY_ITERATOR_PROTOTYPE_INDEX, JSObject, \
142 initial_array_iterator_prototype) \
143 V(INITIAL_ARRAY_PROTOTYPE_INDEX, JSObject, initial_array_prototype) \
144 V(INITIAL_ERROR_PROTOTYPE_INDEX, JSObject, initial_error_prototype) \
145 V(INITIAL_GENERATOR_PROTOTYPE_INDEX, JSObject, initial_generator_prototype) \
146 V(INITIAL_ASYNC_ITERATOR_PROTOTYPE_INDEX, JSObject, \
147 initial_async_iterator_prototype) \
148 V(INITIAL_ASYNC_GENERATOR_PROTOTYPE_INDEX, JSObject, \
149 initial_async_generator_prototype) \
150 V(INITIAL_ITERATOR_PROTOTYPE_INDEX, JSObject, initial_iterator_prototype) \
151 V(INITIAL_DISPOSABLE_STACK_PROTOTYPE_INDEX, JSObject, \
152 initial_disposable_stack_prototype) \
153 V(INITIAL_MAP_ITERATOR_PROTOTYPE_INDEX, JSObject, \
154 initial_map_iterator_prototype) \
155 V(INITIAL_MAP_PROTOTYPE_MAP_INDEX, Map, initial_map_prototype_map) \
156 V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype) \
157 V(INITIAL_SET_ITERATOR_PROTOTYPE_INDEX, JSObject, \
158 initial_set_iterator_prototype) \
159 V(INITIAL_SET_PROTOTYPE_INDEX, JSObject, initial_set_prototype) \
160 V(INITIAL_SET_PROTOTYPE_MAP_INDEX, Map, initial_set_prototype_map) \
161 V(INITIAL_STRING_ITERATOR_MAP_INDEX, Map, initial_string_iterator_map) \
162 V(INITIAL_STRING_ITERATOR_PROTOTYPE_INDEX, JSObject, \
163 initial_string_iterator_prototype) \
164 V(INITIAL_STRING_PROTOTYPE_INDEX, JSObject, initial_string_prototype) \
165 V(INITIAL_WEAKMAP_PROTOTYPE_MAP_INDEX, Map, initial_weakmap_prototype_map) \
166 V(INITIAL_WEAKSET_PROTOTYPE_MAP_INDEX, Map, initial_weakset_prototype_map) \
167 V(INTL_COLLATOR_FUNCTION_INDEX, JSFunction, intl_collator_function) \
168 V(INTL_DATE_TIME_FORMAT_FUNCTION_INDEX, JSFunction, \
169 intl_date_time_format_function) \
170 V(INTL_DISPLAY_NAMES_FUNCTION_INDEX, JSFunction, \
171 intl_display_names_function) \
172 V(INTL_DURATION_FORMAT_FUNCTION_INDEX, JSFunction, \
173 intl_duration_format_function) \
174 V(INTL_NUMBER_FORMAT_FUNCTION_INDEX, JSFunction, \
175 intl_number_format_function) \
176 V(INTL_LOCALE_FUNCTION_INDEX, JSFunction, intl_locale_function) \
177 V(INTL_LIST_FORMAT_FUNCTION_INDEX, JSFunction, intl_list_format_function) \
178 V(INTL_PLURAL_RULES_FUNCTION_INDEX, JSFunction, intl_plural_rules_function) \
179 V(INTL_RELATIVE_TIME_FORMAT_FUNCTION_INDEX, JSFunction, \
180 intl_relative_time_format_function) \
181 V(INTL_SEGMENTER_FUNCTION_INDEX, JSFunction, intl_segmenter_function) \
182 V(INTL_SEGMENTS_MAP_INDEX, Map, intl_segments_map) \
183 V(INTL_SEGMENT_DATA_OBJECT_MAP_INDEX, Map, intl_segment_data_object_map) \
184 V(INTL_SEGMENT_DATA_OBJECT_WORDLIKE_MAP_INDEX, Map, \
185 intl_segment_data_object_wordlike_map) \
186 V(INTL_SEGMENT_ITERATOR_MAP_INDEX, Map, intl_segment_iterator_map) \
187 V(ITERATOR_FILTER_HELPER_MAP_INDEX, Map, iterator_filter_helper_map) \
188 V(ITERATOR_MAP_HELPER_MAP_INDEX, Map, iterator_map_helper_map) \
189 V(ITERATOR_TAKE_HELPER_MAP_INDEX, Map, iterator_take_helper_map) \
190 V(ITERATOR_DROP_HELPER_MAP_INDEX, Map, iterator_drop_helper_map) \
191 V(ITERATOR_FLAT_MAP_HELPER_MAP_INDEX, Map, iterator_flatMap_helper_map) \
192 V(ITERATOR_FUNCTION_INDEX, JSFunction, iterator_function) \
193 V(VALID_ITERATOR_WRAPPER_MAP_INDEX, Map, valid_iterator_wrapper_map) \
194 V(ITERATOR_RESULT_MAP_INDEX, Map, iterator_result_map) \
195 V(JS_ARRAY_PACKED_SMI_ELEMENTS_MAP_INDEX, Map, \
196 js_array_packed_smi_elements_map) \
197 V(JS_ARRAY_HOLEY_SMI_ELEMENTS_MAP_INDEX, Map, \
198 js_array_holey_smi_elements_map) \
199 V(JS_ARRAY_PACKED_ELEMENTS_MAP_INDEX, Map, js_array_packed_elements_map) \
200 V(JS_ARRAY_HOLEY_ELEMENTS_MAP_INDEX, Map, js_array_holey_elements_map) \
201 V(JS_ARRAY_PACKED_DOUBLE_ELEMENTS_MAP_INDEX, Map, \
202 js_array_packed_double_elements_map) \
203 V(JS_ARRAY_HOLEY_DOUBLE_ELEMENTS_MAP_INDEX, Map, \
204 js_array_holey_double_elements_map) \
205 V(JS_ARRAY_TEMPLATE_LITERAL_OBJECT_MAP, Map, \
206 js_array_template_literal_object_map) \
207 V(JS_DISPOSABLE_STACK_FUNCTION_INDEX, JSFunction, \
208 js_disposable_stack_function) \
209 V(JS_ASYNC_DISPOSABLE_STACK_FUNCTION_INDEX, JSFunction, \
210 js_async_disposable_stack_function) \
211 V(JS_DISPOSABLE_STACK_MAP_INDEX, Map, js_disposable_stack_map) \
212 V(JS_MAP_FUN_INDEX, JSFunction, js_map_fun) \
213 V(JS_MAP_MAP_INDEX, Map, js_map_map) \
214 V(JS_MODULE_NAMESPACE_MAP, Map, js_module_namespace_map) \
215 V(JS_RAW_JSON_MAP, Map, js_raw_json_map) \
216 V(JS_SET_FUN_INDEX, JSFunction, js_set_fun) \
217 V(JS_SET_MAP_INDEX, Map, js_set_map) \
218 V(JS_WEAK_MAP_FUN_INDEX, JSFunction, js_weak_map_fun) \
219 V(JS_WEAK_SET_FUN_INDEX, JSFunction, js_weak_set_fun) \
220 V(JS_WEAK_REF_FUNCTION_INDEX, JSFunction, js_weak_ref_fun) \
221 V(JS_FINALIZATION_REGISTRY_FUNCTION_INDEX, JSFunction, \
222 js_finalization_registry_fun) \
223 V(JS_TEMPORAL_CALENDAR_FUNCTION_INDEX, JSFunction, \
224 temporal_calendar_function) \
225 V(JS_TEMPORAL_DURATION_FUNCTION_INDEX, JSFunction, \
226 temporal_duration_function) \
227 V(JS_TEMPORAL_INSTANT_FUNCTION_INDEX, JSFunction, temporal_instant_function) \
228 V(JS_TEMPORAL_PLAIN_DATE_FUNCTION_INDEX, JSFunction, \
229 temporal_plain_date_function) \
230 V(JS_TEMPORAL_PLAIN_DATE_TIME_FUNCTION_INDEX, JSFunction, \
231 temporal_plain_date_time_function) \
232 V(JS_TEMPORAL_PLAIN_MONTH_DAY_FUNCTION_INDEX, JSFunction, \
233 temporal_plain_month_day_function) \
234 V(JS_TEMPORAL_PLAIN_TIME_FUNCTION_INDEX, JSFunction, \
235 temporal_plain_time_function) \
236 V(JS_TEMPORAL_PLAIN_YEAR_MONTH_FUNCTION_INDEX, JSFunction, \
237 temporal_plain_year_month_function) \
238 V(JS_TEMPORAL_TIME_ZONE_FUNCTION_INDEX, JSFunction, \
239 temporal_time_zone_function) \
240 V(JS_TEMPORAL_ZONED_DATE_TIME_FUNCTION_INDEX, JSFunction, \
241 temporal_zoned_date_time_function) \
242 V(JSON_OBJECT, JSObject, json_object) \
243 V(PROMISE_WITHRESOLVERS_RESULT_MAP_INDEX, Map, \
244 promise_withresolvers_result_map) \
245 V(TEMPORAL_OBJECT_INDEX, HeapObject, temporal_object) \
246 V(TEMPORAL_INSTANT_FIXED_ARRAY_FROM_ITERABLE_FUNCTION_INDEX, JSFunction, \
247 temporal_instant_fixed_array_from_iterable) \
248 V(STRING_FIXED_ARRAY_FROM_ITERABLE_FUNCTION_INDEX, JSFunction, \
249 string_fixed_array_from_iterable) \
250 /* Context maps */ \
251 V(META_MAP_INDEX, Map, meta_map) \
252 V(FUNCTION_CONTEXT_MAP_INDEX, Map, function_context_map) \
253 V(MODULE_CONTEXT_MAP_INDEX, Map, module_context_map) \
254 V(EVAL_CONTEXT_MAP_INDEX, Map, eval_context_map) \
255 V(SCRIPT_CONTEXT_MAP_INDEX, Map, script_context_map) \
256 V(AWAIT_CONTEXT_MAP_INDEX, Map, await_context_map) \
257 V(BLOCK_CONTEXT_MAP_INDEX, Map, block_context_map) \
258 V(CATCH_CONTEXT_MAP_INDEX, Map, catch_context_map) \
259 V(WITH_CONTEXT_MAP_INDEX, Map, with_context_map) \
260 V(DEBUG_EVALUATE_CONTEXT_MAP_INDEX, Map, debug_evaluate_context_map) \
261 V(JS_RAB_GSAB_DATA_VIEW_MAP_INDEX, Map, js_rab_gsab_data_view_map) \
262 V(MAP_CACHE_INDEX, Object, map_cache) \
263 V(MAP_KEY_ITERATOR_MAP_INDEX, Map, map_key_iterator_map) \
264 V(MAP_KEY_VALUE_ITERATOR_MAP_INDEX, Map, map_key_value_iterator_map) \
265 V(MAP_VALUE_ITERATOR_MAP_INDEX, Map, map_value_iterator_map) \
266 V(MATH_RANDOM_INDEX_INDEX, Smi, math_random_index) \
267 V(MATH_RANDOM_STATE_INDEX, ByteArray, math_random_state) \
268 V(MATH_RANDOM_CACHE_INDEX, FixedDoubleArray, math_random_cache) \
269 V(NORMALIZED_MAP_CACHE_INDEX, Object, normalized_map_cache) \
270 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \
271 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \
272 V(OBJECT_FUNCTION_PROTOTYPE_INDEX, JSObject, object_function_prototype) \
273 V(OBJECT_FUNCTION_PROTOTYPE_MAP_INDEX, Map, object_function_prototype_map) \
274 V(PROMISE_HOOK_INIT_FUNCTION_INDEX, Object, promise_hook_init_function) \
275 V(PROMISE_HOOK_BEFORE_FUNCTION_INDEX, Object, promise_hook_before_function) \
276 V(PROMISE_HOOK_AFTER_FUNCTION_INDEX, Object, promise_hook_after_function) \
277 V(PROMISE_HOOK_RESOLVE_FUNCTION_INDEX, Object, \
278 promise_hook_resolve_function) \
279 V(PROXY_CALLABLE_MAP_INDEX, Map, proxy_callable_map) \
280 V(PROXY_CONSTRUCTOR_MAP_INDEX, Map, proxy_constructor_map) \
281 V(PROXY_FUNCTION_INDEX, JSFunction, proxy_function) \
282 V(PROXY_MAP_INDEX, Map, proxy_map) \
283 V(PROXY_REVOCABLE_RESULT_MAP_INDEX, Map, proxy_revocable_result_map) \
284 V(PROMISE_PROTOTYPE_INDEX, JSObject, promise_prototype) \
285 V(RECORDER_CONTEXT_ID, Object, recorder_context_id) \
286 V(REGEXP_EXEC_FUNCTION_INDEX, JSFunction, regexp_exec_function) \
287 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \
288 V(REGEXP_LAST_MATCH_INFO_INDEX, RegExpMatchInfo, regexp_last_match_info) \
289 V(REGEXP_MATCH_ALL_FUNCTION_INDEX, JSFunction, regexp_match_all_function) \
290 V(REGEXP_MATCH_FUNCTION_INDEX, JSFunction, regexp_match_function) \
291 V(REGEXP_PROTOTYPE_INDEX, JSObject, regexp_prototype) \
292 V(REGEXP_PROTOTYPE_MAP_INDEX, Map, regexp_prototype_map) \
293 V(REGEXP_REPLACE_FUNCTION_INDEX, JSFunction, regexp_replace_function) \
294 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map) \
295 V(REGEXP_RESULT_WITH_INDICES_MAP_INDEX, Map, regexp_result_with_indices_map) \
296 V(REGEXP_RESULT_INDICES_MAP_INDEX, Map, regexp_result_indices_map) \
297 V(REGEXP_SEARCH_FUNCTION_INDEX, JSFunction, regexp_search_function) \
298 V(REGEXP_SPLIT_FUNCTION_INDEX, JSFunction, regexp_split_function) \
299 V(INITIAL_REGEXP_STRING_ITERATOR_PROTOTYPE_MAP_INDEX, Map, \
300 initial_regexp_string_iterator_prototype_map) \
301 V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \
302 V(SCRIPT_EXECUTION_CALLBACK_INDEX, Object, script_execution_callback) \
303 V(SECURITY_TOKEN_INDEX, Object, security_token) \
304 V(SERIALIZED_OBJECTS, HeapObject, serialized_objects) \
305 V(SET_VALUE_ITERATOR_MAP_INDEX, Map, set_value_iterator_map) \
306 V(SET_KEY_VALUE_ITERATOR_MAP_INDEX, Map, set_key_value_iterator_map) \
307 V(SHARED_ARRAY_BUFFER_FUN_INDEX, JSFunction, shared_array_buffer_fun) \
308 V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map) \
309 V(SLOW_ALIASED_ARGUMENTS_MAP_INDEX, Map, slow_aliased_arguments_map) \
310 V(STRICT_ARGUMENTS_MAP_INDEX, Map, strict_arguments_map) \
311 V(SLOW_OBJECT_WITH_NULL_PROTOTYPE_MAP, Map, \
312 slow_object_with_null_prototype_map) \
313 V(SLOW_OBJECT_WITH_OBJECT_PROTOTYPE_MAP, Map, \
314 slow_object_with_object_prototype_map) \
315 V(SLOW_TEMPLATE_INSTANTIATIONS_CACHE_INDEX, EphemeronHashTable, \
316 slow_template_instantiations_cache) \
317 V(ATOMICS_WAITASYNC_PROMISES, OrderedHashSet, atomics_waitasync_promises) \
318 V(WASM_DEBUG_MAPS, FixedArray, wasm_debug_maps) \
319 /* Fast Path Protectors */ \
320 V(REGEXP_SPECIES_PROTECTOR_INDEX, PropertyCell, regexp_species_protector) \
321 /* All *_FUNCTION_MAP_INDEX definitions used by Context::FunctionMapIndex */ \
322 /* must remain together. */ \
323 V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \
324 V(SLOPPY_FUNCTION_WITH_NAME_MAP_INDEX, Map, sloppy_function_with_name_map) \
325 V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \
326 sloppy_function_without_prototype_map) \
327 V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \
328 sloppy_function_with_readonly_prototype_map) \
329 V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \
330 V(STRICT_FUNCTION_WITH_NAME_MAP_INDEX, Map, strict_function_with_name_map) \
331 V(STRICT_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \
332 strict_function_with_readonly_prototype_map) \
333 V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \
334 strict_function_without_prototype_map) \
335 V(METHOD_WITH_NAME_MAP_INDEX, Map, method_with_name_map) \
336 V(ASYNC_FUNCTION_MAP_INDEX, Map, async_function_map) \
337 V(ASYNC_FUNCTION_WITH_NAME_MAP_INDEX, Map, async_function_with_name_map) \
338 V(GENERATOR_FUNCTION_MAP_INDEX, Map, generator_function_map) \
339 V(GENERATOR_FUNCTION_WITH_NAME_MAP_INDEX, Map, \
340 generator_function_with_name_map) \
341 V(ASYNC_GENERATOR_FUNCTION_MAP_INDEX, Map, async_generator_function_map) \
342 V(ASYNC_GENERATOR_FUNCTION_WITH_NAME_MAP_INDEX, Map, \
343 async_generator_function_with_name_map) \
344 V(CLASS_FUNCTION_MAP_INDEX, Map, class_function_map) \
345 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \
346 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \
347 V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \
348 V(IS_WASM_JS_INSTALLED_INDEX, Smi, is_wasm_js_installed) \
349 V(IS_WASM_JSPI_INSTALLED_INDEX, Smi, is_wasm_jspi_installed) \
350 V(WASM_WEBASSEMBLY_OBJECT_INDEX, JSObject, wasm_webassembly_object) \
351 V(WASM_EXPORTED_FUNCTION_MAP_INDEX, Map, wasm_exported_function_map) \
352 V(WASM_TAG_CONSTRUCTOR_INDEX, JSFunction, wasm_tag_constructor) \
353 V(WASM_EXCEPTION_CONSTRUCTOR_INDEX, JSFunction, wasm_exception_constructor) \
354 V(WASM_GLOBAL_CONSTRUCTOR_INDEX, JSFunction, wasm_global_constructor) \
355 V(WASM_INSTANCE_CONSTRUCTOR_INDEX, JSFunction, wasm_instance_constructor) \
356 V(WASM_JS_TAG_INDEX, JSObject, wasm_js_tag) \
357 V(WASM_MEMORY_CONSTRUCTOR_INDEX, JSFunction, wasm_memory_constructor) \
358 V(WASM_MODULE_CONSTRUCTOR_INDEX, JSFunction, wasm_module_constructor) \
359 V(WASM_TABLE_CONSTRUCTOR_INDEX, JSFunction, wasm_table_constructor) \
360 V(WASM_SUSPENDING_CONSTRUCTOR_INDEX, JSFunction, \
361 wasm_suspending_constructor) \
362 V(WASM_SUSPENDER_CONSTRUCTOR_INDEX, JSFunction, wasm_suspender_constructor) \
363 V(WASM_SUSPENDING_MAP, Map, wasm_suspending_map) \
364 V(WASM_SUSPENDING_PROTOTYPE, JSObject, wasm_suspending_prototype) \
365 V(WASM_MEMORY_MAP_DESCRIPTOR_CONSTRUCTOR_INDEX, JSFunction, \
366 wasm_memory_map_descriptor_constructor) \
367 V(TEMPLATE_WEAKMAP_INDEX, HeapObject, template_weakmap) \
368 V(TYPED_ARRAY_FUN_INDEX, JSFunction, typed_array_function) \
369 V(TYPED_ARRAY_PROTOTYPE_INDEX, JSObject, typed_array_prototype) \
370 V(ARRAY_ENTRIES_ITERATOR_INDEX, JSFunction, array_entries_iterator) \
371 V(ARRAY_FOR_EACH_ITERATOR_INDEX, JSFunction, array_for_each_iterator) \
372 V(ARRAY_KEYS_ITERATOR_INDEX, JSFunction, array_keys_iterator) \
373 V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \
374 V(ERROR_FUNCTION_INDEX, JSFunction, error_function) \
375 V(ERROR_TO_STRING, JSFunction, error_to_string) \
376 V(EVAL_ERROR_FUNCTION_INDEX, JSFunction, eval_error_function) \
377 V(AGGREGATE_ERROR_FUNCTION_INDEX, JSFunction, aggregate_error_function) \
378 V(GLOBAL_EVAL_FUN_INDEX, JSFunction, global_eval_fun) \
379 V(GLOBAL_PARSE_FLOAT_FUN_INDEX, JSFunction, global_parse_float_fun) \
380 V(GLOBAL_PARSE_INT_FUN_INDEX, JSFunction, global_parse_int_fun) \
381 V(GLOBAL_PROXY_FUNCTION_INDEX, JSFunction, global_proxy_function) \
382 V(MAP_DELETE_INDEX, JSFunction, map_delete) \
383 V(MAP_GET_INDEX, JSFunction, map_get) \
384 V(MAP_HAS_INDEX, JSFunction, map_has) \
385 V(MAP_SET_INDEX, JSFunction, map_set) \
386 V(FUNCTION_HAS_INSTANCE_INDEX, JSFunction, function_has_instance) \
387 V(FUNCTION_TO_STRING_INDEX, JSFunction, function_to_string) \
388 V(OBJECT_TO_STRING, JSFunction, object_to_string) \
389 V(OBJECT_VALUE_OF_FUNCTION_INDEX, JSFunction, object_value_of_function) \
390 V(PROMISE_ALL_INDEX, JSFunction, promise_all) \
391 V(PROMISE_ALL_SETTLED_INDEX, JSFunction, promise_all_settled) \
392 V(PROMISE_ANY_INDEX, JSFunction, promise_any) \
393 V(PROMISE_FUNCTION_INDEX, JSFunction, promise_function) \
394 V(RANGE_ERROR_FUNCTION_INDEX, JSFunction, range_error_function) \
395 V(REFERENCE_ERROR_FUNCTION_INDEX, JSFunction, reference_error_function) \
396 V(SET_ADD_INDEX, JSFunction, set_add) \
397 V(SET_DELETE_INDEX, JSFunction, set_delete) \
398 V(SET_HAS_INDEX, JSFunction, set_has) \
399 V(SHADOW_REALM_IMPORT_VALUE_REJECTED_INDEX, JSFunction, \
400 shadow_realm_import_value_rejected) \
401 V(SUPPRESSED_ERROR_FUNCTION_INDEX, JSFunction, suppressed_error_function) \
402 V(SYNTAX_ERROR_FUNCTION_INDEX, JSFunction, syntax_error_function) \
403 V(TYPE_ERROR_FUNCTION_INDEX, JSFunction, type_error_function) \
404 V(URI_ERROR_FUNCTION_INDEX, JSFunction, uri_error_function) \
405 V(WASM_COMPILE_ERROR_FUNCTION_INDEX, JSFunction, \
406 wasm_compile_error_function) \
407 V(WASM_LINK_ERROR_FUNCTION_INDEX, JSFunction, wasm_link_error_function) \
408 V(WASM_SUSPEND_ERROR_FUNCTION_INDEX, JSFunction, \
409 wasm_suspend_error_function) \
410 V(WASM_RUNTIME_ERROR_FUNCTION_INDEX, JSFunction, \
411 wasm_runtime_error_function) \
412 V(WEAKMAP_SET_INDEX, JSFunction, weakmap_set) \
413 V(WEAKMAP_GET_INDEX, JSFunction, weakmap_get) \
414 V(WEAKMAP_DELETE_INDEX, JSFunction, weakmap_delete) \
415 V(WEAKSET_ADD_INDEX, JSFunction, weakset_add) \
416 V(WRAPPED_FUNCTION_MAP_INDEX, Map, wrapped_function_map) \
417 V(RETAINED_MAPS, Object, retained_maps) \
418 V(SHARED_SPACE_JS_OBJECT_HAS_INSTANCE_INDEX, JSFunction, \
419 shared_space_js_object_has_instance)
420
421#include "torque-generated/src/objects/contexts-tq.inc"
422
423// JSFunctions are pairs (context, function code), sometimes also called
424// closures. A Context object is used to represent function contexts and
425// dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak).
426//
427// At runtime, the contexts build a stack in parallel to the execution
428// stack, with the top-most context being the current context. All contexts
429// have the following slots:
430//
431// [ scope_info ] This is the scope info describing the current context. It
432// contains the names of statically allocated context slots,
433// and stack-allocated locals. The names are needed for
434// dynamic lookups in the presence of 'with' or 'eval', and
435// for the debugger.
436//
437// [ previous ] A pointer to the previous context.
438//
439// [ extension ] Additional data. This slot is only available when
440// ScopeInfo::HasContextExtensionSlot returns true.
441//
442// For native contexts, it contains the global object.
443// For module contexts, it contains the module object.
444// For await contexts, it contains the generator object.
445// For var block contexts, it may contain an "extension
446// object".
447// For with contexts, it contains an "extension object".
448//
449// An "extension object" is used to dynamically extend a
450// context with additional variables, namely in the
451// implementation of the 'with' construct and the 'eval'
452// construct. For instance, Context::Lookup also searches
453// the extension object for properties. (Storing the
454// extension object is the original purpose of this context
455// slot, hence the name.)
456//
457// In addition, function contexts with sloppy eval may have statically
458// allocated context slots to store local variables/functions that are accessed
459// from inner functions (via static context addresses) or through 'eval'
460// (dynamic context lookups).
461// The native context contains additional slots for fast access to native
462// properties.
463//
464// Finally, with Harmony scoping, the JSFunction representing a top level
465// script will have the ScriptContext rather than a FunctionContext.
466// Script contexts from all top-level scripts are gathered in
467// ScriptContextTable.
468
469class Context : public TorqueGeneratedContext<Context, HeapObject> {
470 public:
472
473 using TorqueGeneratedContext::length; // Non-atomic.
474 using TorqueGeneratedContext::set_length; // Non-atomic.
476
477 // Setter and getter for elements.
478 // Note the plain accessors use relaxed semantics.
479 // TODO(jgruber): Make that explicit through tags.
480 V8_INLINE Tagged<Object> get(int index) const;
481 V8_INLINE Tagged<Object> get(PtrComprCageBase cage_base, int index) const;
482 V8_INLINE void set(int index, Tagged<Object> value,
484 // Accessors with acquire-release semantics.
485 V8_INLINE Tagged<Object> get(int index, AcquireLoadTag) const;
486 V8_INLINE Tagged<Object> get(PtrComprCageBase cage_base, int index,
487 AcquireLoadTag) const;
488 V8_INLINE void set(int index, Tagged<Object> value, WriteBarrierMode mode,
490
491 static const int kScopeInfoOffset = kElementsOffset;
493
494 /* Header size. */ \
495 /* TODO(ishell): use this as header size once MIN_CONTEXT_SLOTS */ \
496 /* is removed in favour of offset-based access to common fields. */ \
498
499 // If the extension slot exists, it is the first slot after the header.
501
502 // Garbage collection support.
503 V8_INLINE static constexpr int SizeFor(int length) {
504 // TODO(v8:9287): This is a workaround for GCMole build failures.
505 int result = kElementsOffset + length * kTaggedSize;
506 DCHECK_EQ(TorqueGeneratedContext::SizeFor(length), result);
507 return result;
508 }
509
510 // Code Generation support.
511 // Offset of the element from the beginning of object.
512 V8_INLINE static constexpr int OffsetOfElementAt(int index) {
513 return SizeFor(index);
514 }
515 // Offset of the element from the heap object pointer.
516 V8_INLINE static constexpr int SlotOffset(int index) {
517 return OffsetOfElementAt(index) - kHeapObjectTag;
518 }
519
520 // Initializes the variable slots of the context. Lexical variables that need
521 // initialization are filled with the hole.
522 void Initialize(Isolate* isolate);
523
524 // TODO(ishell): eventually migrate to the offset based access instead of
525 // index-based.
526 // The default context slot layout; indices are FixedArray slot indices.
527 enum Field {
528 // TODO(shell): use offset-based approach for accessing common values.
529 // These slots are in all contexts.
532
533 // This slot only exists if ScopeInfo::HasContextExtensionSlot returns true.
535
536// These slots are only in native contexts.
537#define NATIVE_CONTEXT_SLOT(index, type, name) index,
539#undef NATIVE_CONTEXT_SLOT
540
541 // Properties from here are treated as weak references by the full GC.
542 // Scavenge treats them as strong references.
544
545 // Total number of slots.
548 FIRST_JS_ARRAY_MAP_SLOT = JS_ARRAY_PACKED_SMI_ELEMENTS_MAP_INDEX,
549
550 // TODO(shell): Remove, once it becomes zero
553
554 // This slot holds the thrown value in catch contexts.
556
557 // These slots hold values in debug evaluate contexts.
559
560 // This slot holds the const tracking let side data.
562 };
563
564 static const int kExtensionSize =
567
568 // A region of native context entries containing maps for functions created
569 // by Builtin::kFastNewClosure.
570 static const int FIRST_FUNCTION_MAP_INDEX = SLOPPY_FUNCTION_MAP_INDEX;
571 static const int LAST_FUNCTION_MAP_INDEX = CLASS_FUNCTION_MAP_INDEX;
572
573 static const int FIRST_FIXED_TYPED_ARRAY_FUN_INDEX = UINT8_ARRAY_FUN_INDEX;
575 RAB_GSAB_UINT8_ARRAY_MAP_INDEX;
576
577 static const int kNoContext = 0;
578 static const int kInvalidContext = 1;
579
580 // Direct slot access.
582
583 inline Tagged<Object> unchecked_previous() const;
584 inline Tagged<Context> previous() const;
585
586 inline Tagged<Object> next_context_link() const;
587
588 inline bool has_extension() const;
589 inline Tagged<HeapObject> extension() const;
594
595 // Find the module context (assuming there is one) and return the associated
596 // module object.
598
599 // Get the context where var declarations will be hoisted to, which
600 // may be the context itself.
602 bool is_declaration_context() const;
603
604 // Get the next closure's context on the context chain.
606
607 // Returns a JSGlobalProxy object or null.
609
610 // Get the JSGlobalObject object.
612
613 // Get the script context by traversing the context chain.
615
616 // Compute the native context.
618 inline bool IsDetached() const;
619
620 // Predicates for context types. IsNativeContext is already defined on
621 // Object.
622 inline bool IsFunctionContext() const;
623 inline bool IsCatchContext() const;
624 inline bool IsWithContext() const;
625 inline bool IsDebugEvaluateContext() const;
626 inline bool IsAwaitContext() const;
627 inline bool IsBlockContext() const;
628 inline bool IsModuleContext() const;
629 inline bool IsEvalContext() const;
630 inline bool IsScriptContext() const;
631
632 inline bool HasSameSecurityTokenAs(Tagged<Context> that) const;
633
636
637#define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \
638 inline void set_##name(Tagged<UNPAREN(type)> value); \
639 inline bool is_##name(Tagged<UNPAREN(type)> value) const; \
640 inline Tagged<UNPAREN(type)> name() const; \
641 inline Tagged<UNPAREN(type)> name(AcquireLoadTag) const;
643#undef NATIVE_CONTEXT_FIELD_ACCESSORS
644
645 // Lookup the slot called name, starting with the current context.
646 // There are three possibilities:
647 //
648 // 1) result->IsContext():
649 // The binding was found in a context. *index is always the
650 // non-negative slot index. *attributes is NONE for var and let
651 // declarations, READ_ONLY for const declarations (never ABSENT).
652 //
653 // 2) result->IsJSObject():
654 // The binding was found as a named property in a context extension
655 // object (i.e., was introduced via eval), as a property on the subject
656 // of with, or as a property of the global object. *index is -1 and
657 // *attributes is not ABSENT.
658 //
659 // 3) result->IsModule():
660 // The binding was found in module imports or exports.
661 // *attributes is never ABSENT. imports are READ_ONLY.
662 //
663 // 4) result.is_null():
664 // There was no binding found, *index is always -1 and *attributes is
665 // always ABSENT.
666 static Handle<Object> Lookup(Handle<Context> context, Handle<String> name,
667 ContextLookupFlags flags, int* index,
668 PropertyAttributes* attributes,
669 InitializationFlag* init_flag,
670 VariableMode* variable_mode,
671 bool* is_sloppy_function_name = nullptr);
672
673 static inline int FunctionMapIndex(LanguageMode language_mode,
674 FunctionKind kind, bool has_shared_name);
675
676 static int ArrayMapIndex(ElementsKind elements_kind) {
677 DCHECK(IsFastElementsKind(elements_kind));
678 return int{elements_kind} + FIRST_JS_ARRAY_MAP_SLOT;
679 }
680
682
684 DirectHandle<Context> context, size_t index,
685 ContextSidePropertyCell::Property property, Isolate* isolate);
686
687 std::optional<ContextSidePropertyCell::Property> GetScriptContextSideProperty(
688 size_t index) const;
689
692 DirectHandle<Object> new_value, Isolate* isolate);
693
696 DirectHandle<Object> new_value, Isolate* isolate);
697
698 static const int kNotFound = -1;
699
700 // Dispatched behavior.
703
704 class BodyDescriptor;
705
706#ifdef VERIFY_HEAP
707 V8_EXPORT_PRIVATE void VerifyExtensionSlot(Tagged<HeapObject> extension);
708#endif
709
710 private:
711#ifdef DEBUG
712 // Bootstrapping-aware type checks.
713 static bool IsBootstrappingOrValidParentContext(Tagged<Object> object,
714 Tagged<Context> kid);
715#endif
716
717 friend class Factory;
718 inline void set_previous(Tagged<Context> context,
720
722};
723
724class NativeContext : public Context {
725 public:
726 // TODO(neis): Move some stuff from Context here.
727
728 // NativeContext fields are read concurrently from background threads; any
729 // concurrent writes of affected fields must have acquire-release semantics,
730 // thus we hide the non-atomic setter. Note this doesn't protect fully since
731 // one could still use Context::set and/or write directly using offsets (e.g.
732 // from CSA/Torque).
733 void set(int index, Tagged<Object> value, WriteBarrierMode mode) = delete;
734 V8_INLINE void set(int index, Tagged<Object> value, WriteBarrierMode mode,
736
737 // [microtask_queue]: pointer to the MicrotaskQueue object.
739
741 Tagged<ScriptContextTable> script_context_table);
743
744 // Caution, hack: this getter ignores the AcquireLoadTag. The global_object
745 // slot is safe to read concurrently since it is immutable after
746 // initialization. This function should *not* be used from anywhere other
747 // than heap-refs.cc.
748 // TODO(jgruber): Remove this function after NativeContextRef is actually
749 // never serialized and BROKER_NATIVE_CONTEXT_FIELDS is removed.
754
756 ElementsKind element_kind) const;
757
759 ElementsKind element_kind) const;
760
762
763 // Dispatched behavior.
766
767 // Layout description.
768#define NATIVE_CONTEXT_FIELDS_DEF(V) \
769 /* TODO(ishell): move definition of common context offsets to Context. */ \
770 V(kStartOfNativeContextFieldsOffset, \
771 (FIRST_WEAK_SLOT - MIN_CONTEXT_EXTENDED_SLOTS) * kTaggedSize) \
772 V(kEndOfStrongFieldsOffset, 0) \
773 V(kStartOfWeakFieldsOffset, \
774 (NATIVE_CONTEXT_SLOTS - FIRST_WEAK_SLOT) * kTaggedSize) \
775 V(kEndOfWeakFieldsOffset, 0) \
776 V(kEndOfNativeContextFieldsOffset, 0) \
777 V(kEndOfTaggedFieldsOffset, 0) \
778 /* Raw data. */ \
779 V(kMicrotaskQueueOffset, kSystemPointerSize) \
780 /* Total size. */ \
781 V(kSize, 0)
782
785#undef NATIVE_CONTEXT_FIELDS_DEF
786
787 class BodyDescriptor;
788
789 void ResetErrorsThrown();
791 int GetErrorsThrown();
792
793#ifdef V8_ENABLE_JAVASCRIPT_PROMISE_HOOKS
794 void RunPromiseHook(PromiseHookType type, DirectHandle<JSPromise> promise,
795 DirectHandle<Object> parent);
796#endif
797
798 private:
799 static_assert(OffsetOfElementAt(EMBEDDER_DATA_INDEX) ==
801
803};
804
805class ScriptContextTableShape final : public AllStatic {
806 public:
809 static constexpr RootIndex kMapRootIndex = RootIndex::kScriptContextTableMap;
810 static constexpr bool kLengthEqualsCapacity = false;
811
814 TaggedMember<NameToIndexHashTable> names_to_context_index_;
815 });
816};
817
818// A table of all script contexts. Every loaded top-level script with top-level
819// lexical declarations contributes its ScriptContext into this table.
821 : public TaggedArrayBase<ScriptContextTable, ScriptContextTableShape> {
823
824 public:
826
828 Isolate* isolate, int capacity,
830
831 inline int length(AcquireLoadTag) const;
832 inline void set_length(int value, ReleaseStoreTag);
833
835 inline void set_names_to_context_index(
838
839 inline Tagged<Context> get(int index) const;
840 inline Tagged<Context> get(int index, AcquireLoadTag) const;
841
842 // Lookup a variable `name` in a ScriptContextTable.
843 // If it returns true, the variable is found and `result` contains
844 // valid information about its location.
845 // If it returns false, `result` is untouched.
849
852 Isolate* isolate, Handle<ScriptContextTable> table,
853 DirectHandle<Context> script_context, bool ignore_duplicates);
854
857
858 class BodyDescriptor;
859};
860
862
863} // namespace internal
864} // namespace v8
865
867
868#endif // V8_OBJECTS_CONTEXTS_H_
Builtins::Kind kind
Definition builtins.cc:40
static Tagged< ContextSidePropertyCell > GetOrCreateContextSidePropertyCell(DirectHandle< Context > context, size_t index, ContextSidePropertyCell::Property property, Isolate *isolate)
Definition contexts.cc:483
bool IsModuleContext() const
std::optional< ContextSidePropertyCell::Property > GetScriptContextSideProperty(size_t index) const
Definition contexts.cc:506
bool IsDebugEvaluateContext() const
static Handle< Object > Lookup(Handle< Context > context, Handle< String > name, ContextLookupFlags flags, int *index, PropertyAttributes *attributes, InitializationFlag *init_flag, VariableMode *variable_mode, bool *is_sloppy_function_name=nullptr)
Definition contexts.cc:236
Tagged< Context > declaration_context() const
Definition contexts.cc:146
void Initialize(Isolate *isolate)
Definition contexts.cc:108
Tagged< Context > previous() const
static const int FIRST_FUNCTION_MAP_INDEX
Definition contexts.h:570
bool has_extension() const
bool IsWithContext() const
static const int kExtensionOffset
Definition contexts.h:500
static DirectHandle< Object > LoadScriptContextElement(DirectHandle< Context > script_context, int index, DirectHandle< Object > new_value, Isolate *isolate)
Definition contexts.cc:578
V8_INLINE void set(int index, Tagged< Object > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
V8_EXPORT_PRIVATE Tagged< JSGlobalObject > global_object() const
Definition contexts.cc:188
bool IsBlockContext() const
static const int FIRST_FIXED_TYPED_ARRAY_FUN_INDEX
Definition contexts.h:573
Tagged< Object > unchecked_previous() const
Tagged< Context > closure_context() const
Definition contexts.cc:154
static V8_INLINE constexpr int OffsetOfElementAt(int index)
Definition contexts.h:512
bool IsScriptContext() const
static const int FIRST_RAB_GSAB_TYPED_ARRAY_MAP_INDEX
Definition contexts.h:574
bool IsEvalContext() const
V8_EXPORT_PRIVATE void set_extension(Tagged< HeapObject > object, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Definition contexts.cc:831
bool IsCatchContext() const
static const int kInvalidContext
Definition contexts.h:578
static V8_INLINE constexpr int SizeFor(int length)
Definition contexts.h:503
bool is_declaration_context() const
Definition contexts.cc:134
void set_previous(Tagged< Context > context, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
Handle< Object > ErrorMessageForCodeGenerationFromStrings()
Definition contexts.cc:782
bool IsFunctionContext() const
DirectHandle< Object > ErrorMessageForWasmCodeGeneration()
Definition contexts.cc:790
static V8_INLINE constexpr int SlotOffset(int index)
Definition contexts.h:516
Tagged< Map > GetInitialJSArrayMap(ElementsKind kind) const
static const int kScopeInfoOffset
Definition contexts.h:491
static void StoreScriptContextAndUpdateSlotProperty(DirectHandle< Context > script_context, int index, DirectHandle< Object > new_value, Isolate *isolate)
Definition contexts.cc:586
Tagged< HeapObject > extension() const
static const int kTodoHeaderSize
Definition contexts.h:497
bool IsAwaitContext() const
static int ArrayMapIndex(ElementsKind elements_kind)
Definition contexts.h:676
bool IsDetached() const
Tagged< Object > next_context_link() const
static const int LAST_FUNCTION_MAP_INDEX
Definition contexts.h:571
static const int kNoContext
Definition contexts.h:577
Tagged< JSObject > extension_object() const
Definition contexts.cc:164
V8_EXPORT_PRIVATE Tagged< JSGlobalProxy > global_proxy() const
Definition contexts.cc:200
static const int kNotFound
Definition contexts.h:698
V8_INLINE Tagged< Object > get(int index) const
bool HasSameSecurityTokenAs(Tagged< Context > that) const
Tagged< JSReceiver > extension_receiver() const
Definition contexts.cc:174
Tagged< Context > script_context() const
Definition contexts.cc:192
static int FunctionMapIndex(LanguageMode language_mode, FunctionKind kind, bool has_shared_name)
static const int kExtendedHeaderSize
Definition contexts.h:566
static const int kPreviousOffset
Definition contexts.h:492
static const int kExtensionSize
Definition contexts.h:564
Tagged< NativeContext > native_context() const
Tagged< SourceTextModule > module() const
Definition contexts.cc:180
static const int kNativeContextEmbedderDataOffset
Tagged< ScriptContextTable > synchronized_script_context_table() const
Tagged< Map > TypedArrayElementsKindToCtorMap(ElementsKind element_kind) const
DEFINE_FIELD_OFFSET_CONSTANTS(Context::kExtendedHeaderSize, NATIVE_CONTEXT_FIELDS_DEF) class BodyDescriptor
Tagged< Map > TypedArrayElementsKindToRabGsabCtorMap(ElementsKind element_kind) const
OBJECT_CONSTRUCTORS(NativeContext, Context)
Tagged< JSGlobalObject > global_object(AcquireLoadTag)
Definition contexts.h:751
void set(int index, Tagged< Object > value, WriteBarrierMode mode)=delete
Tagged< JSGlobalObject > global_object()
Definition contexts.h:750
void synchronized_set_script_context_table(Tagged< ScriptContextTable > script_context_table)
bool HasTemplateLiteralObject(Tagged< JSArray > array)
Definition contexts.cc:778
V8_ARRAY_EXTRA_FIELDS({ TaggedMember< Smi > length_;TaggedMember< NameToIndexHashTable > names_to_context_index_;})
static constexpr bool kLengthEqualsCapacity
Definition contexts.h:810
static constexpr RootIndex kMapRootIndex
Definition contexts.h:809
Tagged< NameToIndexHashTable > names_to_context_index() const
void set_length(int value, ReleaseStoreTag)
static Handle< ScriptContextTable > New(Isolate *isolate, int capacity, AllocationType allocation=AllocationType::kYoung)
Definition contexts.cc:28
V8_WARN_UNUSED_RESULT static V8_EXPORT_PRIVATE Handle< ScriptContextTable > Add(Isolate *isolate, Handle< ScriptContextTable > table, DirectHandle< Context > script_context, bool ignore_duplicates)
Definition contexts.cc:76
Tagged< Context > get(int index) const
V8_WARN_UNUSED_RESULT V8_EXPORT_PRIVATE bool Lookup(DirectHandle< String > name, VariableLookupResult *result)
Definition contexts.cc:118
void set_names_to_context_index(Tagged< NameToIndexHashTable > value, WriteBarrierMode mode=UPDATE_WRITE_BARRIER)
#define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name)
#define NATIVE_CONTEXT_FIELDS(V)
Definition contexts.h:46
#define NATIVE_CONTEXT_SLOT(index, type, name)
Definition contexts.h:537
#define NATIVE_CONTEXT_FIELDS_DEF(V)
Definition contexts.h:768
MicrotaskQueue * microtask_queue
Definition execution.cc:77
ZoneVector< RpoNumber > & result
const int length_
Definition mul-fft.cc:473
constexpr int kTaggedSize
Definition globals.h:542
@ UPDATE_WRITE_BARRIER
Definition objects.h:55
bool IsFastElementsKind(ElementsKind kind)
const int kHeapObjectTag
Definition v8-internal.h:72
@ FOLLOW_CONTEXT_CHAIN
Definition contexts.h:30
@ DONT_FOLLOW_CHAINS
Definition contexts.h:33
@ FOLLOW_PROTOTYPE_CHAIN
Definition contexts.h:31
V8HeapCompressionSchemeImpl< MainCage > V8HeapCompressionScheme
Definition globals.h:1137
Local< T > Handle
PromiseHookType
Definition v8-promise.h:141
#define DECL_ACCESSORS(name,...)
#define DECL_EXTERNAL_POINTER_ACCESSORS(name, type)
#define DECL_VERIFIER(Name)
#define NEVER_READ_ONLY_SPACE
#define DECL_PRINTER(Name)
#define TQ_OBJECT_CONSTRUCTORS(Type)
#define DECL_RELAXED_INT_ACCESSORS(name)
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
#define V8_EXPORT_PRIVATE
Definition macros.h:460
#define V8_INLINE
Definition v8config.h:500
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671