GCLI extremely slow at predications when no matches

NEW
Unassigned

Status

()

Core
JavaScript Engine
P3
normal
6 months ago
3 months ago

People

(Reporter: Ekanan Ketunuti, Unassigned)

Tracking

55 Branch
x86
Windows 10
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 months ago
Steps to reproduce:

1. Shift+F2 to open the Dev Toolbar.
2. Type "pref set " (space after set).
3. Press up arrow ↑ key.
4. Press tab ↹ key.
5. Press backspace ⌫ twice.
6. Type 123.

It''ll slightly hang for 1 and delayed for 2 and 3.

Hang Report #1 (11 seconds)
js::LookupName(JSContext *,JS::Handle<js::PropertyName *>,JS::Handle<JSObject *>,JS::MutableHandle<JSObject *>,JS::MutableHandle<JSObject *>,JS::MutableHandle<JS::PropertyResult>) (in xul.pdb)
js::jit::IonGetNameIC::update(JSContext *,JS::Handle<JSScript *>,js::jit::IonGetNameIC *,JS::Handle<JSObject *>,JS::MutableHandle<JS::Value>) (in xul.pdb)
0xffffffff
0xffffffff
free_impl (in mozglue.pdb)
0xffffffff
0xffffffff
0xffffffff
js::jit::DoCompareFallback (in xul.pdb)
js::jit::IonCannon(JSContext *,js::RunState &) (in xul.pdb)
js::jit::IonCannon(JSContext *,js::RunState &) (in xul.pdb)
0xffffffff

Hang Report #2 (11 seconds)
with_LookupProperty (in xul.pdb)
js::LookupName(JSContext *,JS::Handle<js::PropertyName *>,JS::Handle<JSObject *>,JS::MutableHandle<JSObject *>,JS::MutableHandle<JSObject *>,JS::MutableHandle<JS::PropertyResult>) (in xul.pdb)
js::jit::IonGetNameIC::update(JSContext *,JS::Handle<JSScript *>,js::jit::IonGetNameIC *,JS::Handle<JSObject *>,JS::MutableHandle<JS::Value>) (in xul.pdb)
0xffffffff
0xffffffff
js::jit::AttachBaselineCacheIRStub(JSContext *,js::jit::CacheIRWriter const &,js::jit::CacheKind,js::jit::ICStubEngine,JSScript *,js::jit::ICFallbackStub *,bool *) (in xul.pdb)
js::TypeMonitorCall(JSContext *,JS::CallArgs const &,bool) (in xul.pdb)

Hang Report #3 (11 seconds)
js::NativeObject::getReservedSlot(unsigned int) (in xul.pdb)
with_LookupProperty (in xul.pdb)
js::LookupName(JSContext *,JS::Handle<js::PropertyName *>,JS::Handle<JSObject *>,JS::MutableHandle<JSObject *>,JS::MutableHandle<JSObject *>,JS::MutableHandle<JS::PropertyResult>) (in xul.pdb)
js::jit::IonGetNameIC::update(JSContext *,JS::Handle<JSScript *>,js::jit::IonGetNameIC *,JS::Handle<JSObject *>,JS::MutableHandle<JS::Value>) (in xul.pdb)
0xffffffff
0xffffffff
js::jit::AttachBaselineCacheIRStub(JSContext *,js::jit::CacheIRWriter const &,js::jit::CacheKind,js::jit::ICStubEngine,JSScript *,js::jit::ICFallbackStub *,bool *) (in xul.pdb)
JSScript::types() (in xul.pdb)
js::RunScript(JSContext *,js::RunState &) (in xul.pdb)
js::InternalCallOrConstruct(JSContext *,JS::CallArgs const &,js::MaybeConstruct) (in xul.pdb)
InternalCall (in xul.pdb)
js::jit::DoCallFallback (in xul.pdb)
0xffffffff
0xffffffff
0xffffffff
js::jit::EnterBaselineMethod(JSContext *,js::RunState &) (in xul.pdb)
Interpret (in xul.pdb)
js::RunScript(JSContext *,js::RunState &) (in xul.pdb)
js::InternalCallOrConstruct(JSContext *,JS::CallArgs const &,js::MaybeConstruct) (in xul.pdb)
InternalCall (in xul.pdb)
PromiseReactionJob (in xul.pdb)
js::InternalCallOrConstruct(JSContext *,JS::CallArgs const &,js::MaybeConstruct) (in xul.pdb)
js::Call(JSContext *,JS::Handle<JS::Value>,JS::Handle<JS::Value>,js::AnyInvokeArgs const &,JS::MutableHandle<JS::Value>) (in xul.pdb)
JS::Call(JSContext *,JS::Handle<JS::Value>,JS::Handle<JS::Value>,JS::HandleValueArray const &,JS::MutableHandle<JS::Value>) (in xul.pdb)
mozilla::PromiseJobRunnable::Run() (in xul.pdb)
mozilla::dom::Promise::PerformMicroTaskCheckpoint() (in xul.pdb)
XPCJSContext::AfterProcessTask(unsigned int) (in xul.pdb)
nsThread::ProcessNextEvent(bool,bool *) (in xul.pdb)
mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate *) (in xul.pdb)
MessageLoop::RunHandler() (in xul.pdb)
MessageLoop::Run() (in xul.pdb)
nsBaseAppShell::Run() (in xul.pdb)
nsAppShell::Run() (in xul.pdb)
nsAppStartup::Run() (in xul.pdb)
XREMain::XRE_mainRun() (in xul.pdb)
XREMain::XRE_main(int,char * * const,mozilla::BootstrapConfig const &) (in xul.pdb)
XRE_main(int,char * * const,mozilla::BootstrapConfig const &) (in xul.pdb)
mozilla::BootstrapImpl::XRE_main(int,char * * const,mozilla::BootstrapConfig const &) (in xul.pdb)
wmain (in firefox.pdb)
__scrt_common_main_seh (in firefox.pdb)
BaseThreadInitThunk (in kernel32.pdb)
__RtlUserThreadStart (in ntdll.pdb)
_RtlUserThreadStart (in ntdll.pdb)

Shu, I'm ni you as you wrote this code in bug 1263355. :)
Flags: needinfo?(shu)
(Reporter)

Updated

6 months ago
Duplicate of this bug: 1373080
When the GCLI autocompletion falls back to fuzzy mode we get extremely poor perf due to the use of non-syntactic environment lookups. The code is running in a non-syntactic WithEnvironment which uses a very slow path to include CheckUnscopables. 

GCLI should probably make sure names are concrete before calling the fuzzy lookup. Right now the fuzzy lookup constantly does expensive callbacks as it runs. It should take a snapshot at the beginning of the spell call.

Ion could do a better job, but GCLI should really be cleaned up in this case.

Profile: https://perfht.ml/2xaQv7l
Flags: needinfo?(shu)
Priority: -- → P3
Summary: slightly hang @ js::LookupName → GCLI extremely slow at predications when no matches
You need to log in before you can comment on or make changes to this bug.