• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)12 DEFINE_CONTEXTUAL_VARIABLE(TargetArchitecture)
13 
14 GlobalContext::GlobalContext(Ast ast)
15     : collect_language_server_data_(false),
16       force_assert_statements_(false),
17       ast_(std::move(ast)) {
18   CurrentScope::Scope current_scope(nullptr);
19   CurrentSourcePosition::Scope current_source_position(
20       SourcePosition{CurrentSourceFile::Get(), {-1, -1}, {-1, -1}});
21   default_namespace_ =
22       RegisterDeclarable(std::make_unique<Namespace>(kBaseNamespaceName));
23 }
24 
TargetArchitecture(bool force_32bit)25 TargetArchitecture::TargetArchitecture(bool force_32bit)
26     : tagged_size_(force_32bit ? sizeof(int32_t) : kTaggedSize),
27       raw_ptr_size_(force_32bit ? sizeof(int32_t) : kSystemPointerSize),
28       smi_tag_and_shift_size_(
29           kSmiTagSize + (force_32bit ? SmiTagging<kApiInt32Size>::kSmiShiftSize
30                                      : kSmiShiftSize)),
31       external_ptr_size_(force_32bit ? sizeof(int32_t) : kExternalPointerSize) {
32 }
33 
34 }  // namespace torque
35 }  // namespace internal
36 }  // namespace v8
37