Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 3c0c7578760f4a0adb226d0ed5221c8e7231f9cd..087aad36936c0c2f4eb8ce9e2a1f3eb37dd5bd61 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1759,6 +1759,11 @@ Handle<Module> Factory::NewModule(Handle<SharedFunctionInfo> code) { |
requested_modules_length > 0 ? NewFixedArray(requested_modules_length) |
: empty_fixed_array(); |
+ // To make it easy to hash Modules, we set a new symbol as the name of |
+ // SharedFunctionInfo representing this Module. |
+ Handle<Symbol> name_symbol = NewSymbol(); |
+ code->set_name(*name_symbol); |
+ |
Handle<Module> module = Handle<Module>::cast(NewStruct(MODULE_TYPE)); |
module->set_code(*code); |
module->set_exports(*exports); |