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

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 2841613002: [compiler][modules] Constant-fold the loads of module cells. (Closed)
Patch Set: Rebase. Created 3 years, 8 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
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index b3f6af87b502cf0d60e530be4fe06d004c9682ba..0823b59b0739e802f1b89852b54a429bb38cd39c 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -1399,6 +1399,14 @@ Node* JSTypedLowering::BuildGetModuleCell(Node* node) {
int32_t cell_index = OpParameter<int32_t>(node);
Node* module = NodeProperties::GetValueInput(node, 0);
+ Type* module_type = NodeProperties::GetType(module);
+
+ if (module_type->IsHeapConstant()) {
+ Handle<Module> module_constant =
+ Handle<Module>::cast(module_type->AsHeapConstant()->Value());
+ Cell* cell_constant = module_constant->GetCell(cell_index);
Michael Starzinger 2017/05/03 17:28:16 nit: Let's just make the local variable handlified
neis 2017/05/04 10:36:21 Done.
+ return jsgraph()->HeapConstant(handle(cell_constant, isolate()));
+ }
FieldAccess field_access;
int index;
@@ -1412,6 +1420,7 @@ Node* JSTypedLowering::BuildGetModuleCell(Node* node) {
field_access = AccessBuilder::ForModuleRegularImports();
index = -cell_index - 1;
}
+
Node* array = effect = graph()->NewNode(simplified()->LoadField(field_access),
module, effect, control);
return graph()->NewNode(

Powered by Google App Engine
This is Rietveld 408576698