⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 167094 in webkit


Ignore:
Timestamp:
Apr 10, 2014, 3:33:59 PM (12 years ago)
Author:
msaboff@apple.com
Message:

LLInt interpreter code should be generated as part of one function
https://bugs.webkit.org/show_bug.cgi?id=131205

Reviewed by Mark Lam.

Source/JavaScriptCore:

Changed the generation of llint opcodes so that they are all part of the same
global function, llint_entry. That function is used to fill in an entry point
table that includes each of the opcodes and helpers.

Added appropriate use of new -I option to offline assembler and offset
generator scripts.

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter.cpp:
  • llint/LowLevelInterpreter.h:
  • offlineasm/arm.rb:
  • offlineasm/arm64.rb:
  • offlineasm/asm.rb:
  • offlineasm/ast.rb:
  • offlineasm/backends.rb:
  • offlineasm/cloop.rb:
  • offlineasm/generate_offset_extractor.rb:
  • offlineasm/instructions.rb:
  • offlineasm/parser.rb:
  • offlineasm/registers.rb:
  • offlineasm/self_hash.rb:
  • offlineasm/settings.rb:
  • offlineasm/transform.rb:
  • offlineasm/x86.rb:

Added a new "global" keyword to the offline assembler that denotes a label that
should be exported. Added opcode and operand support to get the absolute
address of a local label using position independent calculations. Updated the
offline assembler to handle included files, both when generating the checksum
as well as including files from other than the local directory via a newly
added -I option. The offline assembler now automatically determines external
functions by keeping track of referenced functions that are defined within the
assembly source. This is used both for choosing the correct macro for external
references as well as generating the needed EXTERN directives for masm.
Updated the generation of the masm only .sym file to be written once at the end
of the offline assembler.

  • assembler/MacroAssemblerCodeRef.h:

(JSC::MacroAssemblerCodePtr::createLLIntCodePtr):
(JSC::MacroAssemblerCodeRef::createLLIntCodeRef):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::CodeBlock):

  • bytecode/GetByIdStatus.cpp:

(JSC::GetByIdStatus::computeFromLLInt):

  • bytecode/Opcode.h:

(JSC::padOpcodeName):

  • bytecode/PutByIdStatus.cpp:

(JSC::PutByIdStatus::computeFromLLInt):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):

  • jit/JITStubs.h:
  • llint/LLIntCLoop.cpp:

(JSC::LLInt::initialize):

  • llint/LLIntData.h:

(JSC::LLInt::getCodeFunctionPtr):
(JSC::LLInt::getOpcode): Deleted.
(JSC::LLInt::getCodePtr): Deleted.

  • llint/LLIntOpcode.h:
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • llint/LLIntThunks.cpp:

(JSC::LLInt::functionForCallEntryThunkGenerator):
(JSC::LLInt::functionForConstructEntryThunkGenerator):
(JSC::LLInt::functionForCallArityCheckThunkGenerator):
(JSC::LLInt::functionForConstructArityCheckThunkGenerator):
(JSC::LLInt::evalEntryThunkGenerator):
(JSC::LLInt::programEntryThunkGenerator):

  • llint/LLIntThunks.h:

Changed references to llint helpers to go through the entry point table populated
by llint_entry. Added helpers to OpcodeID enum for all builds.

  • bytecode/BytecodeList.json:
  • generate-bytecode-files:
  • llint/LLIntCLoop.cpp:

(JSC::LLInt::CLoop::initialize):
Reordered sections to match the order that the functions are added to the entry point
table. Added new "asmPrefix" property for symbols that have one name but are generated
with a prefix, e.g. op_enter -> llint_op_enter. Eliminated the "emitDefineID" property
as we are using enums for all bytecode references. Changed the C Loop only
llint_c_loop_init to llint_entry.

Source/WebKit:

Updated VS dependencies for JavaScriptCore changes.

  • WebKit.vcxproj/WebKit.sln:
Location:
trunk/Source
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r167020 r167094  
    605605        OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
    606606        MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb
    607         DEPENDS ${LLINT_ASM} ${OFFLINE_ASM}
    608         COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
     607        DEPENDS ${LLINT_ASM} ${OFFLINE_ASM} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm
     608        COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
    609609        VERBATIM)
    610610
     
    634634        MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb
    635635        DEPENDS LLIntOffsetsExtractor ${LLINT_ASM} ${OFFLINE_ASM} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm
    636         COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
     636        COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
    637637        COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
    638638        VERBATIM)
  • trunk/Source/JavaScriptCore/ChangeLog

    r167087 r167094  
     12014-04-10  Michael Saboff  <msaboff@apple.com>
     2
     3        LLInt interpreter code should be generated as part of one function
     4        https://bugs.webkit.org/show_bug.cgi?id=131205
     5
     6        Reviewed by Mark Lam.
     7
     8        Changed the generation of llint opcodes so that they are all part of the same
     9        global function, llint_entry.  That function is used to fill in an entry point
     10        table that includes each of the opcodes and helpers.
     11
     12        * CMakeLists.txt:
     13        * JavaScriptCore.vcxproj/LLInt/LLIntAssembly/build-LLIntAssembly.sh:
     14        * JavaScriptCore.vcxproj/LLInt/LLIntDesiredOffsets/build-LLIntDesiredOffsets.sh:
     15        * JavaScriptCore.xcodeproj/project.pbxproj:
     16        Added appropriate use of new -I option to offline assembler and offset
     17        generator scripts.
     18
     19        * llint/LowLevelInterpreter.asm:
     20        * llint/LowLevelInterpreter.cpp:
     21        * llint/LowLevelInterpreter.h:
     22        * offlineasm/arm.rb:
     23        * offlineasm/arm64.rb:
     24        * offlineasm/asm.rb:
     25        * offlineasm/ast.rb:
     26        * offlineasm/backends.rb:
     27        * offlineasm/cloop.rb:
     28        * offlineasm/generate_offset_extractor.rb:
     29        * offlineasm/instructions.rb:
     30        * offlineasm/parser.rb:
     31        * offlineasm/registers.rb:
     32        * offlineasm/self_hash.rb:
     33        * offlineasm/settings.rb:
     34        * offlineasm/transform.rb:
     35        * offlineasm/x86.rb:
     36        Added a new "global" keyword to the offline assembler that denotes a label that
     37        should be exported.  Added opcode and operand support to get the absolute
     38        address of a local label using position independent calculations.  Updated the
     39        offline assembler to handle included files, both when generating the checksum
     40        as well as including files from other than the local directory via a newly
     41        added -I option.  The offline assembler now automatically determines external
     42        functions by keeping track of referenced functions that are defined within the
     43        assembly source.  This is used both for choosing the correct macro for external
     44        references as well as generating the needed EXTERN directives for masm.
     45        Updated the generation of the masm only .sym file to be written once at the end
     46        of the offline assembler.
     47
     48        * assembler/MacroAssemblerCodeRef.h:
     49        (JSC::MacroAssemblerCodePtr::createLLIntCodePtr):
     50        (JSC::MacroAssemblerCodeRef::createLLIntCodeRef):
     51        * bytecode/CodeBlock.cpp:
     52        (JSC::CodeBlock::dumpBytecode):
     53        (JSC::CodeBlock::CodeBlock):
     54        * bytecode/GetByIdStatus.cpp:
     55        (JSC::GetByIdStatus::computeFromLLInt):
     56        * bytecode/Opcode.h:
     57        (JSC::padOpcodeName):
     58        * bytecode/PutByIdStatus.cpp:
     59        (JSC::PutByIdStatus::computeFromLLInt):
     60        * jit/JIT.cpp:
     61        (JSC::JIT::privateCompileMainPass):
     62        * jit/JITStubs.h:
     63        * llint/LLIntCLoop.cpp:
     64        (JSC::LLInt::initialize):
     65        * llint/LLIntData.h:
     66        (JSC::LLInt::getCodeFunctionPtr):
     67        (JSC::LLInt::getOpcode): Deleted.
     68        (JSC::LLInt::getCodePtr): Deleted.
     69        * llint/LLIntOpcode.h:
     70        * llint/LLIntSlowPaths.cpp:
     71        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
     72        * llint/LLIntThunks.cpp:
     73        (JSC::LLInt::functionForCallEntryThunkGenerator):
     74        (JSC::LLInt::functionForConstructEntryThunkGenerator):
     75        (JSC::LLInt::functionForCallArityCheckThunkGenerator):
     76        (JSC::LLInt::functionForConstructArityCheckThunkGenerator):
     77        (JSC::LLInt::evalEntryThunkGenerator):
     78        (JSC::LLInt::programEntryThunkGenerator):
     79        * llint/LLIntThunks.h:
     80        Changed references to llint helpers to go through the entry point table populated
     81        by llint_entry.  Added helpers to OpcodeID enum for all builds.
     82
     83        * bytecode/BytecodeList.json:
     84        * generate-bytecode-files:
     85        * llint/LLIntCLoop.cpp:
     86        (JSC::LLInt::CLoop::initialize):
     87        Reordered sections to match the order that the functions are added to the entry point
     88        table.  Added new "asmPrefix" property for symbols that have one name but are generated
     89        with a prefix, e.g. op_enter -> llint_op_enter.  Eliminated the "emitDefineID" property
     90        as we are using enums for all bytecode references.  Changed the C Loop only
     91        llint_c_loop_init to llint_entry.
     92
    1932014-04-10  Matthew Mirman  <mmirman@apple.com>
    294
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/LLInt/LLIntAssembly/build-LLIntAssembly.sh

    r165296 r167094  
    3535fi
    3636
    37 /usr/bin/env ruby "${SRCROOT}/offlineasm/asm.rb" "${SRCROOT}/llint/LowLevelInterpreter.asm" "${BUILT_PRODUCTS_DIR}/LLIntOffsetsExtractor/LLIntOffsetsExtractor${3}.exe" "${OUTPUTFILENAME}" || exit 1
     37/usr/bin/env ruby "${SRCROOT}/offlineasm/asm.rb" "-I." "${SRCROOT}/llint/LowLevelInterpreter.asm" "${BUILT_PRODUCTS_DIR}/LLIntOffsetsExtractor/LLIntOffsetsExtractor${3}.exe" "${OUTPUTFILENAME}" || exit 1
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/LLInt/LLIntDesiredOffsets/build-LLIntDesiredOffsets.sh

    r154513 r167094  
    2323mkdir -p "${BUILT_PRODUCTS_DIR}"
    2424
    25 /usr/bin/env ruby "${SRCROOT}/offlineasm/generate_offset_extractor.rb" "${SRCROOT}/llint/LowLevelInterpreter.asm" "${BUILT_PRODUCTS_DIR}/LLIntDesiredOffsets.h"
     25/usr/bin/env ruby "${SRCROOT}/offlineasm/generate_offset_extractor.rb" "-I${BUILT_PRODUCTS_DIR}" "${SRCROOT}/llint/LowLevelInterpreter.asm" "${BUILT_PRODUCTS_DIR}/LLIntDesiredOffsets.h"
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r167087 r167094  
    1414                                0F4680AA14BA7FD900BFE272 /* Generate Derived Sources */,
    1515                        );
     16                        dependencies = (
     17                                65442D5018EBB744007AF92F /* PBXTargetDependency */,
     18                        );
    1619                        name = "LLInt Offsets";
    1720                        productName = "Derived Sources";
     
    3740                        );
    3841                        dependencies = (
     42                                65244BD318ECB5000010B708 /* PBXTargetDependency */,
    3943                                65788A9E18B409EB00C189FF /* PBXTargetDependency */,
    4044                        );
     
    5054                        );
    5155                        dependencies = (
    52                                 65788AA918B40A3300C189FF /* PBXTargetDependency */,
    5356                        );
    5457                        name = "Derived Sources";
     
    18321835                        remoteInfo = "Test Tools";
    18331836                };
     1837                65244BD218ECB5000010B708 /* PBXContainerItemProxy */ = {
     1838                        isa = PBXContainerItemProxy;
     1839                        containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
     1840                        proxyType = 1;
     1841                        remoteGlobalIDString = 65FB3F6609D11E9100F49DEB;
     1842                        remoteInfo = "Derived Sources";
     1843                };
     1844                65442D4F18EBB744007AF92F /* PBXContainerItemProxy */ = {
     1845                        isa = PBXContainerItemProxy;
     1846                        containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
     1847                        proxyType = 1;
     1848                        remoteGlobalIDString = 65FB3F6609D11E9100F49DEB;
     1849                        remoteInfo = "Derived Sources";
     1850                };
    18341851                65788A9F18B409EB00C189FF /* PBXContainerItemProxy */ = {
    18351852                        isa = PBXContainerItemProxy;
     
    18381855                        remoteGlobalIDString = 0FF922C314F46B130041A24E;
    18391856                        remoteInfo = JSCLLIntOffsetsExtractor;
    1840                 };
    1841                 65788AA818B40A3300C189FF /* PBXContainerItemProxy */ = {
    1842                         isa = PBXContainerItemProxy;
    1843                         containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
    1844                         proxyType = 1;
    1845                         remoteGlobalIDString = 0F4680A914BA7FD900BFE272;
    1846                         remoteInfo = "LLInt Offsets";
    18471857                };
    18481858                65788AAA18B40A3B00C189FF /* PBXContainerItemProxy */ = {
     
    65286538                        runOnlyForDeploymentPostprocessing = 0;
    65296539                        shellPath = /bin/sh;
    6530                         shellScript = "set -e\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_offset_extractor.rb\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/LLIntDesiredOffsets.h\"\n";
     6540                        shellScript = "set -e\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/\"\n\n/usr/bin/env ruby \"${SRCROOT}/offlineasm/generate_offset_extractor.rb\" \"-I${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\" \"${SRCROOT}/llint/LowLevelInterpreter.asm\" \"${BUILT_PRODUCTS_DIR}/LLIntOffsets/LLIntDesiredOffsets.h\"\n";
    65316541                };
    65326542                0FCEFAD91806191800472CE4 /* Copy LLVM Library Into Framework */ = {
     
    67166726                        runOnlyForDeploymentPostprocessing = 0;
    67176727                        shellPath = /bin/sh;
    6718                         shellScript = "if [[ \"${ACTION}\" == \"installhdrs\" ]]; then\n    exit 0\nfi\n\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"\n\n/usr/bin/env ruby JavaScriptCore/offlineasm/asm.rb JavaScriptCore/llint/LowLevelInterpreter.asm ${BUILT_PRODUCTS_DIR}/JSCLLIntOffsetsExtractor LLIntAssembly.h || exit 1";
     6728                        shellScript = "if [[ \"${ACTION}\" == \"installhdrs\" ]]; then\n    exit 0\nfi\n\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore\"\n\n/usr/bin/env ruby JavaScriptCore/offlineasm/asm.rb -I${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore JavaScriptCore/llint/LowLevelInterpreter.asm ${BUILT_PRODUCTS_DIR}/JSCLLIntOffsetsExtractor LLIntAssembly.h || exit 1";
    67196729                };
    67206730                65FB3F6509D11E9100F49DEB /* Generate Derived Sources */ = {
     
    74297439                        targetProxy = 5D6B2A56152B9E2E005231DE /* PBXContainerItemProxy */;
    74307440                };
     7441                65244BD318ECB5000010B708 /* PBXTargetDependency */ = {
     7442                        isa = PBXTargetDependency;
     7443                        target = 65FB3F6609D11E9100F49DEB /* Derived Sources */;
     7444                        targetProxy = 65244BD218ECB5000010B708 /* PBXContainerItemProxy */;
     7445                };
     7446                65442D5018EBB744007AF92F /* PBXTargetDependency */ = {
     7447                        isa = PBXTargetDependency;
     7448                        target = 65FB3F6609D11E9100F49DEB /* Derived Sources */;
     7449                        targetProxy = 65442D4F18EBB744007AF92F /* PBXContainerItemProxy */;
     7450                };
    74317451                65788A9E18B409EB00C189FF /* PBXTargetDependency */ = {
    74327452                        isa = PBXTargetDependency;
    74337453                        target = 0FF922C314F46B130041A24E /* JSCLLIntOffsetsExtractor */;
    74347454                        targetProxy = 65788A9F18B409EB00C189FF /* PBXContainerItemProxy */;
    7435                 };
    7436                 65788AA918B40A3300C189FF /* PBXTargetDependency */ = {
    7437                         isa = PBXTargetDependency;
    7438                         target = 0F4680A914BA7FD900BFE272 /* LLInt Offsets */;
    7439                         targetProxy = 65788AA818B40A3300C189FF /* PBXContainerItemProxy */;
    74407455                };
    74417456                65788AAB18B40A3B00C189FF /* PBXTargetDependency */ = {
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h

    r163027 r167094  
    295295
    296296#if ENABLE(LLINT)
    297     static MacroAssemblerCodePtr createLLIntCodePtr(LLIntCode codeId)
     297    static MacroAssemblerCodePtr createLLIntCodePtr(OpcodeID codeId)
    298298    {
    299299        return createFromExecutableAddress(LLInt::getCodePtr(codeId));
     
    413413#if ENABLE(LLINT)
    414414    // Helper for creating self-managed code refs from LLInt.
    415     static MacroAssemblerCodeRef createLLIntCodeRef(LLIntCode codeId)
     415    static MacroAssemblerCodeRef createLLIntCodeRef(OpcodeID codeId)
    416416    {
    417417        return createSelfManagedCodeRef(MacroAssemblerCodePtr::createFromExecutableAddress(LLInt::getCodePtr(codeId)));
  • trunk/Source/JavaScriptCore/bytecode/BytecodeList.json

    r166418 r167094  
    11[
    22    {
    3         "section" : "Bytecodes", "emitInHFile" : true, "emitInASMFile" : true, "macroNameComponent" : "BYTECODE",
     3        "section" : "Bytecodes", "emitInHFile" : true, "emitInASMFile" : true,
     4        "macroNameComponent" : "BYTECODE", "asmPrefix" : "llint_",
    45        "bytecodes" : [
    56            { "name" : "op_enter", "length" : 1 },
     
    126127    },
    127128    {
     129        "section" : "CLoopHelpers", "emitInHFile" : true, "emitInASMFile" : false, "defaultLength" : 1,
     130        "macroNameComponent" : "CLOOP_BYTECODE_HELPER",
     131        "bytecodes" : [
     132            { "name" : "llint_entry" },
     133            { "name" : "getHostCallReturnValue" },
     134            { "name" : "llint_return_to_host" },
     135            { "name" : "llint_call_to_javascript" },
     136            { "name" : "llint_call_to_native_function" },
     137            { "name" : "llint_cloop_did_return_from_js_1" },
     138            { "name" : "llint_cloop_did_return_from_js_2" },
     139            { "name" : "llint_cloop_did_return_from_js_3" },
     140            { "name" : "llint_cloop_did_return_from_js_4" },
     141            { "name" : "llint_cloop_did_return_from_js_5" },
     142            { "name" : "llint_cloop_did_return_from_js_6" },
     143            { "name" : "llint_cloop_did_return_from_js_7" },
     144            { "name" : "llint_cloop_did_return_from_js_8" }
     145        ]
     146    },
     147    {
    128148        "section" : "NativeHelpers", "emitInHFile" : true, "emitInASMFile" : true, "defaultLength" : 1,
    129         "macroNameComponent" : "BYTECODE_HELPER", "emitDefineID" : true,
     149        "macroNameComponent" : "BYTECODE_HELPER",
    130150        "bytecodes" : [
    131151            { "name" : "llint_program_prologue" },
     
    139159            { "name" : "llint_throw_during_call_trampoline" },
    140160            { "name" : "llint_native_call_trampoline" },
    141             { "name" : "llint_native_construct_trampoline" }
    142         ]
    143     },
    144     {
    145         "section" : "CLoopHelpers", "emitInHFile" : true, "emitInASMFile" : false, "defaultLength" : 1,
    146         "macroNameComponent" : "CLOOP_BYTECODE_HELPER",
    147         "bytecodes" : [
    148             { "name" : "llint_c_loop_init" },
    149             { "name" : "getHostCallReturnValue" },
    150             { "name" : "llint_return_to_host" },
    151             { "name" : "llint_call_to_javascript" },
    152             { "name" : "llint_call_to_native_function" },
    153             { "name" : "handleUncaughtException" },
    154             { "name" : "llint_cloop_did_return_from_js_1" },
    155             { "name" : "llint_cloop_did_return_from_js_2" },
    156             { "name" : "llint_cloop_did_return_from_js_3" },
    157             { "name" : "llint_cloop_did_return_from_js_4" },
    158             { "name" : "llint_cloop_did_return_from_js_5" },
    159             { "name" : "llint_cloop_did_return_from_js_6" },
    160             { "name" : "llint_cloop_did_return_from_js_7" },
    161             { "name" : "llint_cloop_did_return_from_js_8" }
     161            { "name" : "llint_native_construct_trampoline" },
     162            { "name" : "handleUncaughtException" }
    162163        ]
    163164    }
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r166678 r167094  
    13691369            break;
    13701370        }
    1371 #if ENABLE(LLINT_C_LOOP)
    13721371        default:
    13731372            RELEASE_ASSERT_NOT_REACHED();
    1374 #endif
    13751373    }
    13761374
     
    15881586                m_rareData->m_exceptionHandlers[i].scopeDepth = nonLocalScopeDepth + handler.scopeDepth;
    15891587#if ENABLE(JIT) && ENABLE(LLINT)
    1590                 m_rareData->m_exceptionHandlers[i].nativeCode = CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(LLInt::getCodePtr(llint_op_catch)));
     1588                m_rareData->m_exceptionHandlers[i].nativeCode = CodeLocationLabel(MacroAssemblerCodePtr::createFromExecutableAddress(LLInt::getCodePtr(op_catch)));
    15911589#endif
    15921590            }
  • trunk/Source/JavaScriptCore/bytecode/GetByIdStatus.cpp

    r165459 r167094  
    6565    Instruction* instruction = profiledBlock->instructions().begin() + bytecodeIndex;
    6666   
    67     if (instruction[0].u.opcode == LLInt::getOpcode(llint_op_get_array_length))
     67    if (instruction[0].u.opcode == LLInt::getOpcode(op_get_array_length))
    6868        return GetByIdStatus(NoInformation, false);
    6969
  • trunk/Source/JavaScriptCore/bytecode/Opcode.h

    r165676 r167094  
    6161const int maxOpcodeLength = 9;
    6262#if ENABLE(LLINT_C_LOOP)
    63 const int numOpcodeIDs = NUMBER_OF_BYTECODE_IDS + NUMBER_OF_BYTECODE_HELPER_IDS + NUMBER_OF_CLOOP_BYTECODE_HELPER_IDS;
     63const int numOpcodeIDs = NUMBER_OF_BYTECODE_IDS + NUMBER_OF_CLOOP_BYTECODE_HELPER_IDS + NUMBER_OF_BYTECODE_HELPER_IDS;
    6464#else
    65 const int numOpcodeIDs = NUMBER_OF_BYTECODE_IDS;
     65const int numOpcodeIDs = NUMBER_OF_BYTECODE_IDS + NUMBER_OF_BYTECODE_HELPER_IDS;
    6666#endif
    6767
  • trunk/Source/JavaScriptCore/bytecode/PutByIdStatus.cpp

    r166945 r167094  
    7171        return PutByIdStatus(NoInformation);
    7272   
    73     if (instruction[0].u.opcode == LLInt::getOpcode(llint_op_put_by_id)
    74         || instruction[0].u.opcode == LLInt::getOpcode(llint_op_put_by_id_out_of_line)) {
     73    if (instruction[0].u.opcode == LLInt::getOpcode(op_put_by_id)
     74        || instruction[0].u.opcode == LLInt::getOpcode(op_put_by_id_out_of_line)) {
    7575        PropertyOffset offset = structure->getConcurrently(*profiledBlock->vm(), uid);
    7676        if (!isValidOffset(offset))
     
    8282    ASSERT(structure->transitionWatchpointSetHasBeenInvalidated());
    8383   
    84     ASSERT(instruction[0].u.opcode == LLInt::getOpcode(llint_op_put_by_id_transition_direct)
    85            || instruction[0].u.opcode == LLInt::getOpcode(llint_op_put_by_id_transition_normal)
    86            || instruction[0].u.opcode == LLInt::getOpcode(llint_op_put_by_id_transition_direct_out_of_line)
    87            || instruction[0].u.opcode == LLInt::getOpcode(llint_op_put_by_id_transition_normal_out_of_line));
     84    ASSERT(instruction[0].u.opcode == LLInt::getOpcode(op_put_by_id_transition_direct)
     85        || instruction[0].u.opcode == LLInt::getOpcode(op_put_by_id_transition_normal)
     86        || instruction[0].u.opcode == LLInt::getOpcode(op_put_by_id_transition_direct_out_of_line)
     87        || instruction[0].u.opcode == LLInt::getOpcode(op_put_by_id_transition_normal_out_of_line));
    8888   
    8989    Structure* newStructure = instruction[6].u.structure.get();
  • trunk/Source/JavaScriptCore/generate-bytecode-files

    r164814 r167094  
    213213            bytecodeHFile.write("#define NUMBER_OF_{0}_IDS {1}\n\n".format(section["macroNameComponent"], bytecodeNum))
    214214
    215             if "emitDefineID" in section:
    216                 bytecodeNum = 0
    217                 for bytecode in section["bytecodes"]:
    218                     bytecodeHFile.write("#define %s_ID %s\n" % (bytecode["name"].upper(), bytecodeNum))
    219                     bytecodeNum = bytecodeNum + 1
    220 
    221                 bytecodeHFile.write("\n\n")
    222 
    223215        if initASMFileName and section['emitInASMFile']:
     216            prefix = ""
     217            if "asmPrefix" in section:
     218                prefix = section["asmPrefix"]
    224219            for bytecode in section["bytecodes"]:
    225                 initBytecodesFile.write("setEntryAddress({0}, _{1})\n".format(initASMBytecodeNum, bytecode["name"]))
     220                initBytecodesFile.write("setEntryAddress({0}, _{1}{2})\n".format(initASMBytecodeNum, prefix, bytecode["name"]))
    226221                initASMBytecodeNum = initASMBytecodeNum + 1
    227222
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r166392 r167094  
    293293        DEFINE_OP(op_get_from_scope)
    294294        DEFINE_OP(op_put_to_scope)
     295        default:
     296            RELEASE_ASSERT_NOT_REACHED();
    295297        }
    296298    }
  • trunk/Source/JavaScriptCore/jit/JITStubs.h

    r165676 r167094  
    4444    EncodedJSValue callToJavaScript(void*, VM*, ProtoCallFrame*);
    4545    EncodedJSValue callToNativeFunction(void*, VM*, ProtoCallFrame*);
    46     void handleUncaughtException();
    4746}
    4847#endif
  • trunk/Source/JavaScriptCore/llint/LLIntCLoop.cpp

    r164814 r167094  
    3636void CLoop::initialize()
    3737{
    38     execute(llint_c_loop_init, 0, 0, 0, true);
     38    execute(llint_entry, 0, 0, 0, true);
    3939}
    4040
  • trunk/Source/JavaScriptCore/llint/LLIntData.cpp

    r164814 r167094  
    4141
    4242Instruction* Data::s_exceptionInstructions = 0;
    43 Opcode* Data::s_opcodeMap = 0;
     43Opcode Data::s_opcodeMap[numOpcodeIDs] = {0};
     44
     45#if !ENABLE(LLINT_C_LOOP)
     46extern "C" void llint_entry(void*);
     47#endif
    4448
    4549void initialize()
    4650{
    4751    Data::s_exceptionInstructions = new Instruction[maxOpcodeLength + 1];
    48     Data::s_opcodeMap = new Opcode[numOpcodeIDs];
    4952
    50     #if ENABLE(LLINT_C_LOOP)
     53#if ENABLE(LLINT_C_LOOP)
    5154    CLoop::initialize();
    5255
    53     #else // !ENABLE(LLINT_C_LOOP)
     56#else // !ENABLE(LLINT_C_LOOP)
     57    llint_entry(&Data::s_opcodeMap);
     58
    5459    for (int i = 0; i < maxOpcodeLength + 1; ++i)
    5560        Data::s_exceptionInstructions[i].u.pointer =
    5661            LLInt::getCodePtr(llint_throw_from_slow_path_trampoline);
    57     #define OPCODE_ENTRY(opcode, length) \
    58         Data::s_opcodeMap[opcode] = static_cast<Opcode>(LLInt::getCodePtr(llint_##opcode));
    59     FOR_EACH_CORE_OPCODE_ID(OPCODE_ENTRY);
    60     #undef OPCODE_ENTRY
    61     #endif // !ENABLE(LLINT_C_LOOP)
     62#endif // !ENABLE(LLINT_C_LOOP)
    6263}
    6364
  • trunk/Source/JavaScriptCore/llint/LLIntData.h

    r164424 r167094  
    5151private:
    5252    static Instruction* s_exceptionInstructions;
    53     static Opcode* s_opcodeMap;
     53    static Opcode s_opcodeMap[numOpcodeIDs];
    5454
    5555    friend void initialize();
     
    8787}
    8888
     89#if ENABLE(JIT)
     90ALWAYS_INLINE LLIntCode getCodeFunctionPtr(OpcodeID codeId)
     91{
     92    return reinterpret_cast<LLIntCode>(getCodePtr(codeId));
     93}
     94#endif
     95
    8996#else // !ENABLE(LLINT)
    9097
     
    105112#endif // !ENABLE(LLINT)
    106113
    107 ALWAYS_INLINE void* getOpcode(void llintOpcode())
    108 {
    109     return bitwise_cast<void*>(llintOpcode);
    110 }
    111 
    112 ALWAYS_INLINE void* getCodePtr(void glueHelper())
    113 {
    114     return bitwise_cast<void*>(glueHelper);
    115 }
    116 
    117114ALWAYS_INLINE void* getCodePtr(JSC::EncodedJSValue glueHelper())
    118115{
  • trunk/Source/JavaScriptCore/llint/LLIntOpcode.h

    r164814 r167094  
    4949
    5050
    51 #if ENABLE(LLINT_C_LOOP)
    5251#define FOR_EACH_LLINT_OPCODE_EXTENSION(macro) FOR_EACH_LLINT_NATIVE_HELPER(macro)
    53 #else
    54 #define FOR_EACH_LLINT_OPCODE_EXTENSION(macro) // Nothing to add.
    55 #endif
    5652
    5753#else // !ENABLE(LLINT)
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r166392 r167094  
    589589                vm, codeBlock->ownerExecutable(), structure);
    590590            if (isInlineOffset(slot.cachedOffset())) {
    591                 pc[0].u.opcode = LLInt::getOpcode(llint_op_get_by_id);
     591                pc[0].u.opcode = LLInt::getOpcode(op_get_by_id);
    592592                pc[5].u.operand = offsetInInlineStorage(slot.cachedOffset()) * sizeof(JSValue) + JSObject::offsetOfInlineStorage();
    593593            } else {
    594                 pc[0].u.opcode = LLInt::getOpcode(llint_op_get_by_id_out_of_line);
     594                pc[0].u.opcode = LLInt::getOpcode(op_get_by_id_out_of_line);
    595595                pc[5].u.operand = offsetInButterfly(slot.cachedOffset()) * sizeof(JSValue);
    596596            }
     
    601601        && isJSArray(baseValue)
    602602        && ident == exec->propertyNames().length) {
    603         pc[0].u.opcode = LLInt::getOpcode(llint_op_get_array_length);
     603        pc[0].u.opcode = LLInt::getOpcode(op_get_array_length);
    604604        ArrayProfile* arrayProfile = codeBlock->getOrAddArrayProfile(pc - codeBlock->instructions().begin());
    605605        arrayProfile->observeStructure(baseValue.asCell()->structure());
     
    654654                    // This is needed because some of the methods we call
    655655                    // below may GC.
    656                     pc[0].u.opcode = LLInt::getOpcode(llint_op_put_by_id);
     656                    pc[0].u.opcode = LLInt::getOpcode(op_put_by_id);
    657657
    658658                    if (normalizePrototypeChain(exec, baseCell) != InvalidPrototypeChain) {
     
    673673                        if (pc[8].u.operand) {
    674674                            if (isInlineOffset(slot.cachedOffset()))
    675                                 pc[0].u.opcode = LLInt::getOpcode(llint_op_put_by_id_transition_direct);
     675                                pc[0].u.opcode = LLInt::getOpcode(op_put_by_id_transition_direct);
    676676                            else
    677                                 pc[0].u.opcode = LLInt::getOpcode(llint_op_put_by_id_transition_direct_out_of_line);
     677                                pc[0].u.opcode = LLInt::getOpcode(op_put_by_id_transition_direct_out_of_line);
    678678                        } else {
    679679                            if (isInlineOffset(slot.cachedOffset()))
    680                                 pc[0].u.opcode = LLInt::getOpcode(llint_op_put_by_id_transition_normal);
     680                                pc[0].u.opcode = LLInt::getOpcode(op_put_by_id_transition_normal);
    681681                            else
    682                                 pc[0].u.opcode = LLInt::getOpcode(llint_op_put_by_id_transition_normal_out_of_line);
     682                                pc[0].u.opcode = LLInt::getOpcode(op_put_by_id_transition_normal_out_of_line);
    683683                        }
    684684                    }
     
    688688                    vm, codeBlock->ownerExecutable(), structure);
    689689                if (isInlineOffset(slot.cachedOffset())) {
    690                     pc[0].u.opcode = LLInt::getOpcode(llint_op_put_by_id);
     690                    pc[0].u.opcode = LLInt::getOpcode(op_put_by_id);
    691691                    pc[5].u.operand = offsetInInlineStorage(slot.cachedOffset()) * sizeof(JSValue) + JSObject::offsetOfInlineStorage();
    692692                } else {
    693                     pc[0].u.opcode = LLInt::getOpcode(llint_op_put_by_id_out_of_line);
     693                    pc[0].u.opcode = LLInt::getOpcode(op_put_by_id_out_of_line);
    694694                    pc[5].u.operand = offsetInButterfly(slot.cachedOffset()) * sizeof(JSValue);
    695695                }
  • trunk/Source/JavaScriptCore/llint/LLIntThunks.cpp

    r164217 r167094  
    6161MacroAssemblerCodeRef functionForCallEntryThunkGenerator(VM* vm)
    6262{
    63     return generateThunkWithJumpTo(vm, llint_function_for_call_prologue, "function for call");
     63    return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_call_prologue), "function for call");
    6464}
    6565
    6666MacroAssemblerCodeRef functionForConstructEntryThunkGenerator(VM* vm)
    6767{
    68     return generateThunkWithJumpTo(vm, llint_function_for_construct_prologue, "function for construct");
     68    return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_construct_prologue), "function for construct");
    6969}
    7070
    7171MacroAssemblerCodeRef functionForCallArityCheckThunkGenerator(VM* vm)
    7272{
    73     return generateThunkWithJumpTo(vm, llint_function_for_call_arity_check, "function for call with arity check");
     73    return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_call_arity_check), "function for call with arity check");
    7474}
    7575
    7676MacroAssemblerCodeRef functionForConstructArityCheckThunkGenerator(VM* vm)
    7777{
    78     return generateThunkWithJumpTo(vm, llint_function_for_construct_arity_check, "function for construct with arity check");
     78    return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_function_for_construct_arity_check), "function for construct with arity check");
    7979}
    8080
    8181MacroAssemblerCodeRef evalEntryThunkGenerator(VM* vm)
    8282{
    83     return generateThunkWithJumpTo(vm, llint_eval_prologue, "eval");
     83    return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_eval_prologue), "eval");
    8484}
    8585
    8686MacroAssemblerCodeRef programEntryThunkGenerator(VM* vm)
    8787{
    88     return generateThunkWithJumpTo(vm, llint_program_prologue, "program");
     88    return generateThunkWithJumpTo(vm, LLInt::getCodeFunctionPtr(llint_program_prologue), "program");
    8989}
    9090
  • trunk/Source/JavaScriptCore/llint/LLIntThunks.h

    r164424 r167094  
    3939    EncodedJSValue callToJavaScript(void*, VM*, ProtoCallFrame*);
    4040    EncodedJSValue callToNativeFunction(void*, VM*, ProtoCallFrame*);
    41 #if ENABLE(JIT)
    42     void handleUncaughtException();
    43 #endif
    4441}
    4542
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r167076 r167094  
    629629end
    630630
    631 # Dummy entry point the C Loop uses to initialize.
    632 if C_LOOP
    633 _llint_c_loop_init:
    634     crash()
    635 end
    636 
    637631# stub to call into JavaScript or Native functions
    638632# EncodedJSValue callToJavaScript(void* code, ExecState** vmTopCallFrame, ProtoCallFrame* protoFrame)
     
    642636_llint_call_to_javascript:
    643637else
     638global _callToJavaScript
    644639_callToJavaScript:
    645640end
     
    650645_llint_call_to_native_function:
    651646else
     647global _callToNativeFunction
    652648_callToNativeFunction:
    653649end
     
    658654else
    659655# void sanitizeStackForVMImpl(VM* vm)
     656global _sanitizeStackForVMImpl
    660657_sanitizeStackForVMImpl:
    661658    if X86_64
     
    692689end
    693690
     691
     692if C_LOOP
     693# Dummy entry point the C Loop uses to initialize.
     694_llint_entry:
     695    crash()
     696else
     697macro initPCRelative(pcBase)
     698    if X86_64
     699        call _relativePCBase
     700    _relativePCBase:
     701        pop pcBase
     702    elsif X86 or X86_WIN
     703        call _relativePCBase
     704    _relativePCBase:
     705        pop pcBase
     706        loadp 20[sp], t4
     707    elsif ARM64
     708    elsif ARMv7
     709    _relativePCBase:
     710        move pc, pcBase
     711        subp 3, pcBase   # Need to back up the PC and set the Thumb2 bit
     712    elsif ARM or ARMv7_TRADITIONAL
     713    _relativePCBase:
     714        move pc, pcBase
     715        subp 2, pcBase
     716    elsif MIPS
     717        crash()  # Need to replace with any initialization steps needed to step up PC relative address calculation
     718    elsif SH4
     719        crash()  # Need to replace with any initialization steps needed to step up PC relative address calculation
     720    end
     721end
     722
     723macro setEntryAddress(index, label)
     724    if X86_64
     725        leap (label - _relativePCBase)[t1], t0
     726        move index, t2
     727        storep t0, [t4, t2, 8]
     728    elsif X86 or X86_WIN
     729        leap (label - _relativePCBase)[t1], t0
     730        move index, t2
     731        storep t0, [t4, t2, 4]
     732    elsif ARM64
     733        pcrtoaddr label, t1
     734        move index, t2
     735        storep t1, [a0, t2, 8]
     736    elsif ARM or ARMv7 or ARMv7_TRADITIONAL
     737        move (label - _relativePCBase), t2
     738        addp t2, t1, t2
     739        move index, t3
     740        storep t2, [a0, t3, 4]
     741    elsif MIPS
     742        crash()  # Need to replace with code to turn label into and absolute address and save at index
     743    elsif SH4
     744        crash()  # Need to replace with code to turn label into and absolute address and save at index
     745    end
     746end
     747
     748global _llint_entry
     749# Entry point for the llint to initialize.
     750_llint_entry:
     751    functionPrologue()
     752    pushCalleeSaves
     753    initPCRelative(t1)
     754
     755    # Include generated bytecode initialization file.
     756    include InitBytecodes
     757
     758    popCalleeSaves
     759    functionEpilogue()
     760    ret
     761end
    694762
    695763_llint_program_prologue:
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.cpp

    r165320 r167094  
    106106#define OFFLINE_ASM_OPCODE_LABEL(opcode) DEFINE_OPCODE(opcode) USE_LABEL(opcode); TRACE_OPCODE(opcode);
    107107
     108#define OFFLINE_ASM_GLOBAL_LABEL(label)  OFFLINE_ASM_GLUE_LABEL(label)
     109
    108110#if ENABLE(COMPUTED_GOTO_OPCODES)
    109111#define OFFLINE_ASM_GLUE_LABEL(label)  label: USE_LABEL(label);
     
    496498#define OFFLINE_ASM_END     );
    497499
    498 #define OFFLINE_ASM_OPCODE_LABEL(__opcode) OFFLINE_ASM_GLOBAL_LABEL(llint_##__opcode)
    499 #define OFFLINE_ASM_GLUE_LABEL(__opcode)   OFFLINE_ASM_GLOBAL_LABEL(__opcode)
     500#define OFFLINE_ASM_OPCODE_LABEL(__opcode) OFFLINE_ASM_LOCAL_LABEL(llint_##__opcode)
     501#define OFFLINE_ASM_GLUE_LABEL(__opcode)   OFFLINE_ASM_LOCAL_LABEL(__opcode)
    500502
    501503#if CPU(ARM_THUMB2)
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.h

    r164424 r167094  
    4848} // namespace JSC
    4949
    50 #else // !ENABLE(LLINT_C_LOOP)
    51 
    52 #define LLINT_INSTRUCTION_DECL(opcode, length) extern "C" void llint_##opcode();
    53     FOR_EACH_OPCODE_ID(LLINT_INSTRUCTION_DECL);
    54 #undef LLINT_INSTRUCTION_DECL
    55 
    56 #define DECLARE_LLINT_NATIVE_HELPER(name, length) extern "C" void name();
    57     FOR_EACH_LLINT_NATIVE_HELPER(DECLARE_LLINT_NATIVE_HELPER)
    58 #undef DECLARE_LLINT_NATIVE_HELPER
    59 
    60 #endif // !ENABLE(LLINT_C_LOOP)
     50#endif // ENABLE(LLINT_C_LOOP)
    6151
    6252#endif // ENABLE(LLINT)
  • trunk/Source/JavaScriptCore/offlineasm/arm.rb

    r163881 r167094  
    7070def armMoveImmediate(value, register)
    7171    # Currently we only handle the simple cases, and fall back to mov/movt for the complex ones.
    72     if value >= 0 && value < 256
     72    if value.is_a? String
     73      $asm.puts "mov #{register.armOperand}, (#{value})"
     74    elsif value >= 0 && value < 256
    7375        $asm.puts "mov #{register.armOperand}, \##{value}"
    7476    elsif (~value) >= 0 && (~value) < 256
     
    107109        when "sp"
    108110            "sp"
     111        when "pc"
     112            "pc"
    109113        else
    110114            raise "Bad register #{name} for ARM at #{codeOriginString}"
  • trunk/Source/JavaScriptCore/offlineasm/arm64.rb

    r166166 r167094  
    821821        when "memfence"
    822822            $asm.puts "dmb sy"
     823        when "pcrtoaddr"
     824          $asm.puts "adr #{operands[1].arm64Operand(:ptr)}, #{operands[0].value}"
    823825        else
    824826            lowerDefault
  • trunk/Source/JavaScriptCore/offlineasm/asm.rb

    r164164 r167094  
    173173    end
    174174
    175     def putsLabel(labelName)
     175    def putsLabel(labelName, isGlobal)
    176176        raise unless @state == :asm
    177177        @numGlobalLabels += 1
    178         putsProcEndIfNeeded if $emitWinAsm
     178        putsProcEndIfNeeded if $emitWinAsm and isGlobal
    179179        putsNewlineSpacerIfAppropriate(:global)
    180180        @internalComment = $enableLabelCountComments ? "Global Label #{@numGlobalLabels}" : nil
    181         if /\Allint_op_/.match(labelName)
     181        if isGlobal
     182            if !$emitWinAsm
     183                @outp.puts(formatDump("OFFLINE_ASM_GLOBAL_LABEL(#{labelName})", lastComment))
     184            else
     185                putsProc(labelName, lastComment)
     186            end           
     187        elsif /\Allint_op_/.match(labelName)
    182188            if !$emitWinAsm
    183189                @outp.puts(formatDump("OFFLINE_ASM_OPCODE_LABEL(op_#{$~.post_match})", lastComment))
    184190            else
    185191                label = "llint_" + "op_#{$~.post_match}"
    186                 putsProc(label, lastComment)
    187             end
     192                @outp.puts(formatDump("  _#{label}:", lastComment))
     193            end           
    188194        else
    189195            if !$emitWinAsm
    190196                @outp.puts(formatDump("OFFLINE_ASM_GLUE_LABEL(#{labelName})", lastComment))
    191197            else
    192                 putsProc(labelName, lastComment)
     198                @outp.puts(formatDump("  _#{labelName}:", lastComment))
    193199            end
    194200        end
     
    207213        end
    208214    end
    209    
     215
     216    def self.externLabelReference(labelName)
     217        if !$emitWinAsm
     218            "\" LOCAL_REFERENCE(#{labelName}) \""
     219        else
     220            "#{labelName}"
     221        end
     222    end
     223
    210224    def self.labelReference(labelName)
    211225        if !$emitWinAsm
    212             "\" LOCAL_REFERENCE(#{labelName}) \""
    213         else
    214             "#{labelName}"
     226            "\" LOCAL_LABEL_STRING(#{labelName}) \""
     227        else
     228            "_#{labelName}"
    215229        end
    216230    end
     
    262276    end
    263277end
     278
     279IncludeFile.processIncludeOptions()
    264280
    265281asmFile = ARGV.shift
  • trunk/Source/JavaScriptCore/offlineasm/ast.rb

    r148474 r167094  
    230230    end
    231231   
     232    def immediateOperand?
     233        true
     234    end
     235       
    232236    def register?
    233237        false
     
    256260    end
    257261   
    258     def address?
    259         false
    260     end
    261    
    262     def label?
    263         false
    264     end
    265    
    266     def immediate?
     262    def value
     263        "#{left.value} + #{right.value}"
     264    end
     265   
     266    def address?
     267        false
     268    end
     269   
     270    def label?
     271        false
     272    end
     273   
     274    def immediate?
     275        true
     276    end
     277   
     278    def immediateOperand?
    267279        true
    268280    end
     
    294306    end
    295307   
    296     def address?
    297         false
    298     end
    299    
    300     def label?
    301         false
    302     end
    303    
    304     def immediate?
     308    def value
     309        "#{left.value} - #{right.value}"
     310    end
     311   
     312    def address?
     313        false
     314    end
     315   
     316    def label?
     317        false
     318    end
     319   
     320    def immediate?
     321        true
     322    end
     323   
     324    def immediateOperand?
    305325        true
    306326    end
     
    344364    end
    345365   
     366    def immediateOperand?
     367        false
     368    end
     369   
    346370    def register?
    347371        false
     
    381405    end
    382406   
     407    def immediateOperand?
     408        false
     409    end
     410   
    383411    def register?
    384412        false
     
    419447    end
    420448   
     449    def immediateOperand?
     450        false
     451    end
     452   
    421453    def register?
    422454        false
     
    457489    end
    458490   
     491    def immediateOperand?
     492        false
     493    end
     494   
    459495    def register?
    460496        false
     
    495531    end
    496532   
     533    def immediateOperand?
     534        false
     535    end
     536   
    497537    def register?
    498538        false
     
    530570    def immediate?
    531571        true
     572    end
     573   
     574    def immediateOperand?
     575        false
    532576    end
    533577   
     
    608652    end
    609653   
     654    def immediateOperand?
     655        false
     656    end
     657   
    610658    def register?
    611659        true
     
    627675   
    628676    def immediate?
     677        false
     678    end
     679   
     680    def immediateOperand?
    629681        false
    630682    end
     
    698750    def immediate?
    699751        false
     752    end
     753   
     754    def immediateOperand?
     755        true
    700756    end
    701757   
     
    760816    end
    761817   
     818    def immediateOperand?
     819        false
     820    end
     821   
    762822    def register?
    763823        false
     
    791851    def immediate?
    792852        false
     853    end
     854   
     855    def immediateOperand?
     856        true
    793857    end
    794858   
     
    865929
    866930$labelMapping = {}
     931$referencedExternLabels = Array.new
    867932
    868933class Label < NoChildren
     
    872937        super(codeOrigin)
    873938        @name = name
    874     end
    875    
    876     def self.forName(codeOrigin, name)
     939        @extern = true
     940        @global = false
     941    end
     942   
     943    def self.forName(codeOrigin, name, definedInFile = false)
    877944        if $labelMapping[name]
    878945            raise "Label name collision: #{name}" unless $labelMapping[name].is_a? Label
     
    880947            $labelMapping[name] = Label.new(codeOrigin, name)
    881948        end
     949        if definedInFile
     950            $labelMapping[name].clearExtern()
     951        end
    882952        $labelMapping[name]
    883953    end
    884    
     954
     955    def self.setAsGlobal(codeOrigin, name)
     956        if $labelMapping[name]
     957            label = $labelMapping[name]
     958            raise "Label: #{name} declared global multiple times" unless not label.global?
     959            label.setGlobal()
     960        else
     961            newLabel = Label.new(codeOrigin, name)
     962            newLabel.setGlobal()
     963            $labelMapping[name] = newLabel
     964        end
     965    end
     966
     967    def self.resetReferenced
     968        $referencedExternLabels = Array.new
     969    end
     970
     971    def self.forReferencedExtern()
     972        $referencedExternLabels.each {
     973            | label |
     974            yield "#{label.name}"
     975        }
     976    end
     977
     978    def clearExtern
     979        @extern = false
     980    end
     981
     982    def extern?
     983        @extern
     984    end
     985
     986    def setGlobal
     987        @global = true
     988    end
     989
     990    def global?
     991        @global
     992    end
     993
    885994    def dump
    886995        "#{name}:"
     
    9501059    end
    9511060   
     1061    def extern?
     1062        $labelMapping[name].is_a? Label and $labelMapping[name].extern?
     1063    end
     1064
     1065    def used
     1066        if !$referencedExternLabels.include?(@label) and extern?
     1067            $referencedExternLabels.push(@label)
     1068        end
     1069    end
     1070
    9521071    def dump
    9531072        label.name
    9541073    end
    9551074   
    956     def address?
    957         false
    958     end
    959    
    960     def label?
    961         true
    962     end
    963    
    964     def immediate?
    965         false
     1075    def value
     1076        asmLabel()
     1077    end
     1078
     1079    def address?
     1080        false
     1081    end
     1082   
     1083    def label?
     1084        true
     1085    end
     1086   
     1087    def immediate?
     1088        false
     1089    end
     1090   
     1091    def immediateOperand?
     1092        true
    9661093    end
    9671094end
     
    9901117        label.name
    9911118    end
    992    
    993     def address?
    994         false
    995     end
    996    
    997     def label?
    998         true
    999     end
    1000    
    1001     def immediate?
    1002         false
     1119
     1120    def value
     1121        asmLabel()
     1122    end
     1123   
     1124    def address?
     1125        false
     1126    end
     1127   
     1128    def label?
     1129        true
     1130    end
     1131   
     1132    def immediate?
     1133        false
     1134    end
     1135   
     1136    def immediateOperand?
     1137        true
    10031138    end
    10041139end
  • trunk/Source/JavaScriptCore/offlineasm/backends.rb

    r164374 r167094  
    8282class Label
    8383    def lower(name)
    84         $asm.putsLabel(self.name[1..-1])
     84        $asm.putsLabel(self.name[1..-1], @global)
    8585    end
    8686end
     
    9494class LabelReference
    9595    def asmLabel
    96         Assembler.labelReference(name[1..-1])
     96        if extern?
     97            Assembler.externLabelReference(name[1..-1])
     98        else
     99            Assembler.labelReference(name[1..-1])
     100        end
    97101    end
     102
    98103    def cLabel
    99104        Assembler.cLabelReference(name[1..-1])
     
    105110        Assembler.localLabelReference("_offlineasm_"+name[1..-1])
    106111    end
     112
    107113    def cLabel
    108114        Assembler.cLocalLabelReference("_offlineasm_"+name[1..-1])
  • trunk/Source/JavaScriptCore/offlineasm/cloop.rb

    r165213 r167094  
    11251125            $asm.putc "opcode = #{operands[0].clValue(:opcode)};"
    11261126            $asm.putc "DISPATCH_OPCODE();"
    1127             $asm.putsLabel("llint_cloop_did_return_from_js_#{@@didReturnFromJSLabelCounter}")
     1127            $asm.putsLabel("llint_cloop_did_return_from_js_#{@@didReturnFromJSLabelCounter}", false)
    11281128
    11291129        # We can't do generic function calls with an arbitrary set of args, but
  • trunk/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb

    r128015 r167094  
    3434require "settings"
    3535require "transform"
     36
     37IncludeFile.processIncludeOptions()
    3638
    3739inputFlnm = ARGV.shift
  • trunk/Source/JavaScriptCore/offlineasm/instructions.rb

    r163351 r167094  
    267267ARM64_INSTRUCTIONS =
    268268    [
     269     "pcrtoaddr",    # Address from PC relative offset - adr instruction
    269270     "popLRAndFP",   # ARM64 requires registers to be pushed and popped in pairs,
    270271     "pushLRAndFP"   # therefore we do LR (link register) and FP (frame pointer) together.
  • trunk/Source/JavaScriptCore/offlineasm/parser.rb

    r163351 r167094  
    3939    def to_s
    4040        "#{fileName}:#{lineNumber}"
     41    end
     42end
     43
     44class IncludeFile
     45    @@includeDirs = []
     46
     47    attr_reader :fileName
     48
     49    def initialize(moduleName, defaultDir)
     50        directory = nil
     51        @@includeDirs.each {
     52            | includePath |
     53            fileName = includePath + (moduleName + ".asm")
     54            directory = includePath unless not File.file?(fileName)
     55        }
     56        if not directory
     57            directory = defaultDir
     58        end
     59
     60        @fileName = directory + (moduleName + ".asm")
     61    end
     62
     63    def self.processIncludeOptions()
     64        while ARGV[0][/-I/]
     65            path = ARGV.shift[2..-1]
     66            if not path
     67                path = ARGV.shift
     68            end
     69            @@includeDirs << (path + "/")
     70        end
    4171    end
    4272end
     
    158188
    159189def isKeyword(token)
    160     token =~ /\A((true)|(false)|(if)|(then)|(else)|(elsif)|(end)|(and)|(or)|(not)|(macro)|(const)|(sizeof)|(error)|(include))\Z/ or
     190    token =~ /\A((true)|(false)|(if)|(then)|(else)|(elsif)|(end)|(and)|(or)|(not)|(global)|(macro)|(const)|(sizeof)|(error)|(include))\Z/ or
    161191        token =~ REGISTER_PATTERN or
    162192        isInstruction(token)
     
    381411            codeOrigin, names = parseColonColon
    382412            Sizeof.forName(codeOrigin, names.join('::'))
     413        elsif isLabel @tokens[@idx]
     414            result = LabelReference.new(@tokens[@idx].codeOrigin, Label.forName(@tokens[@idx].codeOrigin, @tokens[@idx].string))
     415            @idx += 1
     416            result
     417        elsif isLocalLabel @tokens[@idx]
     418            result = LocalLabelReference.new(@tokens[@idx].codeOrigin, LocalLabel.forName(@tokens[@idx].codeOrigin, @tokens[@idx].string))
     419            @idx += 1
     420            result
    383421        else
    384422            parseError
     
    574612                @idx += 1
    575613                list << Macro.new(codeOrigin, name, variables, body)
     614            elsif @tokens[@idx] == "global"
     615                codeOrigin = @tokens[@idx].codeOrigin
     616                @idx += 1
     617                skipNewLine
     618                parseError unless isLabel(@tokens[@idx])
     619                name = @tokens[@idx].string
     620                @idx += 1
     621                Label.setAsGlobal(codeOrigin, name)
    576622            elsif isInstruction @tokens[@idx]
    577623                codeOrigin = @tokens[@idx].codeOrigin
     
    678724                # It's a label.
    679725                if isLabel name
    680                     list << Label.forName(codeOrigin, name)
     726                    list << Label.forName(codeOrigin, name, true)
    681727                else
    682728                    list << LocalLabel.forName(codeOrigin, name)
     
    687733                parseError unless isIdentifier(@tokens[@idx])
    688734                moduleName = @tokens[@idx].string
    689                 fileName = @tokens[@idx].codeOrigin.fileName.dirname + (moduleName + ".asm")
     735                fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName
    690736                @idx += 1
    691737                $stderr.puts "offlineasm: Including file #{fileName}"
     
    696742        }
    697743        Sequence.new(firstCodeOrigin, list)
     744    end
     745
     746    def parseIncludes(final, comment)
     747        firstCodeOrigin = @tokens[@idx].codeOrigin
     748        fileList = []
     749        fileList << @tokens[@idx].codeOrigin.fileName
     750        loop {
     751            if (@idx == @tokens.length and not final) or (final and @tokens[@idx] =~ final)
     752                break
     753            elsif @tokens[@idx] == "include"
     754                @idx += 1
     755                parseError unless isIdentifier(@tokens[@idx])
     756                moduleName = @tokens[@idx].string
     757                fileName = IncludeFile.new(moduleName, @tokens[@idx].codeOrigin.fileName.dirname).fileName
     758                @idx += 1
     759               
     760                fileList << fileName
     761            else
     762                @idx += 1
     763            end
     764        }
     765
     766        return fileList
    698767    end
    699768end
     
    709778
    710779def parseHash(fileName)
    711     dirHash(Pathname.new(fileName).dirname, /\.asm$/)
    712 end
    713 
     780    parser = Parser.new(IO::read(fileName), fileName)
     781    fileList = parser.parseIncludes(nil, "")
     782    fileListHash(fileList)
     783end
     784
  • trunk/Source/JavaScriptCore/offlineasm/registers.rb

    r160100 r167094  
    4545     "sp",
    4646     "lr",
    47      
     47     "pc",
    4848     # 64-bit only registers:
    4949     "csr1",  # tag type number register
  • trunk/Source/JavaScriptCore/offlineasm/self_hash.rb

    r122650 r167094  
    4646
    4747#
     48# fileListHash(fileList) -> SHA1 hexdigest
     49#
     50# Returns a hash of all files in the list.
     51#
     52
     53def fileListHash(fileList)
     54    contents = ""
     55    fileList.each {
     56        | fileName |
     57        contents += IO::read(fileName)
     58    }
     59    return Digest::SHA1.hexdigest(contents)
     60end
     61
     62#
    4863# selfHash -> SHA1 hexdigest
    4964#
  • trunk/Source/JavaScriptCore/offlineasm/settings.rb

    r164164 r167094  
    173173
    174174def emitCodeInConfiguration(concreteSettings, ast, backend)
     175    Label.resetReferenced
     176
    175177    if !$emitWinAsm
    176178        $output.puts cppSettingsTest(concreteSettings)
     
    194196        $output.puts "_TEXT ENDS"
    195197        $output.puts "END"
     198
     199        # Write symbols needed by MASM
     200        File.open("#{File.basename($output.path)}.sym", "w") {
     201            | outp |
     202            Label.forReferencedExtern {
     203                | name |
     204                outp.puts "EXTERN #{name[1..-1]} : near"
     205            }
     206        }
    196207    end
    197208end
  • trunk/Source/JavaScriptCore/offlineasm/transform.rb

    r157474 r167094  
    458458end
    459459
     460class SubImmediates
     461    def validate
     462      raise "Invalid operand #{left.dump} to immediate subtraction" unless left.immediateOperand?
     463      raise "Invalid operand #{right.dump} to immediate subtraction" unless right.immediateOperand?
     464    end
     465end
     466
    460467class Error
    461468    def validate
  • trunk/Source/JavaScriptCore/offlineasm/x86.rb

    r165205 r167094  
    464464
    465465class LocalLabelReference
     466    def x86Operand(kind)
     467        asmLabel
     468    end
    466469    def x86CallOperand(kind)
    467470        asmLabel
     
    512515class Instruction
    513516    @@floatingPointCompareImplicitOperand = isIntelSyntax ? "st(0), " : ""
    514     @@exportedSymbols = Array.new
    515517   
    516518    def x86Operands(*kinds)
     
    847849    end
    848850
    849     def writeSymbolToFile(symbol)
    850         raise unless isMSVC
    851 
    852         alreadyExported = @@exportedSymbols.include?(symbol)
    853 
    854         if !alreadyExported
    855             @@exportedSymbols.push(symbol)
    856 
    857             # Write symbols needed by MASM
    858             File.open("#{File.basename($output.path)}.sym", "a") {
    859                 | outp |
    860                 outp.puts "EXTERN #{symbol} : near"
    861             }
    862         end
    863     end
    864    
    865851    def lowerX86Common
    866852        $asm.codeOrigin codeOriginString if $enableCodeOriginComments
     
    13391325            end
    13401326            op = operands[0].x86CallOperand(:ptr)
    1341             if isMSVC && (operands[0].is_a? LabelReference)
    1342                 writeSymbolToFile(op)
     1327            if operands[0].is_a? LabelReference
     1328                operands[0].used
    13431329            end
    13441330            $asm.puts "call #{op}"
  • trunk/Source/WebKit/ChangeLog

    r167088 r167094  
     12014-04-10  Michael Saboff  <msaboff@apple.com>
     2
     3        LLInt interpreter code should be generated as part of one function
     4        https://bugs.webkit.org/show_bug.cgi?id=131205
     5
     6        Reviewed by Mark Lam.
     7
     8        Updated VS dependencies for JavaScriptCore changes.
     9
     10        * WebKit.vcxproj/WebKit.sln:
     11
    1122014-04-10  Brent Fulgham  <bfulgham@apple.com>
    213
  • trunk/Source/WebKit/WebKit.vcxproj/WebKit.sln

    r166764 r167094  
    6969Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LLIntOffsetsExtractor", "..\..\JavaScriptCore\JavaScriptCore.vcxproj\LLInt\LLIntOffsetsExtractor\LLIntOffsetsExtractor.vcxproj", "{D595E3F6-24F2-4C60-935C-95D50C6B3E96}"
    7070        ProjectSection(ProjectDependencies) = postProject
     71                {3670D01F-95F3-45A8-B878-947EB6CF214E} = {3670D01F-95F3-45A8-B878-947EB6CF214E}
    7172                {877150A0-41B3-4730-9D98-1B8298098B14} = {877150A0-41B3-4730-9D98-1B8298098B14}
    7273        EndProjectSection
     
    7980Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LLIntAssembly", "..\..\JavaScriptCore\JavaScriptCore.vcxproj\LLInt\LLIntAssembly\LLIntAssembly.vcxproj", "{9221744B-5715-4F56-9590-42F7AB23DD8B}"
    8081        ProjectSection(ProjectDependencies) = postProject
     82                {3670D01F-95F3-45A8-B878-947EB6CF214E} = {3670D01F-95F3-45A8-B878-947EB6CF214E}
    8183                {D595E3F6-24F2-4C60-935C-95D50C6B3E96} = {D595E3F6-24F2-4C60-935C-95D50C6B3E96}
    8284        EndProjectSection
Note: See TracChangeset for help on using the changeset viewer.