Closed Bug 1501129 Opened 10 months ago Closed 10 months ago

Searching for JSContext::enqueuePromiseJobCallback gives extraneous results

Categories

(Webtools :: Searchfox, defect)

defect
Not set

Tracking

(firefox65 fixed)

RESOLVED FIXED
Tracking Status
firefox65 --- fixed

People

(Reporter: jimb, Assigned: kats)

Details

Attachments

(3 files)

When searching mozilla-central fcfb479e, right-clicking on the definition of the field `JSContext::enqueuePromiseJobCallback` (at js/src/vm/JSContext.h:918) and choosing 'Search for field JSContext::enqueuePromiseJobCallback' gives me results including the unrelated fields 'JSContext::getIncumbentGlobalCallback' and 'JSContext::enqueuePromiseJobCallbackData'.
Attached image screenshot-field.png
Screenshot showing what I'm clicking on.
Attached image field-results.png
Results of the search described above.
Note that the search field contains:

    symbol:F_<T_JSContext>_64,F_<T_JSContext>_65

If I edit that to read, instead:

    symbol:F_<T_JSContext>_65

then I get the right search results.
Everything after the ifdef at https://searchfox.org/mozilla-central/rev/fcfb479e6ff63aea017d063faa17877ff750b4e5/js/src/vm/JSContext.h#625 suffers from the same problem. Looks like the field symbols are numbered differently on Linux vs Mac but then get merged.
If we change the getFieldIndex() at [1] to something that's more stable in the face of ifdefs, such as the mangled location, that should fix this.

[1] https://searchfox.org/mozilla-central/rev/fcfb479e6ff63aea017d063faa17877ff750b4e5/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp#401
Assignee: nobody → kats
In https://github.com/mozsearch/mozsearch/commit/94e792c3cee43cfc1064e9eaa1d896dc919c7434 the symbol for field decls was changed from `return std::string("F_") + decl->getQualifiedNameAsString();` to `return std::string("F_<") + GetMangledName(ctx, record) + ">_" + ToString(d2->getFieldIndex());` and it's not really clear why. Using the name instead of the index seems fine to me, and should avoid this problem. Using the name is superior to using the location because it should also handle cases like this:

#ifdef MACOSX
  MacType var = new MacType();
#else
  LinuxType var = new LinuxType();
#endif
  var.baz();

because in this case we want `var` to match both the declarations although they would have different locations and the same name.
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/23205c4744f0
Use field names instead of their index when mangling. r=mccr8
https://hg.mozilla.org/mozilla-central/rev/23205c4744f0
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
This is deployed now.
You need to log in before you can comment on or make changes to this bug.