summaryrefslogtreecommitdiff
path: root/deps/v8/src/torque/global-context.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/torque/global-context.h')
-rw-r--r--deps/v8/src/torque/global-context.h24
1 files changed, 7 insertions, 17 deletions
diff --git a/deps/v8/src/torque/global-context.h b/deps/v8/src/torque/global-context.h
index eee1fe626e..4dc5534950 100644
--- a/deps/v8/src/torque/global-context.h
+++ b/deps/v8/src/torque/global-context.h
@@ -22,8 +22,10 @@ class TypeOracle;
class Module {
public:
- explicit Module(const std::string& name) : name_(name) {}
+ explicit Module(const std::string& name, bool is_default)
+ : name_(name), is_default_(is_default) {}
const std::string& name() const { return name_; }
+ bool IsDefault() const { return is_default_; }
std::ostream& source_stream() { return source_stream_; }
std::ostream& header_stream() { return header_stream_; }
std::string source() { return source_stream_.str(); }
@@ -31,17 +33,11 @@ class Module {
private:
std::string name_;
+ bool is_default_;
std::stringstream header_stream_;
std::stringstream source_stream_;
};
-class OperationHandler {
- public:
- std::string macro_name;
- ParameterTypes parameter_types;
- const Type* result_type;
-};
-
struct SourceFileContext {
std::string name;
std::unique_ptr<antlr4::ANTLRFileStream> stream;
@@ -56,16 +52,15 @@ class GlobalContext {
explicit GlobalContext(Ast ast)
: verbose_(false),
next_label_number_(0),
- type_oracle_(&declarations_),
- default_module_(GetModule("base")),
+ default_module_(GetModule("base", true)),
ast_(std::move(ast)) {}
Module* GetDefaultModule() { return default_module_; }
- Module* GetModule(const std::string& name) {
+ Module* GetModule(const std::string& name, bool is_default = false) {
auto i = modules_.find(name);
if (i != modules_.end()) {
return i->second.get();
}
- Module* module = new Module(name);
+ Module* module = new Module(name, is_default);
modules_[name] = std::unique_ptr<Module>(module);
return module;
}
@@ -104,16 +99,12 @@ class GlobalContext {
friend class CurrentCallableActivator;
friend class BreakContinueActivator;
- TypeOracle& GetTypeOracle() { return type_oracle_; }
-
Callable* GetCurrentCallable() const { return current_callable_; }
Label* GetCurrentBreak() const { return break_continue_stack_.back().first; }
Label* GetCurrentContinue() const {
return break_continue_stack_.back().second;
}
- std::map<std::string, std::vector<OperationHandler>> op_handlers_;
-
Declarations* declarations() { return &declarations_; }
Ast* ast() { return &ast_; }
@@ -123,7 +114,6 @@ class GlobalContext {
Declarations declarations_;
Callable* current_callable_;
std::vector<std::pair<Label*, Label*>> break_continue_stack_;
- TypeOracle type_oracle_;
std::map<std::string, std::unique_ptr<Module>> modules_;
Module* default_module_;
std::map<std::pair<const AstNode*, TypeVector>, std::set<const Variable*>>