Bug 95784
Summary: | BytecodeGenerator::resolve is unnecessarily pessimistic | ||
---|---|---|---|
Product: | WebKit | Reporter: | Oliver Hunt <oliver> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | fpizlo |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Oliver Hunt
Currently BytecodeGenerator::resolve does:
// Cases where we cannot statically optimize the lookup.
if (property == propertyNames().arguments || !canOptimizeNonLocals())
return ResolveResult::dynamicResolve(0);
ScopeChainIterator iter = m_scope->begin();
ScopeChainIterator end = m_scope->end();
size_t depth = 0;
size_t depthOfFirstScopeWithDynamicChecks = 0;
unsigned flags = 0;
It should be possible to make it:
// Cases where we cannot statically optimize the lookup.
if (property == propertyNames().arguments)
return ResolveResult::dynamicResolve(0);
ScopeChainIterator iter = m_scope->begin();
ScopeChainIterator end = m_scope->end();
size_t depth = 0;
size_t depthOfFirstScopeWithDynamicChecks = 0;
unsigned flags = canOptimizeNonLocals() ? 0 : ResolveResult::DynamicFlag;
The only thing of obvious concern is that resolve_dynamic (and related thingies) may not deal well with the idea that the top scope chain may itself need to be checked
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |