Changeset 223894 in webkit
- Timestamp:
- Oct 24, 2017 10:11:39 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r223834 r223894 1 2017-10-15 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [JSC] modules can be visited more than once when resolving bindings through "star" exports as long as the exportName is different each time 4 https://bugs.webkit.org/show_bug.cgi?id=178308 5 6 Reviewed by Mark Lam. 7 8 * test262.yaml: 9 1 10 2017-10-23 Yusuke Suzuki <utatane.tea@gmail.com> 2 11 -
trunk/JSTests/test262.yaml
r223724 r223894 85791 85791 cmd: prepareTest262Fixture 85792 85792 - path: test262/test/language/module-code/instn-iee-star-cycle.js 85793 cmd: runTest262 : fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]85793 cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module] 85794 85794 - path: test262/test/language/module-code/instn-iee-trlng-comma.js 85795 85795 cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module] … … 85893 85893 cmd: prepareTest262Fixture 85894 85894 - path: test262/test/language/module-code/instn-named-star-cycle.js 85895 cmd: runTest262 : fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]85895 cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module] 85896 85896 - path: test262/test/language/module-code/instn-once.js 85897 85897 cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module] … … 85999 85999 cmd: prepareTest262Fixture 86000 86000 - path: test262/test/language/module-code/instn-star-star-cycle.js 86001 cmd: runTest262 : fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module]86001 cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:module] 86002 86002 - path: test262/test/language/module-code/instn-uniq-env-rec-other_FIXTURE.js 86003 86003 cmd: prepareTest262Fixture -
trunk/Source/JavaScriptCore/ChangeLog
r223892 r223894 1 2017-10-15 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [JSC] modules can be visited more than once when resolving bindings through "star" exports as long as the exportName is different each time 4 https://bugs.webkit.org/show_bug.cgi?id=178308 5 6 Reviewed by Mark Lam. 7 8 With the change of the spec[1], we now do not need to remember star resolution modules. 9 We reflect this change to our implementation. Since this change is covered by test262, 10 this patch improves the score of test262. 11 12 We also add logging to ResolveExport to debug it easily. 13 14 [1]: https://github.com/tc39/ecma262/commit/a865e778ff0fc60e26e3e1c589635103710766a1 15 16 * runtime/AbstractModuleRecord.cpp: 17 (JSC::AbstractModuleRecord::ResolveQuery::dump const): 18 (JSC::AbstractModuleRecord::resolveExportImpl): 19 1 20 2017-10-24 Yusuke Suzuki <utatane.tea@gmail.com> 2 21 -
trunk/Source/JavaScriptCore/runtime/AbstractModuleRecord.cpp
r223331 r223894 36 36 37 37 namespace JSC { 38 namespace AbstractModuleRecordInternal { 39 static const bool verbose = false; 40 } // namespace AbstractModuleRecordInternal 38 41 39 42 const ClassInfo AbstractModuleRecord::s_info = { "AbstractModuleRecord", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(AbstractModuleRecord) }; … … 178 181 static const bool safeToCompareToEmptyOrDeleted = true; 179 182 }; 183 using HashTraits = WTF::CustomHashTraits<ResolveQuery>; 180 184 181 185 ResolveQuery(AbstractModuleRecord* moduleRecord, UniquedStringImpl* exportName) … … 212 216 } 213 217 218 void dump(PrintStream& out) const 219 { 220 if (!moduleRecord) { 221 out.print("<empty>"); 222 return; 223 } 224 out.print(moduleRecord->moduleKey(), " \"", exportName.get(), "\""); 225 } 226 214 227 // The module record is not marked from the GC. But these records are reachable from the JSGlobalObject. 215 228 // So we don't care the reachability to this record. … … 246 259 auto scope = DECLARE_THROW_SCOPE(vm); 247 260 248 // http://www.ecma-international.org/ecma-262/6.0/#sec-resolveexport 261 if (AbstractModuleRecordInternal::verbose) 262 dataLog("Resolving ", root, "\n"); 263 264 // https://tc39.github.io/ecma262/#sec-resolveexport 249 265 250 266 // How to avoid C++ recursion in this function: … … 481 497 // 5. Once we see star links, even if we have not yet traversed that star link path, we should disable caching. 482 498 483 typedef WTF::HashSet<ResolveQuery, ResolveQuery::Hash, WTF::CustomHashTraits<ResolveQuery>> ResolveSet;499 using ResolveSet = WTF::HashSet<ResolveQuery, ResolveQuery::Hash, ResolveQuery::HashTraits>; 484 500 enum class Type { Query, IndirectFallback, GatherStars }; 485 501 struct Task { … … 488 504 }; 489 505 506 auto typeString = [] (Type type) -> const char* { 507 switch (type) { 508 case Type::Query: 509 return "Query"; 510 case Type::IndirectFallback: 511 return "IndirectFallback"; 512 case Type::GatherStars: 513 return "GatherStars"; 514 } 515 RELEASE_ASSERT_NOT_REACHED(); 516 return nullptr; 517 }; 518 490 519 Vector<Task, 8> pendingTasks; 491 520 ResolveSet resolveSet; 492 HashSet<AbstractModuleRecord*> starSet;493 521 494 522 Vector<Resolution, 8> frames; … … 501 529 // It will enqueue the star resolution requests. Return "false" if the error occurs. 502 530 auto resolveNonLocal = [&](const ResolveQuery& query) -> bool { 503 // http ://www.ecma-international.org/ecma-262/6.0/#sec-resolveexport531 // https://tc39.github.io/ecma262/#sec-resolveexport 504 532 // section 15.2.1.16.3, step 6 505 533 // If the "default" name is not resolved in the current module, we need to throw an error and stop resolution immediately, … … 510 538 return false; 511 539 512 // step 7, If exportStarSet contains module, then return null.513 if (!starSet.add(query.moduleRecord).isNewEntry)514 return true;515 516 540 // Enqueue the task to gather the results of the stars. 517 541 // And append the new Resolution frame to gather the local result of the stars. … … 519 543 foundStarLinks = true; 520 544 frames.append(Resolution::notFound()); 521 522 545 523 546 // Enqueue the tasks in reverse order. … … 563 586 const Task task = pendingTasks.takeLast(); 564 587 const ResolveQuery& query = task.query; 588 589 if (AbstractModuleRecordInternal::verbose) 590 dataLog(" ", typeString(task.type), " ", task.query, "\n"); 565 591 566 592 switch (task.type) {
Note: See TracChangeset
for help on using the changeset viewer.