1. 02 Jan, 2013 1 commit
    • ggaren@apple.com's avatar
      Some renaming in the CodeCache · 446dffa4
      ggaren@apple.com authored
      Reviewed by Gavin Barraclough.
      CodeBlockKey => SourceCodeKey because the key is not a CodeBlock.
      m_recentlyUsedFunctionCode => m_recentlyUsedFunctions to match other names.
      GlobalFunctionKey => FunctionKey because the key is not unique to globalness.
      m_cachedGlobalFunctions => m_globalFunctions because "cached" is redundant
      for data members in an object called "CodeCache".
      kMaxRootCodeBlockEntries => kMaxRootEntries because there are no non-CodeBlock
      entries in a CodeBlock cache.
      kMaxFunctionCodeBlocks => kMaxChildFunctionEntries to clarify that this
      number models a parent-child relationship.
      Also removed the initial "k" from enum constants. That's an interesting
      style for calling out constants, but it's not the WebKit style.
      Finally, a behavior change: Use MaxRootEntries for the limit on global
      functions, and not MaxChildFunctionEntries. Previously, there was an
      unused constant that seemed to have been intended for this purpose.
      * runtime/CodeCache.cpp:
      * runtime/CodeCache.h:
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@138675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  2. 06 Dec, 2012 1 commit
  3. 30 Nov, 2012 1 commit
    • oliver@apple.com's avatar
      Add direct string->function code cache · 72b0c04c
      oliver@apple.com authored
      Reviewed by Michael Saboff.
      A fairly logically simple patch.  We now track the start of the
      unique portion of a functions body, and use that as our key for
      unlinked function code.  This allows us to cache identical code
      in different contexts, leading to a small but consistent improvement
      on the benchmarks we track.
      * bytecode/UnlinkedCodeBlock.cpp:
      * bytecode/UnlinkedCodeBlock.h:
      * parser/ASTBuilder.h:
      * parser/Nodes.cpp:
      * parser/Nodes.h:
      * parser/Parser.cpp:
      * parser/Parser.h:
      * parser/SyntaxChecker.h:
      * runtime/CodeCache.cpp:
      * runtime/CodeCache.h:
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@136261 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  4. 08 Nov, 2012 1 commit
    • oliver@apple.com's avatar
      Improve effectiveness of function-level caching · 27e0eed2
      oliver@apple.com authored
      Reviewed by Filip Pizlo.
      Added a random-eviction based cache for unlinked functions, and switch
      UnlinkedFunctionExecutable's code references to Weak<>, thereby letting
      us remove the explicit UnlinkedFunctionExecutable::clearCode() calls that
      were being triggered by GC.
      Refactored the random eviction part of the CodeCache into a separate data
      structure so that I didn't have to duplicate the code again, and then used
      that for the new function cache.
      * bytecode/UnlinkedCodeBlock.cpp:
      * bytecode/UnlinkedCodeBlock.h:
      * debugger/Debugger.cpp:
      * runtime/CodeCache.cpp:
      * runtime/Executable.cpp:
      * runtime/Executable.h:
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  5. 06 Nov, 2012 1 commit
    • oliver@apple.com's avatar
      Reduce parser overhead in JSC · f0c01b8e
      oliver@apple.com authored
      Reviewed by Filip Pizlo.
      An exciting journey into the world of architecture in which our hero
      adds yet another layer to JSC codegeneration.
      This patch adds a marginally more compact form of bytecode that is
      free from any data specific to a given execution context, and that
      does store any data structures necessary for execution.  To actually
      execute this UnlinkedBytecode we still need to instantiate a real
      CodeBlock, but this is a much faster linear time operation than any
      of the earlier parsing or code generation passes.
      As the unlinked code is context free we can then simply use a cache
      from source to unlinked code mapping to completely avoid all of the
      old parser overhead.  The cache is currently very simple and memory
      heavy, using the complete source text as a key (rather than SourceCode
      or equivalent), and a random eviction policy.
      This seems to produce a substantial win when loading identical content
      in different contexts.
      * API/tests/testapi.c:
      * CMakeLists.txt:
      * GNUmakefile.list.am:
      * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * bytecode/CodeBlock.cpp:
      * bytecode/CodeBlock.h:
          Moved a number of fields, and a bunch of logic to UnlinkedCodeBlock.h/cpp
      * bytecode/Opcode.h:
          Added a global const init no op instruction needed to get correct
          behaviour without any associated semantics.
      * bytecode/UnlinkedCodeBlock.cpp: Added.
      * bytecode/UnlinkedCodeBlock.h: Added.
          A fairly shallow, GC allocated version of the old CodeBlock
          classes with a 32bit instruction size, and just metadata
          size tracking.
      * bytecompiler/BytecodeGenerator.cpp:
      * bytecompiler/BytecodeGenerator.h:
          Replace direct access to m_symbolTable with access through
          symbolTable().  ProgramCode no longer has a symbol table at
          all so some previously unconditional (and pointless) uses
          of symbolTable get null checks.
          A few other changes to deal with type changes due to us generating
          unlinked code (eg. pointer free, so profile indices rather than
      * dfg/DFGByteCodeParser.cpp:
      * dfg/DFGCapabilities.h:
          Support global_init_nop
      * interpreter/Interpreter.cpp:
          Now get the ProgramExecutable to initialise new global properties
          before starting execution.
      * jit/JIT.cpp:
      * jit/JITDriver.h:
      * jit/JITStubs.cpp:
      * llint/LLIntData.cpp:
      * llint/LLIntSlowPaths.cpp:
      * llint/LowLevelInterpreter.asm:
      * llint/LowLevelInterpreter32_64.asm:
      * llint/LowLevelInterpreter64.asm:
          Adding init_global_const_nop everywhere else
      * parser/Parser.h:
      * parser/ParserModes.h: Added.
      * parser/ParserTokens.h:
          Parser no longer needs a global object or callframe to function
      * runtime/CodeCache.cpp: Added.
      * runtime/CodeCache.h: Added.
          A simple, random eviction, Source->UnlinkedCode cache
      * runtime/Executable.cpp:
      * runtime/Executable.h:
          Executables now reference their unlinked counterparts, and
          request code specifically for the target global object.
      * runtime/JSGlobalData.cpp:
      * runtime/JSGlobalData.h:
          GlobalData now owns a CodeCache and a set of new structures
          for the unlinked code types.
      * runtime/JSGlobalObject.cpp:
      * runtime/JSGlobalObject.h:
          Utility functions used by executables to perform compilation
      * runtime/JSType.h:
        Add new JSTypes for unlinked code
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@133688 268f45cc-cd09-0410-ab3c-d52691b4dbfc