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

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

Issue 2841613002: [compiler][modules] Constant-fold the loads of module cells. (Closed)
Patch Set: Address feedback. Created 3 years, 7 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/compiler/js-context-specialization.cc ('k') | src/compiler/node-properties.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..dc39828b09ffaa74b2276f9813b355e590f692a4 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());
+ Handle<Cell> cell_constant(module_constant->GetCell(cell_index), isolate());
+ return jsgraph()->HeapConstant(cell_constant);
+ }
FieldAccess field_access;
int index;
« no previous file with comments | « src/compiler/js-context-specialization.cc ('k') | src/compiler/node-properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698