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 5 #include "src/torque/global-context.h" 6 7 namespace v8 { 8 namespace internal { 9 namespace torque { 10 11 DEFINE_CONTEXTUAL_VARIABLE(GlobalContext) DEFINE_CONTEXTUAL_VARIABLE(TargetArchitecture)12DEFINE_CONTEXTUAL_VARIABLE(TargetArchitecture) 13 14 GlobalContext::GlobalContext(Ast ast) 15 : collect_language_server_data_(false), 16 collect_kythe_data_(false), 17 force_assert_statements_(false), 18 annotate_ir_(false), 19 ast_(std::move(ast)) { 20 CurrentScope::Scope current_scope(nullptr); 21 CurrentSourcePosition::Scope current_source_position( 22 SourcePosition{CurrentSourceFile::Get(), LineAndColumn::Invalid(), 23 LineAndColumn::Invalid()}); 24 default_namespace_ = 25 RegisterDeclarable(std::make_unique<Namespace>(kBaseNamespaceName)); 26 } 27 TargetArchitecture(bool force_32bit)28TargetArchitecture::TargetArchitecture(bool force_32bit) 29 : tagged_size_(force_32bit ? sizeof(int32_t) : kTaggedSize), 30 raw_ptr_size_(force_32bit ? sizeof(int32_t) : kSystemPointerSize), 31 smi_tag_and_shift_size_( 32 kSmiTagSize + (force_32bit ? SmiTagging<kApiInt32Size>::kSmiShiftSize 33 : kSmiShiftSize)), 34 external_ptr_size_(force_32bit ? sizeof(int32_t) : kExternalPointerSize) { 35 } 36 37 } // namespace torque 38 } // namespace internal 39 } // namespace v8 40