Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(899)

Unified Diff: src/parsing/parser.cc

Issue 2411873004: [ignition] Eliminate hole checks where statically possible for loads and stores (Closed)
Patch Set: Rebased Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/parser.h ('k') | test/cctest/interpreter/bytecode_expectations/BasicLoops.golden » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 18da7615f4557f94c76f35bd43f7e05c684a0985..9c76e20a261ffa54d0246164990873373bc7b00b 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -1154,8 +1154,7 @@ ZoneList<const Parser::NamedImport*>* Parser::ParseNamedImports(
return nullptr;
}
- DeclareVariable(local_name, CONST, kNeedsInitialization, position(),
- CHECK_OK);
+ DeclareModuleImport(local_name, position(), CHECK_OK);
NamedImport* import = new (zone()) NamedImport(
import_name, local_name, scanner()->location());
@@ -1205,8 +1204,7 @@ void Parser::ParseImportDeclaration(bool* ok) {
import_default_binding =
ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK_VOID);
import_default_binding_loc = scanner()->location();
- DeclareVariable(import_default_binding, CONST, kNeedsInitialization, pos,
- CHECK_OK_VOID);
+ DeclareModuleImport(import_default_binding, pos, CHECK_OK_VOID);
}
// Parse NameSpaceImport or NamedImports if present.
@@ -1481,6 +1479,21 @@ Declaration* Parser::DeclareVariable(const AstRawString* name,
return declaration;
}
+Declaration* Parser::DeclareModuleImport(const AstRawString* name, int pos,
+ bool* ok) {
+ DCHECK_EQ(MODULE_SCOPE, scope()->scope_type());
+ Declaration* decl =
+ DeclareVariable(name, CONST, kNeedsInitialization, pos, CHECK_OK);
+ // Allocate imports eagerly as hole check elimination logic in scope
+ // analisys depends on identifying imports.
+ // TODO(adamk): It's weird to allocate imports long before everything
+ // else. We should find a different way of filtering out imports
+ // during hole check elimination.
+ decl->proxy()->var()->AllocateTo(VariableLocation::MODULE,
+ Variable::kModuleImportIndex);
+ return decl;
+}
+
Variable* Parser::Declare(Declaration* declaration,
DeclarationDescriptor::Kind declaration_kind,
VariableMode mode, InitializationFlag init, bool* ok,
« no previous file with comments | « src/parsing/parser.h ('k') | test/cctest/interpreter/bytecode_expectations/BasicLoops.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698