1// Copyright 2019 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 5extern class ScopeInfo extends FixedArray; 6 7extern macro EmptyScopeInfoConstant(): ScopeInfo; 8const kEmptyScopeInfo: ScopeInfo = EmptyScopeInfoConstant(); 9 10const kScopeInfoFlagsIndex: 11 constexpr int32 generates 'ScopeInfo::Fields::kFlags'; 12 13operator '.flags' macro LoadScopeInfoFlags(implicit context: Context)( 14 scopeInfo: ScopeInfo): ScopeFlags { 15 return Convert<ScopeFlags>( 16 UnsafeCast<Smi>(scopeInfo.objects[kScopeInfoFlagsIndex])); 17} 18 19type ScopeType extends uint32 constexpr 'ScopeType'; 20type VariableAllocationInfo extends uint32 21constexpr 'VariableAllocationInfo'; 22 23// Properties of scopes. 24bitfield struct ScopeFlags extends uint32 { 25 scope_type: ScopeType: 4 bit; 26 sloppy_eval_can_extend_vars: bool: 1 bit; 27 language_mode: LanguageMode: 1 bit; 28 declaration_scope: bool: 1 bit; 29 receiver_variable: VariableAllocationInfo: 2 bit; 30 has_class_brand: bool: 1 bit; 31 has_saved_class_variable_index: bool: 1 bit; 32 has_new_target: bool: 1 bit; 33 // TODO(cbruni): Combine with function variable field when only storing the 34 // function name. 35 function_variable: VariableAllocationInfo: 2 bit; 36 has_inferred_function_name: bool: 1 bit; 37 is_asm_module: bool: 1 bit; 38 has_simple_parameters: bool: 1 bit; 39 function_kind: FunctionKind: 5 bit; 40 has_outer_scope_info: bool: 1 bit; 41 is_debug_evaluate_scope: bool: 1 bit; 42 force_context_allocation: bool: 1 bit; 43 private_name_lookup_skips_outer_class: bool: 1 bit; 44 has_context_extension_slot: bool: 1 bit; 45 is_repl_mode_scope: bool: 1 bit; 46 has_locals_block_list: bool: 1 bit; 47} 48