v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
declarable.h
Go to the documentation of this file.
1// Copyright 2017 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_TORQUE_DECLARABLE_H_
6#define V8_TORQUE_DECLARABLE_H_
7
8#include <cassert>
9#include <optional>
10#include <string>
11#include <unordered_map>
12
13#include "src/base/hashing.h"
14#include "src/base/logging.h"
15#include "src/torque/ast.h"
16#include "src/torque/types.h"
17#include "src/torque/utils.h"
18
19namespace v8::internal::torque {
20
21class Scope;
22class Namespace;
23class TypeArgumentInference;
24
26
28 std::vector<std::string> namespace_qualification;
29 std::string name;
30
31 QualifiedName(std::vector<std::string> namespace_qualification,
32 std::string name)
34 name(std::move(name)) {}
35 explicit QualifiedName(std::string name)
36 : QualifiedName({}, std::move(name)) {}
37
38 static QualifiedName Parse(std::string qualified_name);
39
41 return !namespace_qualification.empty();
42 }
43
45 return QualifiedName{
46 std::vector<std::string>(namespace_qualification.begin() + 1,
48 name};
49 }
50
51 friend std::ostream& operator<<(std::ostream& os, const QualifiedName& name);
52};
53
55 public:
56 virtual ~Declarable() = default;
71 Kind kind() const { return kind_; }
72 bool IsNamespace() const { return kind() == kNamespace; }
73 bool IsMacro() const { return IsTorqueMacro() || IsExternMacro(); }
74 bool IsTorqueMacro() const { return kind() == kTorqueMacro || IsMethod(); }
75 bool IsMethod() const { return kind() == kMethod; }
76 bool IsExternMacro() const { return kind() == kExternMacro; }
77 bool IsIntrinsic() const { return kind() == kIntrinsic; }
78 bool IsBuiltin() const { return kind() == kBuiltin; }
79 bool IsRuntimeFunction() const { return kind() == kRuntimeFunction; }
80 bool IsGenericCallable() const { return kind() == kGenericCallable; }
81 bool IsGenericType() const { return kind() == kGenericType; }
82 bool IsTypeAlias() const { return kind() == kTypeAlias; }
83 bool IsExternConstant() const { return kind() == kExternConstant; }
84 bool IsNamespaceConstant() const { return kind() == kNamespaceConstant; }
85 bool IsValue() const { return IsExternConstant() || IsNamespaceConstant(); }
86 bool IsScope() const { return IsNamespace() || IsCallable(); }
87 bool IsCallable() const {
88 return IsMacro() || IsBuiltin() || IsRuntimeFunction() || IsIntrinsic() ||
89 IsMethod();
90 }
91 virtual const char* type_name() const { return "<<unknown>>"; }
92 Scope* ParentScope() const { return parent_scope_; }
93
94 // The SourcePosition of the whole declarable. For example, for a macro
95 // this will encompass not only the signature, but also the body.
96 SourcePosition Position() const { return position_; }
98
99 // The SourcePosition of the identifying name of the declarable. For example,
100 // for a macro this will be the SourcePosition of the name.
101 // Note that this SourcePosition might not make sense for all kinds of
102 // declarables, in that case, the default SourcePosition is returned.
110
111 bool IsUserDefined() const { return is_user_defined_; }
112 void SetIsUserDefined(bool is_user_defined) {
113 is_user_defined_ = is_user_defined;
114 }
115
116 protected:
117 explicit Declarable(Kind kind) : kind_(kind) {}
118
119 private:
120 const Kind kind_;
121 Scope* const parent_scope_ = CurrentScope::Get();
122 SourcePosition position_ = CurrentSourcePosition::Get();
124 bool is_user_defined_ = true;
125};
126
127#define DECLARE_DECLARABLE_BOILERPLATE(x, y) \
128 static x* cast(Declarable* declarable) { \
129 DCHECK(declarable->Is##x()); \
130 return static_cast<x*>(declarable); \
131 } \
132 static const x* cast(const Declarable* declarable) { \
133 DCHECK(declarable->Is##x()); \
134 return static_cast<const x*>(declarable); \
135 } \
136 const char* type_name() const override { return #y; } \
137 static x* DynamicCast(Declarable* declarable) { \
138 if (!declarable) return nullptr; \
139 if (!declarable->Is##x()) return nullptr; \
140 return static_cast<x*>(declarable); \
141 } \
142 static const x* DynamicCast(const Declarable* declarable) { \
143 if (!declarable) return nullptr; \
144 if (!declarable->Is##x()) return nullptr; \
145 return static_cast<const x*>(declarable); \
146 }
147
148// Information about what code caused a specialization to exist. This is used
149// for error reporting.
151 // The position of the expression that caused this specialization.
153 // The Scope which contains the expression that caused this specialization.
154 // It may in turn also be within a specialization, which allows us to print
155 // the stack of requesters when an error occurs.
157 // The name of the specialization.
158 std::string name;
159
161 return {SourcePosition::Invalid(), nullptr, ""};
162 }
163
164 bool IsNone() const {
165 return position == SourcePosition::Invalid() && scope == nullptr &&
166 name == "";
167 }
169 std::string name);
170};
171
172class Scope : public Declarable {
173 public:
176
177 std::vector<Declarable*> LookupShallow(const QualifiedName& name) {
178 if (!name.HasNamespaceQualification()) return declarations_[name.name];
179 Scope* child = nullptr;
180 for (Declarable* declarable :
181 declarations_[name.namespace_qualification.front()]) {
182 if (Scope* scope = Scope::DynamicCast(declarable)) {
183 if (child != nullptr) {
184 ReportError("ambiguous reference to scope ",
185 name.namespace_qualification.front());
186 }
187 child = scope;
188 }
189 }
190 if (child == nullptr) return {};
191 return child->LookupShallow(name.DropFirstNamespaceQualification());
192 }
193
194 std::vector<Declarable*> Lookup(const QualifiedName& name);
195 template <class T>
196 T* AddDeclarable(const std::string& name, T* declarable) {
197 declarations_[name].push_back(declarable);
198 return declarable;
199 }
200
205 requester_ = requester;
206 }
207
208 private:
209 std::unordered_map<std::string, std::vector<Declarable*>> declarations_;
210
211 // If this Scope was created for specializing a generic type or callable,
212 // then {requester_} refers to the place that caused the specialization so we
213 // can construct useful error messages.
215};
216
217class Namespace : public Scope {
218 public:
220 explicit Namespace(const std::string& name)
221 : Scope(Declarable::kNamespace), name_(name) {}
222 const std::string& name() const { return name_; }
223 bool IsDefaultNamespace() const;
224 bool IsTestNamespace() const;
225
226 private:
227 std::string name_;
228};
229
231 Scope* scope = CurrentScope::Get();
232 while (true) {
233 if (Namespace* n = Namespace::DynamicCast(scope)) {
234 return n;
235 }
236 scope = scope->ParentScope();
237 }
238}
239
240class Value : public Declarable {
241 public:
243 const Identifier* name() const { return name_; }
244 virtual bool IsConst() const { return true; }
245 VisitResult value() const { return *value_; }
246 const Type* type() const { return type_; }
247
248 void set_value(VisitResult value) {
249 DCHECK(!value_);
250 value_ = value;
251 }
252
253 protected:
254 Value(Kind kind, const Type* type, Identifier* name)
255 : Declarable(kind), type_(type), name_(name) {}
256
257 private:
258 const Type* type_;
260 std::optional<VisitResult> value_;
261};
262
263class NamespaceConstant : public Value {
264 public:
266
267 const std::string& external_name() const { return external_name_; }
268 Expression* body() const { return body_; }
269
270 private:
271 friend class Declarations;
272 explicit NamespaceConstant(Identifier* constant_name,
273 std::string external_name, const Type* type,
275 : Value(Declarable::kNamespaceConstant, type, constant_name),
277 body_(body) {}
278
279 std::string external_name_;
281};
282
283class ExternConstant : public Value {
284 public:
286
287 private:
288 friend class Declarations;
289 explicit ExternConstant(Identifier* name, const Type* type, std::string value)
290 : Value(Declarable::kExternConstant, type, name) {
291 set_value(VisitResult(type, std::move(value)));
292 }
293};
294
295enum class OutputType {
296 kCSA,
297 kCC,
298 kCCDebug,
299};
300
301class Callable : public Scope {
302 public:
304 const std::string& ExternalName() const { return external_name_; }
305 const std::string& ReadableName() const { return readable_name_; }
306 const Signature& signature() const { return signature_; }
307 bool IsTransitioning() const { return signature().transitioning; }
310 }
311 bool HasReturnValue() const {
312 return !signature_.return_type->IsVoidOrNever();
313 }
315 bool HasReturns() const { return returns_; }
316 std::optional<Statement*> body() const { return body_; }
317 bool IsExternal() const { return !body_.has_value(); }
318 virtual bool ShouldBeInlined(OutputType output_type) const {
319 // C++ output doesn't support exiting to labels, so functions with labels in
320 // the signature must be inlined.
321 return output_type == OutputType::kCC && !signature().labels.empty();
322 }
323 bool ShouldGenerateExternalCode(OutputType output_type) const {
324 return !ShouldBeInlined(output_type);
325 }
326
327 static std::string PrefixNameForCCOutput(const std::string& name) {
328 // If a Torque macro requires a C++ runtime function to be generated, then
329 // the generated function begins with this prefix to avoid any naming
330 // collisions with the generated CSA function for the same macro.
331 return "TqRuntime" + name;
332 }
333
334 static std::string PrefixNameForCCDebugOutput(const std::string& name) {
335 // If a Torque macro requires a C++ runtime function to be generated, then
336 // the generated function begins with this prefix to avoid any naming
337 // collisions with the generated CSA function for the same macro.
338 return "TqDebug" + name;
339 }
340
341 // Name to use in runtime C++ code.
342 virtual std::string CCName() const {
344 }
345
346 // Name to use in debug C++ code.
347 virtual std::string CCDebugName() const {
349 }
350
351 protected:
352 Callable(Declarable::Kind kind, std::string external_name,
353 std::string readable_name, Signature signature,
354 std::optional<Statement*> body)
355 : Scope(kind),
356 external_name_(std::move(external_name)),
357
358 readable_name_(std::move(readable_name)),
359 signature_(std::move(signature)),
360 returns_(0),
361 body_(body) {
362 DCHECK(!body || *body);
363 }
364
365 private:
366 std::string external_name_;
367 std::string readable_name_;
369 size_t returns_;
370 std::optional<Statement*> body_;
371};
372
373class Macro : public Callable {
374 public:
376 bool ShouldBeInlined(OutputType output_type) const override {
377 for (const LabelDeclaration& label : signature().labels) {
378 for (const Type* type : label.types) {
379 if (type->StructSupertype()) return true;
380 }
381 }
382 // Intrinsics that are used internally in Torque and implemented as torque
383 // code should be inlined and not generate C++ definitions.
384 if (ReadableName()[0] == '%') return true;
385 return Callable::ShouldBeInlined(output_type);
386 }
387
388 void SetUsed() { used_ = true; }
389 bool IsUsed() const { return used_; }
390
391 protected:
392 Macro(Declarable::Kind kind, std::string external_name,
393 std::string readable_name, const Signature& signature,
394 std::optional<Statement*> body)
395 : Callable(kind, std::move(external_name), std::move(readable_name),
396 signature, body),
397 used_(false) {
398 if (signature.parameter_types.var_args) {
399 ReportError("Varargs are not supported for macros.");
400 }
401 }
402
403 private:
404 bool used_;
405};
406
407class ExternMacro : public Macro {
408 public:
410
411 const std::string& external_assembler_name() const {
413 }
414
415 std::string CCName() const override {
416 return "TorqueRuntimeMacroShims::" + external_assembler_name() +
417 "::" + ExternalName();
418 }
419
420 std::string CCDebugName() const override {
421 return "TorqueDebugMacroShims::" + external_assembler_name() +
422 "::" + ExternalName();
423 }
424
425 private:
426 friend class Declarations;
427 ExternMacro(const std::string& name, std::string external_assembler_name,
429 : Macro(Declarable::kExternMacro, name, name, std::move(signature),
430 std::nullopt),
432
434};
435
436class TorqueMacro : public Macro {
437 public:
440 std::string CCName() const override {
441 // Exported functions must have unique and C++-friendly readable names, so
442 // prefer those wherever possible.
444 : ExternalName());
445 }
446 std::string CCDebugName() const override {
447 // Exported functions must have unique and C++-friendly readable names, so
448 // prefer those wherever possible.
450 : ExternalName());
451 }
452
453 protected:
454 TorqueMacro(Declarable::Kind kind, std::string external_name,
455 std::string readable_name, const Signature& signature,
456 std::optional<Statement*> body, bool is_user_defined,
457 bool exported_to_csa)
458 : Macro(kind, std::move(external_name), std::move(readable_name),
459 signature, body),
460 exported_to_csa_(exported_to_csa) {
461 SetIsUserDefined(is_user_defined);
462 }
463
464 private:
465 friend class Declarations;
466 TorqueMacro(std::string external_name, std::string readable_name,
467 const Signature& signature, std::optional<Statement*> body,
468 bool is_user_defined, bool exported_to_csa)
469 : TorqueMacro(Declarable::kTorqueMacro, std::move(external_name),
470 std::move(readable_name), signature, body, is_user_defined,
471 exported_to_csa) {}
472
473 bool exported_to_csa_ = false;
474};
475
476class Method : public TorqueMacro {
477 public:
479 bool ShouldBeInlined(OutputType output_type) const override {
480 return Macro::ShouldBeInlined(output_type) ||
481 signature()
482 .parameter_types.types[signature().implicit_count]
483 ->IsStructType();
484 }
486
487 private:
488 friend class Declarations;
489 Method(AggregateType* aggregate_type, std::string external_name,
490 std::string readable_name, const Signature& signature, Statement* body)
491 : TorqueMacro(Declarable::kMethod, std::move(external_name),
492 std::move(readable_name), signature, body, true, false),
495};
496
497class Builtin : public Callable {
498 public:
500 enum class Flag { kNone = 0, kCustomInterfaceDescriptor = 1 << 0 };
503 Kind kind() const { return kind_; }
504 Flags flags() const { return flags_; }
505 std::optional<std::string> use_counter_name() const {
506 return use_counter_name_;
507 }
508 bool IsStub() const { return kind_ == kStub; }
509 bool IsVarArgsJavaScript() const { return kind_ == kVarArgsJavaScript; }
511 bool IsJavaScript() const {
513 }
517
518 private:
519 friend class Declarations;
520 Builtin(std::string external_name, std::string readable_name,
522 std::optional<std::string> use_counter_name,
523 std::optional<Statement*> body)
524 : Callable(Declarable::kBuiltin, std::move(external_name),
525 std::move(readable_name), signature, body),
526 kind_(kind),
527 flags_(flags),
529
532 std::optional<std::string> use_counter_name_;
533};
534
535class RuntimeFunction : public Callable {
536 public:
538
539 private:
540 friend class Declarations;
541 RuntimeFunction(const std::string& name, const Signature& signature)
543 std::nullopt) {}
544};
545
546class Intrinsic : public Callable {
547 public:
549
550 private:
551 friend class Declarations;
552 Intrinsic(std::string name, const Signature& signature)
553 : Callable(Declarable::kIntrinsic, name, name, signature, std::nullopt) {
554 if (signature.parameter_types.var_args) {
555 ReportError("Varargs are not supported for intrinsics.");
556 }
557 }
558};
559
561 public:
562 std::optional<std::string> IsViolated(const Type*) const;
563
564 static TypeConstraint Unconstrained() { return {}; }
570
571 private:
572 std::optional<const Type*> upper_bound;
573};
574
575std::optional<std::string> FindConstraintViolation(
576 const std::vector<const Type*>& types,
577 const std::vector<TypeConstraint>& constraints);
578
579std::vector<TypeConstraint> ComputeConstraints(
580 Scope* scope, const GenericParameters& parameters);
581
582template <class SpecializationType, class DeclarationType>
584 private:
585 using Map = std::unordered_map<TypeVector, SpecializationType,
587
588 public:
589 void AddSpecialization(const TypeVector& type_arguments,
590 SpecializationType specialization) {
591 DCHECK_EQ(0, specializations_.count(type_arguments));
592 if (auto violation =
593 FindConstraintViolation(type_arguments, Constraints())) {
594 Error(*violation).Throw();
595 }
596 specializations_[type_arguments] = specialization;
597 }
598 std::optional<SpecializationType> GetSpecialization(
599 const TypeVector& type_arguments) const {
600 auto it = specializations_.find(type_arguments);
601 if (it != specializations_.end()) return it->second;
602 return std::nullopt;
603 }
604
605 using iterator = typename Map::const_iterator;
606 iterator begin() const { return specializations_.begin(); }
607 iterator end() const { return specializations_.end(); }
608
609 const std::string& name() const { return name_; }
610 auto declaration() const { return generic_declaration_->declaration; }
612 return generic_declaration_->generic_parameters;
613 }
614
615 const std::vector<TypeConstraint>& Constraints() {
616 if (!constraints_)
618 return *constraints_;
619 }
620
621 protected:
622 GenericDeclarable(Declarable::Kind kind, const std::string& name,
623 DeclarationType generic_declaration)
624 : Declarable(kind),
625 name_(name),
626 generic_declaration_(generic_declaration) {
627 DCHECK(!generic_declaration->generic_parameters.empty());
628 }
629
630 private:
631 std::string name_;
632 DeclarationType generic_declaration_;
634 std::optional<std::vector<TypeConstraint>> constraints_;
635};
636
638 : public GenericDeclarable<Callable*, GenericCallableDeclaration*> {
639 public:
641
642 std::optional<Statement*> CallableBody();
643
645 const TypeVector& explicit_specialization_types,
646 const std::vector<std::optional<const Type*>>& arguments);
647
648 private:
649 friend class Declarations;
650 GenericCallable(const std::string& name,
651 GenericCallableDeclaration* generic_declaration)
653 Declarable::kGenericCallable, name, generic_declaration) {}
654};
655
657 : public GenericDeclarable<const Type*, GenericTypeDeclaration*> {
658 public:
660
661 private:
662 friend class Declarations;
663 GenericType(const std::string& name,
664 GenericTypeDeclaration* generic_declaration)
666 Declarable::kGenericType, name, generic_declaration) {}
667};
668
669class TypeAlias : public Declarable {
670 public:
672
673 const Type* type() const {
674 if (type_) return *type_;
675 return Resolve();
676 }
677 const Type* Resolve() const;
678 bool IsRedeclaration() const { return redeclaration_; }
682
683 private:
684 friend class Declarations;
685 friend class TypeVisitor;
686
687 explicit TypeAlias(
688 const Type* type, bool redeclaration,
689 SourcePosition declaration_position = SourcePosition::Invalid())
691 type_(type),
692 redeclaration_(redeclaration),
693 declaration_position_(declaration_position) {}
694 explicit TypeAlias(
695 TypeDeclaration* type, bool redeclaration,
696 SourcePosition declaration_position = SourcePosition::Invalid())
698 delayed_(type),
699 redeclaration_(redeclaration),
700 declaration_position_(declaration_position) {}
701
702 mutable bool being_resolved_ = false;
703 mutable std::optional<TypeDeclaration*> delayed_;
704 mutable std::optional<const Type*> type_;
707};
708
709std::ostream& operator<<(std::ostream& os, const Callable& m);
710std::ostream& operator<<(std::ostream& os, const Builtin& b);
711std::ostream& operator<<(std::ostream& os, const RuntimeFunction& b);
712std::ostream& operator<<(std::ostream& os, const GenericCallable& g);
713
714#undef DECLARE_DECLARABLE_BOILERPLATE
715
716} // namespace v8::internal::torque
717
718#endif // V8_TORQUE_DECLARABLE_H_
bool HasCustomInterfaceDescriptor() const
Definition declarable.h:514
std::optional< std::string > use_counter_name() const
Definition declarable.h:505
Builtin(std::string external_name, std::string readable_name, Builtin::Kind kind, Flags flags, const Signature &signature, std::optional< std::string > use_counter_name, std::optional< Statement * > body)
Definition declarable.h:520
std::optional< std::string > use_counter_name_
Definition declarable.h:532
virtual std::string CCDebugName() const
Definition declarable.h:347
std::optional< Statement * > body_
Definition declarable.h:370
virtual bool ShouldBeInlined(OutputType output_type) const
Definition declarable.h:318
Callable(Declarable::Kind kind, std::string external_name, std::string readable_name, Signature signature, std::optional< Statement * > body)
Definition declarable.h:352
const Signature & signature() const
Definition declarable.h:306
const NameVector & parameter_names() const
Definition declarable.h:308
const std::string & ExternalName() const
Definition declarable.h:304
static std::string PrefixNameForCCOutput(const std::string &name)
Definition declarable.h:327
bool ShouldGenerateExternalCode(OutputType output_type) const
Definition declarable.h:323
static std::string PrefixNameForCCDebugOutput(const std::string &name)
Definition declarable.h:334
const std::string & ReadableName() const
Definition declarable.h:305
std::optional< Statement * > body() const
Definition declarable.h:316
virtual std::string CCName() const
Definition declarable.h:342
SourcePosition IdentifierPosition() const
Definition declarable.h:103
void SetIdentifierPosition(const SourcePosition &position)
Definition declarable.h:107
void SetPosition(const SourcePosition &position)
Definition declarable.h:97
SourcePosition Position() const
Definition declarable.h:96
virtual const char * type_name() const
Definition declarable.h:91
void SetIsUserDefined(bool is_user_defined)
Definition declarable.h:112
ExternConstant(Identifier *name, const Type *type, std::string value)
Definition declarable.h:289
std::string CCName() const override
Definition declarable.h:415
ExternMacro(const std::string &name, std::string external_assembler_name, Signature signature)
Definition declarable.h:427
std::string CCDebugName() const override
Definition declarable.h:420
const std::string & external_assembler_name() const
Definition declarable.h:411
TypeArgumentInference InferSpecializationTypes(const TypeVector &explicit_specialization_types, const std::vector< std::optional< const Type * > > &arguments)
std::optional< Statement * > CallableBody()
GenericCallable(const std::string &name, GenericCallableDeclaration *generic_declaration)
Definition declarable.h:650
std::optional< std::vector< TypeConstraint > > constraints_
Definition declarable.h:634
void AddSpecialization(const TypeVector &type_arguments, SpecializationType specialization)
Definition declarable.h:589
const std::string & name() const
Definition declarable.h:609
GenericDeclarable(Declarable::Kind kind, const std::string &name, DeclarationType generic_declaration)
Definition declarable.h:622
std::unordered_map< TypeVector, SpecializationType, base::hash< TypeVector > > Map
Definition declarable.h:585
const std::vector< TypeConstraint > & Constraints()
Definition declarable.h:615
typename Map::const_iterator iterator
Definition declarable.h:605
std::optional< SpecializationType > GetSpecialization(const TypeVector &type_arguments) const
Definition declarable.h:598
const GenericParameters & generic_parameters() const
Definition declarable.h:611
GenericType(const std::string &name, GenericTypeDeclaration *generic_declaration)
Definition declarable.h:663
Intrinsic(std::string name, const Signature &signature)
Definition declarable.h:552
Macro(Declarable::Kind kind, std::string external_name, std::string readable_name, const Signature &signature, std::optional< Statement * > body)
Definition declarable.h:392
bool ShouldBeInlined(OutputType output_type) const override
Definition declarable.h:376
bool ShouldBeInlined(OutputType output_type) const override
Definition declarable.h:479
AggregateType * aggregate_type() const
Definition declarable.h:485
AggregateType * aggregate_type_
Definition declarable.h:494
Method(AggregateType *aggregate_type, std::string external_name, std::string readable_name, const Signature &signature, Statement *body)
Definition declarable.h:489
const std::string & external_name() const
Definition declarable.h:267
NamespaceConstant(Identifier *constant_name, std::string external_name, const Type *type, Expression *body)
Definition declarable.h:272
const std::string & name() const
Definition declarable.h:222
RuntimeFunction(const std::string &name, const Signature &signature)
Definition declarable.h:541
T * AddDeclarable(const std::string &name, T *declarable)
Definition declarable.h:196
std::unordered_map< std::string, std::vector< Declarable * > > declarations_
Definition declarable.h:209
std::vector< Declarable * > LookupShallow(const QualifiedName &name)
Definition declarable.h:177
const SpecializationRequester & GetSpecializationRequester() const
Definition declarable.h:201
void SetSpecializationRequester(const SpecializationRequester &requester)
Definition declarable.h:204
SpecializationRequester requester_
Definition declarable.h:214
std::vector< Declarable * > Lookup(const QualifiedName &name)
Definition declarable.cc:90
std::string CCDebugName() const override
Definition declarable.h:446
TorqueMacro(Declarable::Kind kind, std::string external_name, std::string readable_name, const Signature &signature, std::optional< Statement * > body, bool is_user_defined, bool exported_to_csa)
Definition declarable.h:454
std::string CCName() const override
Definition declarable.h:440
TorqueMacro(std::string external_name, std::string readable_name, const Signature &signature, std::optional< Statement * > body, bool is_user_defined, bool exported_to_csa)
Definition declarable.h:466
std::optional< TypeDeclaration * > delayed_
Definition declarable.h:703
TypeAlias(TypeDeclaration *type, bool redeclaration, SourcePosition declaration_position=SourcePosition::Invalid())
Definition declarable.h:694
const Type * Resolve() const
const SourcePosition declaration_position_
Definition declarable.h:706
TypeAlias(const Type *type, bool redeclaration, SourcePosition declaration_position=SourcePosition::Invalid())
Definition declarable.h:687
std::optional< const Type * > type_
Definition declarable.h:704
SourcePosition GetDeclarationPosition() const
Definition declarable.h:679
static TypeConstraint SubtypeConstraint(const Type *upper_bound)
Definition declarable.h:565
std::optional< const Type * > upper_bound
Definition declarable.h:572
static TypeConstraint Unconstrained()
Definition declarable.h:564
std::optional< std::string > IsViolated(const Type *) const
const Type * type() const
Definition declarable.h:246
std::optional< VisitResult > value_
Definition declarable.h:260
Value(Kind kind, const Type *type, Identifier *name)
Definition declarable.h:254
VisitResult value() const
Definition declarable.h:245
void set_value(VisitResult value)
Definition declarable.h:248
virtual bool IsConst() const
Definition declarable.h:244
#define DECLARE_CONTEXTUAL_VARIABLE(VarName,...)
Definition contextual.h:88
#define DECLARE_DECLARABLE_BOILERPLATE(x, y)
Definition declarable.h:127
Label label
ZoneVector< RpoNumber > & result
int position
Definition liveedit.cc:290
int m
Definition mul-fft.cc:294
int n
Definition mul-fft.cc:296
STL namespace.
std::ostream & operator<<(std::ostream &os, Identifier *id)
Definition ast.h:263
void ReportError(Args &&... args)
Definition utils.h:96
std::vector< GenericParameter > GenericParameters
Definition ast.h:1129
std::vector< Identifier * > NameVector
Definition types.h:906
std::vector< const Type * > TypeVector
Definition types.h:85
std::optional< std::string > FindConstraintViolation(const std::vector< const Type * > &types, const std::vector< TypeConstraint > &constraints)
Namespace * CurrentNamespace()
Definition declarable.h:230
std::vector< TypeConstraint > ComputeConstraints(Scope *scope, const GenericParameters &parameters)
MessageBuilder Error(Args &&... args)
Definition utils.h:81
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in name
Definition flags.cc:2086
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_EQ(v1, v2)
Definition logging.h:485
QualifiedName(std::vector< std::string > namespace_qualification, std::string name)
Definition declarable.h:31
friend std::ostream & operator<<(std::ostream &os, const QualifiedName &name)
Definition declarable.cc:30
std::vector< std::string > namespace_qualification
Definition declarable.h:28
QualifiedName DropFirstNamespaceQualification() const
Definition declarable.h:44
static QualifiedName Parse(std::string qualified_name)
Definition declarable.cc:18
SpecializationRequester(SourcePosition position, Scope *scope, std::string name)
Definition declarable.cc:81
static SpecializationRequester None()
Definition declarable.h:160