Ignore:
Timestamp:
May 28, 2017, 1:12:09 AM (8 years ago)
Author:
[email protected]
Message:

Implement a faster Interpreter::getOpcodeID().
https://bugs.webkit.org/show_bug.cgi?id=172669

Reviewed by Saam Barati.

Source/JavaScriptCore:

We can implement Interpreter::getOpcodeID() without a hash table lookup by always
embedding the OpcodeID in the 32-bit word just before the start of the LLInt
handler code that executes each opcode. getOpcodeID() can therefore just read
the 32-bits before the opcode address to get its OpcodeID.

This is currently only enabled for CPU(X86), CPU(X86_64), CPU(ARM64),
CPU(ARM_THUMB2), and only for OS(DARWIN). It'll probably just work for linux as
well, but I'll let the Linux folks turn that on after they have verified that it
works on linux too.

I'll also take this opportunity to clean up how we initialize the opcodeIDTable:

  1. we only need to initialize it once per process, not once per VM / interpreter instance.
  2. we can initialize it in the Interpreter constructor instead of requiring a separate call to an initialize() function.

On debug builds, the Interpreter constructor will also verify that getOpcodeID()
is working correctly for each opcode when USE(LLINT_EMBEDDED_OPCODE_ID).

  • bytecode/BytecodeList.json:
  • generate-bytecode-files:
  • interpreter/Interpreter.cpp:

(JSC::Interpreter::Interpreter):
(JSC::Interpreter::opcodeIDTable):
(JSC::Interpreter::initialize): Deleted.

  • interpreter/Interpreter.h:

(JSC::Interpreter::getOpcode):
(JSC::Interpreter::getOpcodeID):

  • llint/LowLevelInterpreter.cpp:
  • runtime/VM.cpp:

(JSC::VM::VM):

Source/WTF:

Added the USE(LLINT_EMBEDDED_OPCODE_ID) configuration.

  • wtf/Platform.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/generate-bytecode-files

    r206533 r217526  
    11#! /usr/bin/python
    22
    3 # Copyright (C) 2014 Apple Inc. All rights reserved.
     3# Copyright (C) 2014-2017 Apple Inc. All rights reserved.
    44#
    55# Redistribution and use in source and binary forms, with or without
     
    202202            bytecodeHFile.write("#define NUMBER_OF_{0}_IDS {1}\n\n".format(section["macroNameComponent"], bytecodeNum))
    203203
     204        if bytecodeHFilename and section['emitOpcodeIDStringValuesInHFile']:
     205            bytecodeNum = 0
     206            for bytecode in section["bytecodes"]:
     207                bytecodeHFile.write("#define {0}_value_string \"{1}\"\n".format(bytecode["name"], bytecodeNum))
     208                firstMacro = False
     209                bytecodeNum = bytecodeNum + 1
     210
     211            bytecodeHFile.write("\n")           
     212
    204213        if initASMFileName and section['emitInASMFile']:
    205214            prefix = ""
Note: See TracChangeset for help on using the changeset viewer.