Ignore:
Timestamp:
May 9, 2013, 1:03:23 PM (12 years ago)
Author:
[email protected]
Message:

Code cache stores bogus var references for functions in eval code
https://bugs.webkit.org/show_bug.cgi?id=115747

Reviewed by Mark Hahnenberg.

Source/JavaScriptCore:

Non-global eval now uses a per-CodeBlock cache, and only use it
when we're at the top of a function's scope. This means that we
will no longer cache the parsing of a single string across
multiple functions, and we won't cache when we're nested inside
constructs like |with| and |catch| where previously we would, which
is good because caching in those cases is unsound.

  • bytecode/EvalCodeCache.h:

(JSC):
(JSC::EvalCodeCache::getSlow):
(JSC::EvalCodeCache::get):

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::codeCacheForEval):
(UnlinkedCodeBlock):
(RareData):

  • debugger/Debugger.cpp:

(JSC::evaluateInGlobalCallFrame):

  • debugger/DebuggerCallFrame.cpp:

(JSC::DebuggerCallFrame::evaluate):

  • interpreter/Interpreter.cpp:

(JSC::eval):

  • runtime/CodeCache.cpp:

(JSC::CodeCache::CodeCache):
(JSC::CodeCache::generateBytecode):
(JSC):
(JSC::CodeCache::getCodeBlock):

  • runtime/CodeCache.h:

(JSC::CodeCacheMap::CodeCacheMap):
(CodeCacheMap):
(JSC::CodeCacheMap::canPruneQuickly):
(JSC::CodeCacheMap::prune):
(JSC::CodeCache::create):
(CodeCache):

  • runtime/Executable.cpp:

(JSC::EvalExecutable::EvalExecutable):
(JSC::EvalExecutable::compileInternal):

  • runtime/Executable.h:

(JSC::EvalExecutable::create):
(EvalExecutable):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::createEvalCodeBlock):

  • runtime/JSGlobalObject.h:

(JSGlobalObject):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncEval):

  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:

(VM):

LayoutTests:

Many tests

  • fast/js/eval-cache-scoped-lookup-expected.txt: Added.
  • fast/js/eval-cache-scoped-lookup.html: Added.
  • fast/js/script-tests/eval-cache-scoped-lookup.js: Added.

(first):
(a.string_appeared_here.second):
(third):
(fifth):
(sixth):
(seventh):
(eighth):
(nineth):
(tenth):
(eleventh):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r148696 r149836  
    621621}
    622622
    623 UnlinkedEvalCodeBlock* JSGlobalObject::createEvalCodeBlock(CallFrame* callFrame, JSScope* scope, EvalExecutable* executable, JSObject** exception)
     623UnlinkedEvalCodeBlock* JSGlobalObject::createEvalCodeBlock(CodeCache* cache, CallFrame* callFrame, JSScope* scope, EvalExecutable* executable, JSObject** exception)
    624624{
    625625    ParserError error;
     
    627627    DebuggerMode debuggerMode = hasDebugger() ? DebuggerOn : DebuggerOff;
    628628    ProfilerMode profilerMode = hasProfiler() ? ProfilerOn : ProfilerOff;
    629     UnlinkedEvalCodeBlock* unlinkedCode = vm().codeCache()->getEvalCodeBlock(vm(), scope, executable, executable->source(), strictness, debuggerMode, profilerMode, error);
     629    UnlinkedEvalCodeBlock* unlinkedCode = cache->getEvalCodeBlock(vm(), scope, executable, executable->source(), strictness, debuggerMode, profilerMode, error);
    630630
    631631    if (hasDebugger())
Note: See TracChangeset for help on using the changeset viewer.