Changeset 189848 in webkit


Ignore:
Timestamp:
Sep 15, 2015 11:14:54 PM (9 years ago)
Author:
msaboff@apple.com
Message:

Rollout r189774 and 189818.

Broke Speedometer/Full.html

Not reviewed.

  • CMakeLists.txt:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • assembler/AbortReason.h:
  • assembler/AbstractMacroAssembler.h:

(JSC::AbstractMacroAssembler::Call::Call):
(JSC::AbstractMacroAssembler::repatchNearCall):
(JSC::AbstractMacroAssembler::repatchCompact):

  • assembler/CodeLocation.h:

(JSC::CodeLocationNearCall::CodeLocationNearCall):
(JSC::CodeLocationCommon::callAtOffset):
(JSC::CodeLocationCommon::nearCallAtOffset):
(JSC::CodeLocationCommon::dataLabelPtrAtOffset):
(JSC::CodeLocationNearCall::callMode): Deleted.

  • assembler/LinkBuffer.h:

(JSC::LinkBuffer::locationOfNearCall):
(JSC::LinkBuffer::locationOf):

  • assembler/MacroAssemblerARM.h:

(JSC::MacroAssemblerARM::nearCall):
(JSC::MacroAssemblerARM::call):
(JSC::MacroAssemblerARM::linkCall):
(JSC::MacroAssemblerARM::nearTailCall): Deleted.

  • assembler/MacroAssemblerARM64.h:

(JSC::MacroAssemblerARM64::nearCall):
(JSC::MacroAssemblerARM64::ret):
(JSC::MacroAssemblerARM64::linkCall):
(JSC::MacroAssemblerARM64::nearTailCall): Deleted.

  • assembler/MacroAssemblerARMv7.h:

(JSC::MacroAssemblerARMv7::nearCall):
(JSC::MacroAssemblerARMv7::call):
(JSC::MacroAssemblerARMv7::linkCall):
(JSC::MacroAssemblerARMv7::nearTailCall): Deleted.

  • assembler/MacroAssemblerMIPS.h:

(JSC::MacroAssemblerMIPS::nearCall):
(JSC::MacroAssemblerMIPS::call):
(JSC::MacroAssemblerMIPS::linkCall):
(JSC::MacroAssemblerMIPS::repatchCall):
(JSC::MacroAssemblerMIPS::nearTailCall): Deleted.

  • assembler/MacroAssemblerSH4.h:

(JSC::MacroAssemblerSH4::call):
(JSC::MacroAssemblerSH4::nearCall):
(JSC::MacroAssemblerSH4::linkCall):
(JSC::MacroAssemblerSH4::repatchCall):
(JSC::MacroAssemblerSH4::nearTailCall): Deleted.

  • assembler/MacroAssemblerX86.h:

(JSC::MacroAssemblerX86::linkCall):

  • assembler/MacroAssemblerX86Common.h:

(JSC::MacroAssemblerX86Common::breakpoint):
(JSC::MacroAssemblerX86Common::nearCall):
(JSC::MacroAssemblerX86Common::nearTailCall): Deleted.

  • assembler/MacroAssemblerX86_64.h:

(JSC::MacroAssemblerX86_64::linkCall):

  • bytecode/BytecodeList.json:
  • bytecode/BytecodeUseDef.h:

(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):

  • bytecode/CallLinkInfo.h:

(JSC::CallLinkInfo::callTypeFor):
(JSC::CallLinkInfo::CallLinkInfo):
(JSC::CallLinkInfo::specializationKind):
(JSC::CallLinkInfo::registerPreservationMode):
(JSC::CallLinkInfo::isVarargsCallType): Deleted.
(JSC::CallLinkInfo::callModeFor): Deleted.
(JSC::CallLinkInfo::callMode): Deleted.
(JSC::CallLinkInfo::isTailCall): Deleted.
(JSC::CallLinkInfo::isVarargs): Deleted.

  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::computeFromLLInt):

  • bytecode/CodeBlock.cpp:

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

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitCallInTailPosition):
(JSC::BytecodeGenerator::emitCallEval):
(JSC::BytecodeGenerator::emitCall):
(JSC::BytecodeGenerator::emitCallVarargsInTailPosition):
(JSC::BytecodeGenerator::emitConstructVarargs):

  • bytecompiler/NodesCodegen.cpp:

(JSC::CallArguments::CallArguments):
(JSC::LabelNode::emitBytecode):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::addCallWithoutSettingResult):

  • ftl/FTLLowerDFGToLLVM.cpp:

(JSC::FTL::DFG::LowerDFGToLLVM::compileCallOrConstruct):

  • interpreter/Interpreter.h:

(JSC::Interpreter::isCallBytecode):

  • jit/CCallHelpers.h:

(JSC::CCallHelpers::jumpToExceptionHandler):
(JSC::CCallHelpers::prepareForTailCallSlow): Deleted.

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):

  • jit/JIT.h:
  • jit/JITCall.cpp:

(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):
(JSC::JIT::emit_op_call):
(JSC::JIT::emit_op_call_eval):
(JSC::JIT::emit_op_call_varargs):
(JSC::JIT::emit_op_construct_varargs):
(JSC::JIT::emitSlow_op_call):
(JSC::JIT::emitSlow_op_call_eval):
(JSC::JIT::emitSlow_op_call_varargs):
(JSC::JIT::emitSlow_op_construct_varargs):
(JSC::JIT::emit_op_tail_call): Deleted.
(JSC::JIT::emit_op_tail_call_varargs): Deleted.
(JSC::JIT::emitSlow_op_tail_call): Deleted.
(JSC::JIT::emitSlow_op_tail_call_varargs): Deleted.

  • jit/JITCall32_64.cpp:

(JSC::JIT::emitSlow_op_call):
(JSC::JIT::emitSlow_op_call_eval):
(JSC::JIT::emitSlow_op_call_varargs):
(JSC::JIT::emitSlow_op_construct_varargs):
(JSC::JIT::emit_op_call):
(JSC::JIT::emit_op_call_eval):
(JSC::JIT::emit_op_call_varargs):
(JSC::JIT::emit_op_construct_varargs):
(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):
(JSC::JIT::emitSlow_op_tail_call): Deleted.
(JSC::JIT::emitSlow_op_tail_call_varargs): Deleted.
(JSC::JIT::emit_op_tail_call): Deleted.
(JSC::JIT::emit_op_tail_call_varargs): Deleted.

  • jit/JITInlines.h:

(JSC::JIT::emitNakedCall):
(JSC::JIT::updateTopCallFrame):
(JSC::JIT::emitNakedTailCall): Deleted.

  • jit/JITOperations.cpp:
  • jit/JITOperations.h:
  • jit/Repatch.cpp:

(JSC::linkVirtualFor):
(JSC::linkPolymorphicCall):

  • jit/ThunkGenerators.cpp:

(JSC::throwExceptionFromCallSlowPathGenerator):
(JSC::slowPathFor):
(JSC::linkCallThunkGenerator):
(JSC::virtualThunkFor):
(JSC::arityFixupGenerator):
(JSC::baselineGetterReturnThunkGenerator):
(JSC::unreachableGenerator): Deleted.

  • jit/ThunkGenerators.h:
  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • runtime/CommonSlowPaths.h:

(JSC::CommonSlowPaths::arityCheckFor):
(JSC::CommonSlowPaths::opIn):

  • tests/stress/mutual-tail-call-no-stack-overflow.js: Removed.
  • tests/stress/tail-call-no-stack-overflow.js: Removed.
  • tests/stress/tail-call-recognize.js: Removed.
  • tests/stress/tail-call-varargs-no-stack-overflow.js: Removed.
  • tests/stress/tail-calls-dont-overwrite-live-stack.js: Removed.
Location:
trunk/Source/JavaScriptCore
Files:
5 deleted
42 edited

Legend:

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

    r189774 r189848  
    8181    bytecode/CallLinkInfo.cpp
    8282    bytecode/CallLinkStatus.cpp
    83     bytecode/CallMode.cpp
    8483    bytecode/CallVariant.cpp
    8584    bytecode/CodeBlock.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r189846 r189848  
     12015-09-15  Michael Saboff  <msaboff@apple.com>
     2
     3        Rollout r189774 and 189818.
     4
     5        Broke Speedometer/Full.html
     6
     7        Not reviewed.
     8
     9        * CMakeLists.txt:
     10        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
     11        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
     12        * JavaScriptCore.xcodeproj/project.pbxproj:
     13        * assembler/AbortReason.h:
     14        * assembler/AbstractMacroAssembler.h:
     15        (JSC::AbstractMacroAssembler::Call::Call):
     16        (JSC::AbstractMacroAssembler::repatchNearCall):
     17        (JSC::AbstractMacroAssembler::repatchCompact):
     18        * assembler/CodeLocation.h:
     19        (JSC::CodeLocationNearCall::CodeLocationNearCall):
     20        (JSC::CodeLocationCommon::callAtOffset):
     21        (JSC::CodeLocationCommon::nearCallAtOffset):
     22        (JSC::CodeLocationCommon::dataLabelPtrAtOffset):
     23        (JSC::CodeLocationNearCall::callMode): Deleted.
     24        * assembler/LinkBuffer.h:
     25        (JSC::LinkBuffer::locationOfNearCall):
     26        (JSC::LinkBuffer::locationOf):
     27        * assembler/MacroAssemblerARM.h:
     28        (JSC::MacroAssemblerARM::nearCall):
     29        (JSC::MacroAssemblerARM::call):
     30        (JSC::MacroAssemblerARM::linkCall):
     31        (JSC::MacroAssemblerARM::nearTailCall): Deleted.
     32        * assembler/MacroAssemblerARM64.h:
     33        (JSC::MacroAssemblerARM64::nearCall):
     34        (JSC::MacroAssemblerARM64::ret):
     35        (JSC::MacroAssemblerARM64::linkCall):
     36        (JSC::MacroAssemblerARM64::nearTailCall): Deleted.
     37        * assembler/MacroAssemblerARMv7.h:
     38        (JSC::MacroAssemblerARMv7::nearCall):
     39        (JSC::MacroAssemblerARMv7::call):
     40        (JSC::MacroAssemblerARMv7::linkCall):
     41        (JSC::MacroAssemblerARMv7::nearTailCall): Deleted.
     42        * assembler/MacroAssemblerMIPS.h:
     43        (JSC::MacroAssemblerMIPS::nearCall):
     44        (JSC::MacroAssemblerMIPS::call):
     45        (JSC::MacroAssemblerMIPS::linkCall):
     46        (JSC::MacroAssemblerMIPS::repatchCall):
     47        (JSC::MacroAssemblerMIPS::nearTailCall): Deleted.
     48        * assembler/MacroAssemblerSH4.h:
     49        (JSC::MacroAssemblerSH4::call):
     50        (JSC::MacroAssemblerSH4::nearCall):
     51        (JSC::MacroAssemblerSH4::linkCall):
     52        (JSC::MacroAssemblerSH4::repatchCall):
     53        (JSC::MacroAssemblerSH4::nearTailCall): Deleted.
     54        * assembler/MacroAssemblerX86.h:
     55        (JSC::MacroAssemblerX86::linkCall):
     56        * assembler/MacroAssemblerX86Common.h:
     57        (JSC::MacroAssemblerX86Common::breakpoint):
     58        (JSC::MacroAssemblerX86Common::nearCall):
     59        (JSC::MacroAssemblerX86Common::nearTailCall): Deleted.
     60        * assembler/MacroAssemblerX86_64.h:
     61        (JSC::MacroAssemblerX86_64::linkCall):
     62        * bytecode/BytecodeList.json:
     63        * bytecode/BytecodeUseDef.h:
     64        (JSC::computeUsesForBytecodeOffset):
     65        (JSC::computeDefsForBytecodeOffset):
     66        * bytecode/CallLinkInfo.h:
     67        (JSC::CallLinkInfo::callTypeFor):
     68        (JSC::CallLinkInfo::CallLinkInfo):
     69        (JSC::CallLinkInfo::specializationKind):
     70        (JSC::CallLinkInfo::registerPreservationMode):
     71        (JSC::CallLinkInfo::isVarargsCallType): Deleted.
     72        (JSC::CallLinkInfo::callModeFor): Deleted.
     73        (JSC::CallLinkInfo::callMode): Deleted.
     74        (JSC::CallLinkInfo::isTailCall): Deleted.
     75        (JSC::CallLinkInfo::isVarargs): Deleted.
     76        * bytecode/CallLinkStatus.cpp:
     77        (JSC::CallLinkStatus::computeFromLLInt):
     78        * bytecode/CodeBlock.cpp:
     79        (JSC::CodeBlock::dumpBytecode):
     80        (JSC::CodeBlock::CodeBlock):
     81        * bytecompiler/BytecodeGenerator.cpp:
     82        (JSC::BytecodeGenerator::BytecodeGenerator):
     83        (JSC::BytecodeGenerator::emitCallInTailPosition):
     84        (JSC::BytecodeGenerator::emitCallEval):
     85        (JSC::BytecodeGenerator::emitCall):
     86        (JSC::BytecodeGenerator::emitCallVarargsInTailPosition):
     87        (JSC::BytecodeGenerator::emitConstructVarargs):
     88        * bytecompiler/NodesCodegen.cpp:
     89        (JSC::CallArguments::CallArguments):
     90        (JSC::LabelNode::emitBytecode):
     91        * dfg/DFGByteCodeParser.cpp:
     92        (JSC::DFG::ByteCodeParser::addCallWithoutSettingResult):
     93        * ftl/FTLLowerDFGToLLVM.cpp:
     94        (JSC::FTL::DFG::LowerDFGToLLVM::compileCallOrConstruct):
     95        * interpreter/Interpreter.h:
     96        (JSC::Interpreter::isCallBytecode):
     97        * jit/CCallHelpers.h:
     98        (JSC::CCallHelpers::jumpToExceptionHandler):
     99        (JSC::CCallHelpers::prepareForTailCallSlow): Deleted.
     100        * jit/JIT.cpp:
     101        (JSC::JIT::privateCompileMainPass):
     102        (JSC::JIT::privateCompileSlowCases):
     103        * jit/JIT.h:
     104        * jit/JITCall.cpp:
     105        (JSC::JIT::compileOpCall):
     106        (JSC::JIT::compileOpCallSlowCase):
     107        (JSC::JIT::emit_op_call):
     108        (JSC::JIT::emit_op_call_eval):
     109        (JSC::JIT::emit_op_call_varargs):
     110        (JSC::JIT::emit_op_construct_varargs):
     111        (JSC::JIT::emitSlow_op_call):
     112        (JSC::JIT::emitSlow_op_call_eval):
     113        (JSC::JIT::emitSlow_op_call_varargs):
     114        (JSC::JIT::emitSlow_op_construct_varargs):
     115        (JSC::JIT::emit_op_tail_call): Deleted.
     116        (JSC::JIT::emit_op_tail_call_varargs): Deleted.
     117        (JSC::JIT::emitSlow_op_tail_call): Deleted.
     118        (JSC::JIT::emitSlow_op_tail_call_varargs): Deleted.
     119        * jit/JITCall32_64.cpp:
     120        (JSC::JIT::emitSlow_op_call):
     121        (JSC::JIT::emitSlow_op_call_eval):
     122        (JSC::JIT::emitSlow_op_call_varargs):
     123        (JSC::JIT::emitSlow_op_construct_varargs):
     124        (JSC::JIT::emit_op_call):
     125        (JSC::JIT::emit_op_call_eval):
     126        (JSC::JIT::emit_op_call_varargs):
     127        (JSC::JIT::emit_op_construct_varargs):
     128        (JSC::JIT::compileOpCall):
     129        (JSC::JIT::compileOpCallSlowCase):
     130        (JSC::JIT::emitSlow_op_tail_call): Deleted.
     131        (JSC::JIT::emitSlow_op_tail_call_varargs): Deleted.
     132        (JSC::JIT::emit_op_tail_call): Deleted.
     133        (JSC::JIT::emit_op_tail_call_varargs): Deleted.
     134        * jit/JITInlines.h:
     135        (JSC::JIT::emitNakedCall):
     136        (JSC::JIT::updateTopCallFrame):
     137        (JSC::JIT::emitNakedTailCall): Deleted.
     138        * jit/JITOperations.cpp:
     139        * jit/JITOperations.h:
     140        * jit/Repatch.cpp:
     141        (JSC::linkVirtualFor):
     142        (JSC::linkPolymorphicCall):
     143        * jit/ThunkGenerators.cpp:
     144        (JSC::throwExceptionFromCallSlowPathGenerator):
     145        (JSC::slowPathFor):
     146        (JSC::linkCallThunkGenerator):
     147        (JSC::virtualThunkFor):
     148        (JSC::arityFixupGenerator):
     149        (JSC::baselineGetterReturnThunkGenerator):
     150        (JSC::unreachableGenerator): Deleted.
     151        * jit/ThunkGenerators.h:
     152        * llint/LowLevelInterpreter.asm:
     153        * llint/LowLevelInterpreter32_64.asm:
     154        * llint/LowLevelInterpreter64.asm:
     155        * runtime/CommonSlowPaths.h:
     156        (JSC::CommonSlowPaths::arityCheckFor):
     157        (JSC::CommonSlowPaths::opIn):
     158        * tests/stress/mutual-tail-call-no-stack-overflow.js: Removed.
     159        * tests/stress/tail-call-no-stack-overflow.js: Removed.
     160        * tests/stress/tail-call-recognize.js: Removed.
     161        * tests/stress/tail-call-varargs-no-stack-overflow.js: Removed.
     162        * tests/stress/tail-calls-dont-overwrite-live-stack.js: Removed.
     163
    11642015-09-15  Sukolsak Sakshuwong  <sukolsak@gmail.com>
    2165
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

    r189774 r189848  
    320320    <ClCompile Include="..\bytecode\CallLinkInfo.cpp" />
    321321    <ClCompile Include="..\bytecode\CallLinkStatus.cpp" />
    322     <ClCompile Include="..\bytecode\CallMode.cpp" />
    323322    <ClCompile Include="..\bytecode\CallVariant.cpp" />
    324323    <ClCompile Include="..\bytecode\CodeBlock.cpp" />
     
    10141013    <ClInclude Include="..\bytecode\CallLinkInfo.h" />
    10151014    <ClInclude Include="..\bytecode\CallLinkStatus.h" />
    1016     <ClInclude Include="..\bytecode\CallMode.h" />
    10171015    <ClInclude Include="..\bytecode\CallReturnOffsetToBytecodeOffset.h" />
    10181016    <ClInclude Include="..\bytecode\CallVariant.h" />
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters

    r189774 r189848  
    163163      <Filter>bytecode</Filter>
    164164    </ClCompile>
    165     <ClCompile Include="..\bytecode\CallMode.cpp">
    166       <Filter>bytecode</Filter>
    167     </ClCompile>
    168165    <ClCompile Include="..\bytecode\CodeBlock.cpp">
    169166      <Filter>bytecode</Filter>
     
    20362033    </ClInclude>
    20372034    <ClInclude Include="..\bytecode\CallLinkStatus.h">
    2038       <Filter>bytecode</Filter>
    2039     </ClInclude>
    2040     <ClInclude Include="..\bytecode\CallMode.h">
    20412035      <Filter>bytecode</Filter>
    20422036    </ClInclude>
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r189774 r189848  
    970970                5DE6E5B30E1728EC00180407 /* create_hash_table in Headers */ = {isa = PBXBuildFile; fileRef = F692A8540255597D01FF60F7 /* create_hash_table */; settings = {ATTRIBUTES = (); }; };
    971971                623A37EC1B87A7C000754209 /* RegisterMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 623A37EB1B87A7BD00754209 /* RegisterMap.h */; };
    972                 627673231B680C1E00FD9F2E /* CallMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 627673211B680C1E00FD9F2E /* CallMode.cpp */; };
    973                 627673241B680C1E00FD9F2E /* CallMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 627673221B680C1E00FD9F2E /* CallMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
    974972                62D2D38F1ADF103F000206C1 /* FunctionRareData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62D2D38D1ADF103F000206C1 /* FunctionRareData.cpp */; };
    975973                62D2D3901ADF103F000206C1 /* FunctionRareData.h in Headers */ = {isa = PBXBuildFile; fileRef = 62D2D38E1ADF103F000206C1 /* FunctionRareData.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    27752773                5DE3D0F40DD8DDFB00468714 /* WebKitAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitAvailability.h; sourceTree = "<group>"; };
    27762774                623A37EB1B87A7BD00754209 /* RegisterMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterMap.h; sourceTree = "<group>"; };
    2777                 627673211B680C1E00FD9F2E /* CallMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CallMode.cpp; sourceTree = "<group>"; };
    2778                 627673221B680C1E00FD9F2E /* CallMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CallMode.h; sourceTree = "<group>"; };
    27792775                62A9A29E1B0BED4800BD54CA /* DFGLazyNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGLazyNode.cpp; path = dfg/DFGLazyNode.cpp; sourceTree = "<group>"; };
    27802776                62A9A29F1B0BED4800BD54CA /* DFGLazyNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGLazyNode.h; path = dfg/DFGLazyNode.h; sourceTree = "<group>"; };
     
    55435539                                0F93329314CA7DC10085F3C6 /* CallLinkStatus.cpp */,
    55445540                                0F93329414CA7DC10085F3C6 /* CallLinkStatus.h */,
    5545                                 627673211B680C1E00FD9F2E /* CallMode.cpp */,
    5546                                 627673221B680C1E00FD9F2E /* CallMode.h */,
    55475541                                0F0B83B814BCF95B00885B4F /* CallReturnOffsetToBytecodeOffset.h */,
    55485542                                0F3B7E2419A11B8000D9BC56 /* CallVariant.cpp */,
     
    61976191                                A7D89CFE17A0B8CC00773AD8 /* DFGOSRAvailabilityAnalysisPhase.h in Headers */,
    61986192                                0FD82E57141DAF1000179C94 /* DFGOSREntry.h in Headers */,
    6199                                 627673241B680C1E00FD9F2E /* CallMode.h in Headers */,
    62006193                                0FD8A32617D51F5700CA2C40 /* DFGOSREntrypointCreationPhase.h in Headers */,
    62016194                                62F2AA381B0BEDE300610C7A /* DFGLazyNode.h in Headers */,
     
    79797972                                9335F24D12E6765B002B5553 /* StringRecursionChecker.cpp in Sources */,
    79807973                                BCDE3B430E6C832D001453A7 /* Structure.cpp in Sources */,
    7981                                 627673231B680C1E00FD9F2E /* CallMode.cpp in Sources */,
    79827974                                7E4EE70F0EBB7A5B005934AA /* StructureChain.cpp in Sources */,
    79837975                                C2F0F2D116BAEEE900187C19 /* StructureRareData.cpp in Sources */,
  • trunk/Source/JavaScriptCore/assembler/AbortReason.h

    r189774 r189848  
    5959    DFGUnreasonableOSREntryJumpDestination            = 230,
    6060    DFGVarargsThrowingPathDidNotThrow                 = 235,
    61     JITDidReturnFromTailCall                          = 237,
    6261    JITDivOperandsAreNotNumbers                       = 240,
    6362    JITGetByValResultIsNotEmpty                       = 250,
  • trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h

    r189774 r189848  
    508508            Linkable = 0x1,
    509509            Near = 0x2,
    510             Tail = 0x4,
    511510            LinkableNear = 0x3,
    512             LinkableNearTail = 0x7,
    513511        };
    514512
     
    965963    static void repatchNearCall(CodeLocationNearCall nearCall, CodeLocationLabel destination)
    966964    {
    967         switch (nearCall.callMode()) {
    968         case NearCallMode::Tail:
    969             AssemblerType::relinkJump(nearCall.dataLocation(), destination.executableAddress());
    970             return;
    971         case NearCallMode::Regular:
    972             AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());
    973             return;
    974         }
    975         RELEASE_ASSERT_NOT_REACHED();
     965        AssemblerType::relinkCall(nearCall.dataLocation(), destination.executableAddress());
    976966    }
    977967
  • trunk/Source/JavaScriptCore/assembler/CodeLocation.h

    r189774 r189848  
    3333namespace JSC {
    3434
    35 enum NearCallMode { Regular, Tail };
    36 
    3735class CodeLocationInstruction;
    3836class CodeLocationLabel;
     
    6260    CodeLocationJump jumpAtOffset(int offset);
    6361    CodeLocationCall callAtOffset(int offset);
    64     CodeLocationNearCall nearCallAtOffset(int offset, NearCallMode);
     62    CodeLocationNearCall nearCallAtOffset(int offset);
    6563    CodeLocationDataLabelPtr dataLabelPtrAtOffset(int offset);
    6664    CodeLocationDataLabel32 dataLabel32AtOffset(int offset);
     
    118116public:
    119117    CodeLocationNearCall() {}
    120     explicit CodeLocationNearCall(MacroAssemblerCodePtr location, NearCallMode callMode)
    121         : CodeLocationCommon(location), m_callMode(callMode) { }
    122     explicit CodeLocationNearCall(void* location, NearCallMode callMode)
    123         : CodeLocationCommon(MacroAssemblerCodePtr(location)), m_callMode(callMode) { }
    124     NearCallMode callMode() { return m_callMode; }
    125 private:
    126     NearCallMode m_callMode = NearCallMode::Regular;
     118    explicit CodeLocationNearCall(MacroAssemblerCodePtr location)
     119        : CodeLocationCommon(location) {}
     120    explicit CodeLocationNearCall(void* location)
     121        : CodeLocationCommon(MacroAssemblerCodePtr(location)) {}
    127122};
    128123
     
    187182}
    188183
    189 inline CodeLocationNearCall CodeLocationCommon::nearCallAtOffset(int offset, NearCallMode callMode)
    190 {
    191     ASSERT_VALID_CODE_OFFSET(offset);
    192     return CodeLocationNearCall(reinterpret_cast<char*>(dataLocation()) + offset, callMode);
     184inline CodeLocationNearCall CodeLocationCommon::nearCallAtOffset(int offset)
     185{
     186    ASSERT_VALID_CODE_OFFSET(offset);
     187    return CodeLocationNearCall(reinterpret_cast<char*>(dataLocation()) + offset);
    193188}
    194189
  • trunk/Source/JavaScriptCore/assembler/LinkBuffer.h

    r189774 r189848  
    181181        ASSERT(call.isFlagSet(Call::Linkable));
    182182        ASSERT(call.isFlagSet(Call::Near));
    183         return CodeLocationNearCall(MacroAssembler::getLinkerAddress(code(), applyOffset(call.m_label)),
    184             call.isFlagSet(Call::Tail) ? NearCallMode::Tail : NearCallMode::Regular);
     183        return CodeLocationNearCall(MacroAssembler::getLinkerAddress(code(), applyOffset(call.m_label)));
    185184    }
    186185
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h

    r189774 r189848  
    905905    }
    906906
    907     Call nearTailCall()
    908     {
    909         return Call(m_assembler.jmp(), Call::LinkableNearTail);
    910     }
    911 
    912907    Call call(RegisterID target)
    913908    {
     
    14941489    static void linkCall(void* code, Call call, FunctionPtr function)
    14951490    {
    1496         if (call.isFlagSet(Call::Tail))
    1497             ARMAssembler::linkJump(code, call.m_label, function.value());
    1498         else
    1499             ARMAssembler::linkCall(code, call.m_label, function.value());
     1491        ARMAssembler::linkCall(code, call.m_label, function.value());
    15001492    }
    15011493
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h

    r189774 r189848  
    22052205    }
    22062206
    2207     ALWAYS_INLINE Call nearTailCall()
    2208     {
    2209         AssemblerLabel label = m_assembler.label();
    2210         m_assembler.b();
    2211         return Call(label, Call::LinkableNearTail);
    2212     }
    2213 
    22142207    ALWAYS_INLINE void ret()
    22152208    {
     
    28902883    static void linkCall(void* code, Call call, FunctionPtr function)
    28912884    {
    2892         if (!call.isFlagSet(Call::Near))
     2885        if (call.isFlagSet(Call::Near))
     2886            ARM64Assembler::linkCall(code, call.m_label, function.value());
     2887        else
    28932888            ARM64Assembler::linkPointer(code, call.m_label.labelAtOffset(REPATCH_OFFSET_CALL_TO_POINTER), function.value());
    2894         else if (call.isFlagSet(Call::Tail))
    2895             ARM64Assembler::linkJump(code, call.m_label, function.value());
    2896         else
    2897             ARM64Assembler::linkCall(code, call.m_label, function.value());
    28982889    }
    28992890
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h

    r189774 r189848  
    16781678    }
    16791679
    1680     ALWAYS_INLINE Call nearTailCall()
    1681     {
    1682         moveFixedWidthEncoding(TrustedImm32(0), dataTempRegister);
    1683         return Call(m_assembler.bx(dataTempRegister), Call::LinkableNearTail);
    1684     }
    1685 
    16861680    ALWAYS_INLINE Call call()
    16871681    {
     
    20192013    static void linkCall(void* code, Call call, FunctionPtr function)
    20202014    {
    2021         if (call.isFlagSet(Call::Tail))
    2022             ARMv7Assembler::linkJump(code, call.m_label, function.value());
    2023         else
    2024             ARMv7Assembler::linkCall(code, call.m_label, function.value());
     2015        ARMv7Assembler::linkCall(code, call.m_label, function.value());
    20252016    }
    20262017
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h

    r189774 r189848  
    19741974        m_assembler.nop();
    19751975        return Call(m_assembler.label(), Call::LinkableNear);
    1976     }
    1977 
    1978     Call nearTailCall()
    1979     {
    1980         m_assembler.nop();
    1981         m_assembler.nop();
    1982         m_assembler.beq(MIPSRegisters::zero, MIPSRegisters::zero, 0);
    1983         m_assembler.nop();
    1984         insertRelaxationWords();
    1985         return Call(m_assembler.label(), Call::LinkableNearTail);
    19861976    }
    19871977
     
    28112801    static void linkCall(void* code, Call call, FunctionPtr function)
    28122802    {
    2813         if (call.isFlagSet(Call::Tail))
    2814             MIPSAssembler::linkJump(code, call.m_label, function.value());
    2815         else
    2816             MIPSAssembler::linkCall(code, call.m_label, function.value());
     2803        MIPSAssembler::linkCall(code, call.m_label, function.value());
    28172804    }
    28182805
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerSH4.h

    r189774 r189848  
    24042404    }
    24052405
    2406     Call nearTailCall()
    2407     {
    2408         return Call(m_assembler.jump(), Call::LinkableNearTail);
    2409     }
    2410 
    24112406    Call nearCall()
    24122407    {
     
    26142609    static void linkCall(void* code, Call call, FunctionPtr function)
    26152610    {
    2616         if (call.isFlagSet(Call::Tail))
    2617             SH4Assembler::linkJump(code, call.m_label, function.value());
    2618         else
    2619             SH4Assembler::linkCall(code, call.m_label, function.value());
     2611        SH4Assembler::linkCall(code, call.m_label, function.value());
    26202612    }
    26212613
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86.h

    r189774 r189848  
    362362    static void linkCall(void* code, Call call, FunctionPtr function)
    363363    {
    364         if (call.isFlagSet(Call::Tail))
    365             X86Assembler::linkJump(code, call.m_label, function.value());
    366         else
    367             X86Assembler::linkCall(code, call.m_label, function.value());
     364        X86Assembler::linkCall(code, call.m_label, function.value());
    368365    }
    369366};
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h

    r189774 r189848  
    14021402    {
    14031403        m_assembler.int3();
    1404     }
    1405 
    1406     Call nearTailCall()
    1407     {
    1408         return Call(m_assembler.jmp(), Call::LinkableNearTail);
    14091404    }
    14101405
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h

    r189774 r189848  
    873873        if (!call.isFlagSet(Call::Near))
    874874            X86Assembler::linkPointer(code, call.m_label.labelAtOffset(-REPATCH_OFFSET_CALL_R11), function.value());
    875         else if (call.isFlagSet(Call::Tail))
    876             X86Assembler::linkJump(code, call.m_label, function.value());
    877875        else
    878876            X86Assembler::linkCall(code, call.m_label, function.value());
  • trunk/Source/JavaScriptCore/bytecode/BytecodeList.json

    r189818 r189848  
    9393            { "name" : "op_new_arrow_func_exp", "length" : 5 },
    9494            { "name" : "op_call", "length" : 9 },
    95             { "name" : "op_tail_call", "length" : 9 },
    9695            { "name" : "op_call_eval", "length" : 9 },
    9796            { "name" : "op_call_varargs", "length" : 9 },
    98             { "name" : "op_tail_call_varargs", "length" : 9 },
    9997            { "name" : "op_ret", "length" : 2 },
    10098            { "name" : "op_construct", "length" : 9 },
     
    147145            { "name" : "llint_cloop_did_return_from_js_6" },
    148146            { "name" : "llint_cloop_did_return_from_js_7" },
    149             { "name" : "llint_cloop_did_return_from_js_8" },
    150             { "name" : "llint_cloop_did_return_from_js_9" },
    151             { "name" : "llint_cloop_did_return_from_js_10" },
    152             { "name" : "llint_cloop_did_return_from_js_11" }
     147            { "name" : "llint_cloop_did_return_from_js_8" }
    153148        ]
    154149    },
  • trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.h

    r189774 r189848  
    192192    case op_has_structure_property:
    193193    case op_construct_varargs:
    194     case op_call_varargs:
    195     case op_tail_call_varargs: {
     194    case op_call_varargs: {
    196195        functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
    197196        functor(codeBlock, instruction, opcodeID, instruction[3].u.operand);
     
    222221    case op_construct:
    223222    case op_call_eval:
    224     case op_call:
    225     case op_tail_call: {
     223    case op_call: {
    226224        functor(codeBlock, instruction, opcodeID, instruction[2].u.operand);
    227225        int argCount = instruction[3].u.operand;
     
    314312    case op_new_arrow_func_exp:
    315313    case op_call_varargs:
    316     case op_tail_call_varargs:
    317314    case op_construct_varargs:
    318315    case op_get_from_scope:
    319316    case op_call:
    320     case op_tail_call:
    321317    case op_call_eval:
    322318    case op_construct:
  • trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h

    r189774 r189848  
    2727#define CallLinkInfo_h
    2828
    29 #include "CallMode.h"
    3029#include "CodeLocation.h"
    3130#include "CodeSpecializationKind.h"
     
    4342class CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> {
    4443public:
    45     enum CallType { None, Call, CallVarargs, Construct, ConstructVarargs, TailCall, TailCallVarargs };
     44    enum CallType { None, Call, CallVarargs, Construct, ConstructVarargs };
    4645    static CallType callTypeFor(OpcodeID opcodeID)
    4746    {
    4847        if (opcodeID == op_call || opcodeID == op_call_eval)
    4948            return Call;
    50         if (opcodeID == op_call_varargs)
    51             return CallVarargs;
    5249        if (opcodeID == op_construct)
    5350            return Construct;
    5451        if (opcodeID == op_construct_varargs)
    5552            return ConstructVarargs;
    56         if (opcodeID == op_tail_call)
    57             return TailCall;
    58         ASSERT(opcodeID == op_tail_call_varargs);
    59         return TailCallVarargs;
    60     }
    61 
    62     static bool isVarargsCallType(CallType callType)
    63     {
    64         switch (callType) {
    65         case CallVarargs:
    66         case ConstructVarargs:
    67         case TailCallVarargs:
    68             return true;
    69 
    70         default:
    71             return false;
    72         }
    73     }
    74 
     53        ASSERT(opcodeID == op_call_varargs);
     54        return CallVarargs;
     55    }
     56   
    7557    CallLinkInfo()
    7658        : m_registerPreservationMode(static_cast<unsigned>(RegisterPreservationNotRequired))
     
    10082    {
    10183        return specializationKindFor(static_cast<CallType>(m_callType));
    102     }
    103 
    104     static CallMode callModeFor(CallType callType)
    105     {
    106         switch (callType) {
    107         case Call:
    108         case CallVarargs:
    109             return CallMode::Regular;
    110         case TailCall:
    111         case TailCallVarargs:
    112             return CallMode::Tail;
    113         case Construct:
    114         case ConstructVarargs:
    115             return CallMode::Construct;
    116         case None:
    117             RELEASE_ASSERT_NOT_REACHED();
    118         }
    119 
    120         RELEASE_ASSERT_NOT_REACHED();
    121     }
    122 
    123     CallMode callMode() const
    124     {
    125         return callModeFor(static_cast<CallType>(m_callType));
    126     }
    127 
    128     bool isTailCall() const
    129     {
    130         return callMode() == CallMode::Tail;
    131     }
    132 
    133     bool isVarargs() const
    134     {
    135         return isVarargsCallType(static_cast<CallType>(m_callType));
    13684    }
    13785
  • trunk/Source/JavaScriptCore/bytecode/CallLinkStatus.cpp

    r189774 r189848  
    7070    Instruction* instruction = profiledBlock->instructions().begin() + bytecodeIndex;
    7171    OpcodeID op = vm.interpreter->getOpcodeID(instruction[0].u.opcode);
    72     if (op != op_call && op != op_construct && op != op_tail_call)
     72    if (op != op_call && op != op_construct)
    7373        return CallLinkStatus();
    7474   
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r189774 r189848  
    12491249            break;
    12501250        }
    1251         case op_tail_call: {
    1252             printCallOp(out, exec, location, it, "tail_call", DumpCaches, hasPrintedProfiling, callLinkInfos);
    1253             break;
    1254         }
    12551251        case op_call_eval: {
    12561252            printCallOp(out, exec, location, it, "call_eval", DontDumpCaches, hasPrintedProfiling, callLinkInfos);
     
    12591255           
    12601256        case op_construct_varargs:
    1261         case op_call_varargs:
    1262         case op_tail_call_varargs: {
     1257        case op_call_varargs: {
    12631258            int result = (++it)->u.operand;
    12641259            int callee = (++it)->u.operand;
     
    12681263            int varArgOffset = (++it)->u.operand;
    12691264            ++it;
    1270             printLocationAndOp(out, exec, location, it, opcode == op_call_varargs ? "call_varargs" : opcode == op_construct_varargs ? "construct_varargs" : "tail_call_varargs");
     1265            printLocationAndOp(out, exec, location, it, opcode == op_call_varargs ? "call_varargs" : "construct_varargs");
    12711266            out.printf("%s, %s, %s, %s, %d, %d", registerName(result).data(), registerName(callee).data(), registerName(thisValue).data(), registerName(arguments).data(), firstFreeRegister, varArgOffset);
    12721267            dumpValueProfiling(out, it, hasPrintedProfiling);
     
    18351830        }
    18361831        case op_call_varargs:
    1837         case op_tail_call_varargs:
    18381832        case op_construct_varargs:
    18391833        case op_get_by_val: {
     
    18851879
    18861880        case op_call:
    1887         case op_tail_call:
    18881881        case op_call_eval: {
    18891882            ValueProfile* profile = &m_valueProfiles[pc[opLength - 1].u.operand];
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r189774 r189848  
    194194    , m_isBuiltinFunction(codeBlock->isBuiltinFunction())
    195195    , m_usesNonStrictEval(codeBlock->usesEval() && !codeBlock->isStrictMode())
    196     // FIXME: We should be able to have tail call elimination with the profiler
    197     // enabled. This is currently not possible because the profiler expects
    198     // op_will_call / op_did_call pairs before and after a call, which are not
    199     // compatible with tail calls (we have no way of emitting op_did_call).
    200     // https://bugs.webkit.org/show_bug.cgi?id=148819
    201     , m_inTailPosition(Options::enableTailCalls() && constructorKind() == ConstructorKind::None && isStrictMode() && !m_shouldEmitProfileHooks)
     196    , m_inTailPosition(Options::enableTailCalls() && constructorKind() == ConstructorKind::None && isStrictMode())
    202197{
    203198    for (auto& constantRegister : m_linkTimeConstantRegisters)
     
    25192514RegisterID* BytecodeGenerator::emitCallInTailPosition(RegisterID* dst, RegisterID* func, ExpectedFunction expectedFunction, CallArguments& callArguments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
    25202515{
    2521     return emitCall(m_inTailPosition ? op_tail_call : op_call, dst, func, expectedFunction, callArguments, divot, divotStart, divotEnd);
     2516    // FIXME: We should be emitting a new op_tail_call here when
     2517    // m_inTailPosition is false
     2518    // https://bugs.webkit.org/show_bug.cgi?id=148661
     2519    return emitCall(op_call, dst, func, expectedFunction, callArguments, divot, divotStart, divotEnd);
    25222520}
    25232521
     
    26042602RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, RegisterID* func, ExpectedFunction expectedFunction, CallArguments& callArguments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
    26052603{
    2606     ASSERT(opcodeID == op_call || opcodeID == op_call_eval || opcodeID == op_tail_call);
     2604    ASSERT(opcodeID == op_call || opcodeID == op_call_eval);
    26072605    ASSERT(func->refCount());
    26082606
     
    26202618            argumentRegister = expression->emitBytecode(*this, callArguments.argumentRegister(0));
    26212619            RefPtr<RegisterID> thisRegister = emitMove(newTemporary(), callArguments.thisRegister());
    2622             return emitCallVarargs(opcodeID == op_tail_call ? op_tail_call_varargs : op_call_varargs, dst, func, callArguments.thisRegister(), argumentRegister.get(), newTemporary(), 0, callArguments.profileHookRegister(), divot, divotStart, divotEnd);
     2620            return emitCallVarargs(dst, func, callArguments.thisRegister(), argumentRegister.get(), newTemporary(), 0, callArguments.profileHookRegister(), divot, divotStart, divotEnd);
    26232621        }
    26242622        for (; n; n = n->m_next)
     
    26732671RegisterID* BytecodeGenerator::emitCallVarargsInTailPosition(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* arguments, RegisterID* firstFreeRegister, int32_t firstVarArgOffset, RegisterID* profileHookRegister, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
    26742672{
    2675     return emitCallVarargs(m_inTailPosition ? op_tail_call_varargs : op_call_varargs, dst, func, thisRegister, arguments, firstFreeRegister, firstVarArgOffset, profileHookRegister, divot, divotStart, divotEnd);
     2673    // FIXME: We should be emitting a new op_tail_call here when
     2674    // m_inTailPosition is false
     2675    // https://bugs.webkit.org/show_bug.cgi?id=148661
     2676    return emitCallVarargs(op_call_varargs, dst, func, thisRegister, arguments, firstFreeRegister, firstVarArgOffset, profileHookRegister, divot, divotStart, divotEnd);
    26762677}
    26772678
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r189774 r189848  
    678678        m_argv[i] = generator.newTemporary();
    679679        ASSERT(static_cast<size_t>(i) == m_argv.size() - 1 || m_argv[i]->index() == m_argv[i + 1]->index() - 1);
    680     }
    681 
    682     // We need to ensure that the frame size is stack-aligned
    683     while ((JSStack::CallFrameHeaderSize + m_argv.size()) % stackAlignmentRegisters()) {
    684         m_argv.insert(0, generator.newTemporary());
    685         m_padding++;
    686680    }
    687681   
     
    27932787
    27942788    LabelScopePtr scope = generator.newLabelScope(LabelScope::NamedLabel, &m_name);
    2795     generator.emitNodeInTailPosition(dst, m_statement);
     2789    generator.emitNode(dst, m_statement);
    27962790
    27972791    generator.emitLabel(scope->breakTarget());
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r189774 r189848  
    742742    {
    743743        addVarArgChild(callee);
    744         size_t frameSize = JSStack::CallFrameHeaderSize + argCount;
    745         size_t alignedFrameSize = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), frameSize);
    746         size_t parameterSlots = alignedFrameSize - JSStack::CallerFrameAndPCSize;
    747 
     744        size_t parameterSlots = JSStack::CallFrameHeaderSize - JSStack::CallerFrameAndPCSize + argCount;
    748745        if (parameterSlots > m_parameterSlots)
    749746            m_parameterSlots = parameterSlots;
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp

    r189774 r189848  
    43304330    void compileCallOrConstruct()
    43314331    {
    4332         int numArgs = m_node->numChildren() - 1;
     4332        int numPassedArgs = m_node->numChildren() - 1;
     4333        int numArgs = numPassedArgs;
    43334334
    43344335        LValue jsCallee = lowJSValue(m_graph.varArgChild(m_node, 0));
    43354336
    43364337        unsigned stackmapID = m_stackmapIDs++;
    4337 
    4338         unsigned frameSize = JSStack::CallFrameHeaderSize + numArgs;
    4339         unsigned alignedFrameSize = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), frameSize);
    4340         unsigned padding = alignedFrameSize - frameSize;
    4341 
     4338       
    43424339        Vector<LValue> arguments;
    43434340        arguments.append(m_out.constInt64(stackmapID));
    43444341        arguments.append(m_out.constInt32(sizeOfCall()));
    43454342        arguments.append(constNull(m_out.ref8));
    4346         arguments.append(m_out.constInt32(1 + alignedFrameSize - JSStack::CallerFrameAndPCSize));
     4343        arguments.append(m_out.constInt32(1 + JSStack::CallFrameHeaderSize - JSStack::CallerFrameAndPCSize + numArgs));
    43474344        arguments.append(jsCallee); // callee -> %rax
    43484345        arguments.append(getUndef(m_out.int64)); // code block
    43494346        arguments.append(jsCallee); // callee -> stack
    43504347        arguments.append(m_out.constInt64(numArgs)); // argument count and zeros for the tag
    4351         for (int i = 0; i < numArgs; ++i)
     4348        for (int i = 0; i < numPassedArgs; ++i)
    43524349            arguments.append(lowJSValue(m_graph.varArgChild(m_node, 1 + i)));
    4353         for (unsigned i = 0; i < padding; ++i)
    4354             arguments.append(getUndef(m_out.int64));
    43554350       
    43564351        callPreflight();
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.h

    r189774 r189848  
    254254        void dumpRegisters(CallFrame*);
    255255       
    256         bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call) || opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval) || opcode == getOpcode(op_tail_call); }
     256        bool isCallBytecode(Opcode opcode) { return opcode == getOpcode(op_call) || opcode == getOpcode(op_construct) || opcode == getOpcode(op_call_eval); }
    257257
    258258        void enableSampler();
  • trunk/Source/JavaScriptCore/jit/CCallHelpers.h

    r189775 r189848  
    3131#include "AssemblyHelpers.h"
    3232#include "GPRInfo.h"
    33 #include "StackAlignment.h"
    3433
    3534namespace JSC {
     
    20842083        jump(GPRInfo::regT1);
    20852084    }
    2086 
    2087     void prepareForTailCallSlow(GPRReg calleeGPR = InvalidGPRReg)
    2088     {
    2089         GPRReg temp1 = calleeGPR == GPRInfo::regT0 ? GPRInfo::regT3 : GPRInfo::regT0;
    2090         GPRReg temp2 = calleeGPR == GPRInfo::regT1 ? GPRInfo::regT3 : GPRInfo::regT1;
    2091         GPRReg temp3 = calleeGPR == GPRInfo::regT2 ? GPRInfo::regT3 : GPRInfo::regT2;
    2092 
    2093         GPRReg newFramePointer = temp1;
    2094         GPRReg newFrameSizeGPR = temp2;
    2095         {
    2096             // The old frame size is its number of arguments (or number of
    2097             // parameters in case of arity fixup), plus the frame header size,
    2098             // aligned
    2099             GPRReg oldFrameSizeGPR = temp2;
    2100             {
    2101                 GPRReg argCountGPR = oldFrameSizeGPR;
    2102                 load32(Address(framePointerRegister, JSStack::ArgumentCount * static_cast<int>(sizeof(Register)) + PayloadOffset), argCountGPR);
    2103 
    2104                 {
    2105                     GPRReg numParametersGPR = temp1;
    2106                     {
    2107                         GPRReg codeBlockGPR = numParametersGPR;
    2108                         loadPtr(Address(framePointerRegister, JSStack::CodeBlock * static_cast<int>(sizeof(Register))), codeBlockGPR);
    2109                         load32(Address(codeBlockGPR, CodeBlock::offsetOfNumParameters()), numParametersGPR);
    2110                     }
    2111 
    2112                     ASSERT(numParametersGPR != argCountGPR);
    2113                     Jump argumentCountWasNotFixedUp = branch32(BelowOrEqual, numParametersGPR, argCountGPR);
    2114                     move(numParametersGPR, argCountGPR);
    2115                     argumentCountWasNotFixedUp.link(this);
    2116                 }
    2117 
    2118                 add32(TrustedImm32(stackAlignmentRegisters() + JSStack::CallFrameHeaderSize - 1), argCountGPR, oldFrameSizeGPR);
    2119                 and32(TrustedImm32(-stackAlignmentRegisters()), oldFrameSizeGPR);
    2120                 // We assume < 2^28 arguments
    2121                 mul32(TrustedImm32(sizeof(Register)), oldFrameSizeGPR, oldFrameSizeGPR);
    2122             }
    2123 
    2124             // The new frame pointer is at framePointer + oldFrameSize - newFrameSize
    2125             ASSERT(newFramePointer != oldFrameSizeGPR);
    2126             move(framePointerRegister, newFramePointer);
    2127             addPtr(oldFrameSizeGPR, newFramePointer);
    2128 
    2129             // The new frame size is just the number of arguments plus the
    2130             // frame header size, aligned
    2131             ASSERT(newFrameSizeGPR != newFramePointer);
    2132             load32(Address(stackPointerRegister, JSStack::ArgumentCount * static_cast<int>(sizeof(Register)) + PayloadOffset - sizeof(CallerFrameAndPC)),
    2133                 newFrameSizeGPR);
    2134             add32(TrustedImm32(stackAlignmentRegisters() + JSStack::CallFrameHeaderSize - 1), newFrameSizeGPR);
    2135             and32(TrustedImm32(-stackAlignmentRegisters()), newFrameSizeGPR);
    2136             // We assume < 2^28 arguments
    2137             mul32(TrustedImm32(sizeof(Register)), newFrameSizeGPR, newFrameSizeGPR);
    2138         }
    2139 
    2140         GPRReg tempGPR = temp3;
    2141         ASSERT(tempGPR != newFramePointer && tempGPR != newFrameSizeGPR);
    2142 
    2143         // We don't need the current frame beyond this point. Masquerade as our
    2144         // caller.
    2145 #if CPU(ARM) || CPU(SH4) || CPU(ARM64)
    2146         loadPtr(Address(framePointerRegister, sizeof(void*)), linkRegister);
    2147         subPtr(TrustedImm32(2 * sizeof(void*)), newFrameSizeGPR);
    2148 #elif CPU(MIPS)
    2149         loadPtr(Address(framePointerRegister, sizeof(void*)), returnAddressRegister);
    2150         subPtr(TrustedImm32(2 * sizeof(void*)), newFrameSizeGPR);
    2151 #elif CPU(X86) || CPU(X86_64)
    2152         loadPtr(Address(framePointerRegister, sizeof(void*)), tempGPR);
    2153         push(tempGPR);
    2154         subPtr(TrustedImm32(sizeof(void*)), newFrameSizeGPR);
    2155 #else
    2156         UNREACHABLE_FOR_PLATFORM();
    2157 #endif
    2158         subPtr(newFrameSizeGPR, newFramePointer);
    2159         loadPtr(Address(framePointerRegister), framePointerRegister);
    2160 
    2161 
    2162         // We need to move the newFrameSizeGPR slots above the stack pointer by
    2163         // newFramePointer registers. We use pointer-sized chunks.
    2164         MacroAssembler::Label copyLoop(label());
    2165 
    2166         subPtr(TrustedImm32(sizeof(void*)), newFrameSizeGPR);
    2167         loadPtr(BaseIndex(stackPointerRegister, newFrameSizeGPR, TimesOne), tempGPR);
    2168         storePtr(tempGPR, BaseIndex(newFramePointer, newFrameSizeGPR, TimesOne));
    2169 
    2170         branchTest32(MacroAssembler::NonZero, newFrameSizeGPR).linkTo(copyLoop, this);
    2171 
    2172         // Ready for a jump!
    2173         move(newFramePointer, stackPointerRegister);
    2174     }
    21752085};
    21762086
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r189774 r189848  
    198198        DEFINE_OP(op_bitxor)
    199199        DEFINE_OP(op_call)
    200         DEFINE_OP(op_tail_call)
    201200        DEFINE_OP(op_call_eval)
    202201        DEFINE_OP(op_call_varargs)
    203         DEFINE_OP(op_tail_call_varargs)
    204202        DEFINE_OP(op_construct_varargs)
    205203        DEFINE_OP(op_catch)
     
    374372        DEFINE_SLOWCASE_OP(op_bitxor)
    375373        DEFINE_SLOWCASE_OP(op_call)
    376         DEFINE_SLOWCASE_OP(op_tail_call)
    377374        DEFINE_SLOWCASE_OP(op_call_eval)
    378375        DEFINE_SLOWCASE_OP(op_call_varargs)
    379         DEFINE_SLOWCASE_OP(op_tail_call_varargs)
    380376        DEFINE_SLOWCASE_OP(op_construct_varargs)
    381377        DEFINE_SLOWCASE_OP(op_construct)
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r189774 r189848  
    488488        void emit_op_bitxor(Instruction*);
    489489        void emit_op_call(Instruction*);
    490         void emit_op_tail_call(Instruction*);
    491490        void emit_op_call_eval(Instruction*);
    492491        void emit_op_call_varargs(Instruction*);
    493         void emit_op_tail_call_varargs(Instruction*);
    494492        void emit_op_construct_varargs(Instruction*);
    495493        void emit_op_catch(Instruction*);
     
    603601        void emitSlow_op_bitxor(Instruction*, Vector<SlowCaseEntry>::iterator&);
    604602        void emitSlow_op_call(Instruction*, Vector<SlowCaseEntry>::iterator&);
    605         void emitSlow_op_tail_call(Instruction*, Vector<SlowCaseEntry>::iterator&);
    606603        void emitSlow_op_call_eval(Instruction*, Vector<SlowCaseEntry>::iterator&);
    607604        void emitSlow_op_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
    608         void emitSlow_op_tail_call_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
    609605        void emitSlow_op_construct_varargs(Instruction*, Vector<SlowCaseEntry>::iterator&);
    610606        void emitSlow_op_construct(Instruction*, Vector<SlowCaseEntry>::iterator&);
     
    829825
    830826        Call emitNakedCall(CodePtr function = CodePtr());
    831         Call emitNakedTailCall(CodePtr function = CodePtr());
    832827
    833828        // Loads the character value of a single character string into dst.
  • trunk/Source/JavaScriptCore/jit/JITCall.cpp

    r189774 r189848  
    146146    COMPILE_ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_call_varargs), call_and_call_varargs_opcodes_must_be_same_length);
    147147    COMPILE_ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_construct_varargs), call_and_construct_varargs_opcodes_must_be_same_length);
    148     COMPILE_ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_tail_call), call_and_tail_call_opcodes_must_be_same_length);
    149     COMPILE_ASSERT(OPCODE_LENGTH(op_call) == OPCODE_LENGTH(op_tail_call_varargs), call_and_tail_call_varargs_opcodes_must_be_same_length);
    150148    CallLinkInfo* info;
    151149    if (opcodeID != op_call_eval)
    152150        info = m_codeBlock->addCallLinkInfo();
    153     if (opcodeID == op_call_varargs || opcodeID == op_construct_varargs || opcodeID == op_tail_call_varargs)
     151    if (opcodeID == op_call_varargs || opcodeID == op_construct_varargs)
    154152        compileSetupVarargsFrame(instruction, info);
    155153    else {
     
    175173
    176174    store64(regT0, Address(stackPointerRegister, JSStack::Callee * static_cast<int>(sizeof(Register)) - sizeof(CallerFrameAndPC)));
    177 
     175   
    178176    if (opcodeID == op_call_eval) {
    179177        compileCallEval(instruction);
    180178        return;
    181179    }
    182 
    183     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs)
    184         emitRestoreCalleeSaves();
    185180
    186181    DataLabelPtr addressOfLinkedFunctionCheck;
     
    194189    m_callCompilationInfo[callLinkInfoIndex].callLinkInfo = info;
    195190
    196     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs) {
    197         prepareForTailCallSlow();
    198         m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedTailCall();
    199         return;
    200     }
    201 
    202191    m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
    203192
     
    220209
    221210    move(TrustedImmPtr(m_callCompilationInfo[callLinkInfoIndex].callLinkInfo), regT2);
    222 
    223211    m_callCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(m_vm->getCTIStub(linkCallThunkGenerator).code());
    224212
    225     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs) {
    226         abortWithReason(JITDidReturnFromTailCall);
    227         return;
    228     }
    229 
    230213    addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister);
    231214    checkStackPointerAlignment();
     
    241224}
    242225
    243 void JIT::emit_op_tail_call(Instruction* currentInstruction)
    244 {
    245     compileOpCall(op_tail_call, currentInstruction, m_callLinkInfoIndex++);
    246 }
    247 
    248226void JIT::emit_op_call_eval(Instruction* currentInstruction)
    249227{
     
    255233    compileOpCall(op_call_varargs, currentInstruction, m_callLinkInfoIndex++);
    256234}
    257 
    258 void JIT::emit_op_tail_call_varargs(Instruction* currentInstruction)
    259 {
    260     compileOpCall(op_tail_call_varargs, currentInstruction, m_callLinkInfoIndex++);
    261 }
    262 
     235   
    263236void JIT::emit_op_construct_varargs(Instruction* currentInstruction)
    264237{
     
    274247{
    275248    compileOpCallSlowCase(op_call, currentInstruction, iter, m_callLinkInfoIndex++);
    276 }
    277 
    278 void JIT::emitSlow_op_tail_call(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    279 {
    280     compileOpCallSlowCase(op_tail_call, currentInstruction, iter, m_callLinkInfoIndex++);
    281249}
    282250
     
    290258    compileOpCallSlowCase(op_call_varargs, currentInstruction, iter, m_callLinkInfoIndex++);
    291259}
    292 
    293 void JIT::emitSlow_op_tail_call_varargs(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    294 {
    295     compileOpCallSlowCase(op_tail_call_varargs, currentInstruction, iter, m_callLinkInfoIndex++);
    296 }
    297260   
    298261void JIT::emitSlow_op_construct_varargs(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
  • trunk/Source/JavaScriptCore/jit/JITCall32_64.cpp

    r189774 r189848  
    7070}
    7171
    72 void JIT::emitSlow_op_tail_call(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    73 {
    74     compileOpCallSlowCase(op_tail_call, currentInstruction, iter, m_callLinkInfoIndex++);
    75 }
    76 
    7772void JIT::emitSlow_op_call_eval(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    7873{
     
    8479    compileOpCallSlowCase(op_call_varargs, currentInstruction, iter, m_callLinkInfoIndex++);
    8580}
    86 
    87 void JIT::emitSlow_op_tail_call_varargs(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
    88 {
    89     compileOpCallSlowCase(op_tail_call_varargs, currentInstruction, iter, m_callLinkInfoIndex++);
    90 }
    9181   
    9282void JIT::emitSlow_op_construct_varargs(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
     
    10595}
    10696
    107 void JIT::emit_op_tail_call(Instruction* currentInstruction)
    108 {
    109     compileOpCall(op_tail_call, currentInstruction, m_callLinkInfoIndex++);
    110 }
    111 
    11297void JIT::emit_op_call_eval(Instruction* currentInstruction)
    11398{
     
    118103{
    119104    compileOpCall(op_call_varargs, currentInstruction, m_callLinkInfoIndex++);
    120 }
    121 
    122 void JIT::emit_op_tail_call_varargs(Instruction* currentInstruction)
    123 {
    124     compileOpCall(op_tail_call_varargs, currentInstruction, m_callLinkInfoIndex++);
    125105}
    126106   
     
    231211    if (opcodeID != op_call_eval)
    232212        info = m_codeBlock->addCallLinkInfo();
    233     if (opcodeID == op_call_varargs || opcodeID == op_construct_varargs || opcodeID == op_tail_call_varargs)
     213    if (opcodeID == op_call_varargs || opcodeID == op_construct_varargs)
    234214        compileSetupVarargsFrame(instruction, info);
    235215    else {
     
    262242    }
    263243
    264     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs)
    265         emitRestoreCalleeSaves();
    266 
    267244    addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag)));
    268245
     
    279256
    280257    checkStackPointerAlignment();
    281     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs) {
    282         prepareForTailCallSlow();
    283         m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedTailCall();
    284         return;
    285     }
    286 
    287258    m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
    288259
     
    305276
    306277    move(TrustedImmPtr(m_callCompilationInfo[callLinkInfoIndex].callLinkInfo), regT2);
    307 
    308     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs)
    309         emitRestoreCalleeSaves();
    310 
    311278    m_callCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(m_vm->getCTIStub(linkCallThunkGenerator).code());
    312 
    313     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs) {
    314         abortWithReason(JITDidReturnFromTailCall);
    315         return;
    316     }
    317279
    318280    addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister);
  • trunk/Source/JavaScriptCore/jit/JITInlines.h

    r189774 r189848  
    126126}
    127127
    128 ALWAYS_INLINE JIT::Call JIT::emitNakedTailCall(CodePtr function)
    129 {
    130     ASSERT(m_bytecodeOffset != std::numeric_limits<unsigned>::max()); // This method should only be called during hot/cold path generation, so that m_bytecodeOffset is set.
    131     Call nakedCall = nearTailCall();
    132     m_calls.append(CallRecord(nakedCall, m_bytecodeOffset, function.executableAddress()));
    133     return nakedCall;
    134 }
    135 
    136128ALWAYS_INLINE void JIT::updateTopCallFrame()
    137129{
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r189805 r189848  
    683683}
    684684
    685 static SlowPathReturnType handleHostCall(ExecState* execCallee, JSValue callee, CallLinkInfo* callLinkInfo)
     685static void* handleHostCall(ExecState* execCallee, JSValue callee, CodeSpecializationKind kind)
    686686{
    687687    ExecState* exec = execCallee->callerFrame();
     
    690690    execCallee->setCodeBlock(0);
    691691
    692     if (callLinkInfo->specializationKind() == CodeForCall) {
     692    if (kind == CodeForCall) {
    693693        CallData callData;
    694694        CallType callType = getCallData(callee, callData);
     
    700700            execCallee->setCallee(asObject(callee));
    701701            vm->hostCallReturnValue = JSValue::decode(callData.native.function(execCallee));
    702             if (vm->exception()) {
    703                 return encodeResult(
    704                     vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(),
    705                     reinterpret_cast<void*>(KeepTheFrame));
    706             }
    707 
    708             return encodeResult(
    709                 bitwise_cast<void*>(getHostCallReturnValue),
    710                 reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame));
     702            if (vm->exception())
     703                return vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress();
     704
     705            return reinterpret_cast<void*>(getHostCallReturnValue);
    711706        }
    712707   
    713708        ASSERT(callType == CallTypeNone);
    714709        exec->vm().throwException(exec, createNotAFunctionError(exec, callee));
    715         return encodeResult(
    716             vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(),
    717             reinterpret_cast<void*>(KeepTheFrame));
    718     }
    719 
    720     ASSERT(callLinkInfo->specializationKind() == CodeForConstruct);
     710        return vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress();
     711    }
     712
     713    ASSERT(kind == CodeForConstruct);
    721714   
    722715    ConstructData constructData;
     
    729722        execCallee->setCallee(asObject(callee));
    730723        vm->hostCallReturnValue = JSValue::decode(constructData.native.function(execCallee));
    731         if (vm->exception()) {
    732             return encodeResult(
    733                 vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(),
    734                 reinterpret_cast<void*>(KeepTheFrame));
    735         }
    736 
    737         return encodeResult(bitwise_cast<void*>(getHostCallReturnValue), reinterpret_cast<void*>(KeepTheFrame));
     724        if (vm->exception())
     725            return vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress();
     726
     727        return reinterpret_cast<void*>(getHostCallReturnValue);
    738728    }
    739729   
    740730    ASSERT(constructType == ConstructTypeNone);
    741731    exec->vm().throwException(exec, createNotAConstructorError(exec, callee));
    742     return encodeResult(
    743         vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(),
    744         reinterpret_cast<void*>(KeepTheFrame));
    745 }
    746 
    747 SlowPathReturnType JIT_OPERATION operationLinkCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
     732    return vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress();
     733}
     734
     735char* JIT_OPERATION operationLinkCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    748736{
    749737    ExecState* exec = execCallee->callerFrame();
     
    758746        // expensive.
    759747        // https://bugs.webkit.org/show_bug.cgi?id=144458
    760         return handleHostCall(execCallee, calleeAsValue, callLinkInfo);
     748        return reinterpret_cast<char*>(handleHostCall(execCallee, calleeAsValue, kind));
    761749    }
    762750
     
    787775        if (!isCall(kind) && functionExecutable->constructAbility() == ConstructAbility::CannotConstruct) {
    788776            exec->vm().throwException(exec, createNotAConstructorError(exec, callee));
    789             return encodeResult(
    790                 vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(),
    791                 reinterpret_cast<void*>(KeepTheFrame));
     777            return reinterpret_cast<char*>(vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
    792778        }
    793779
     
    795781        if (error) {
    796782            exec->vm().throwException(exec, error);
    797             return encodeResult(
    798                 vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(),
    799                 reinterpret_cast<void*>(KeepTheFrame));
     783            return reinterpret_cast<char*>(vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
    800784        }
    801785        codeBlock = functionExecutable->codeBlockFor(kind);
    802786        ArityCheckMode arity;
    803         if (execCallee->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()) || callLinkInfo->isVarargs())
     787        if (execCallee->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()) || callLinkInfo->callType() == CallLinkInfo::CallVarargs || callLinkInfo->callType() == CallLinkInfo::ConstructVarargs)
    804788            arity = MustCheckArity;
    805789        else
     
    812796        linkFor(execCallee, *callLinkInfo, codeBlock, callee, codePtr);
    813797   
    814     return encodeResult(codePtr.executableAddress(), reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame));
    815 }
    816 
    817 inline SlowPathReturnType virtualForWithFunction(
     798    return reinterpret_cast<char*>(codePtr.executableAddress());
     799}
     800
     801inline char* virtualForWithFunction(
    818802    ExecState* execCallee, CallLinkInfo* callLinkInfo, JSCell*& calleeAsFunctionCell)
    819803{
     
    826810    calleeAsFunctionCell = getJSFunction(calleeAsValue);
    827811    if (UNLIKELY(!calleeAsFunctionCell))
    828         return handleHostCall(execCallee, calleeAsValue, callLinkInfo);
     812        return reinterpret_cast<char*>(handleHostCall(execCallee, calleeAsValue, kind));
    829813   
    830814    JSFunction* function = jsCast<JSFunction*>(calleeAsFunctionCell);
     
    841825            if (!isCall(kind) && functionExecutable->constructAbility() == ConstructAbility::CannotConstruct) {
    842826                exec->vm().throwException(exec, createNotAConstructorError(exec, function));
    843                 return encodeResult(
    844                     vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(),
    845                     reinterpret_cast<void*>(KeepTheFrame));
     827                return reinterpret_cast<char*>(vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
    846828            }
    847829
     
    849831            if (error) {
    850832                exec->vm().throwException(exec, error);
    851                 return encodeResult(
    852                     vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress(),
    853                     reinterpret_cast<void*>(KeepTheFrame));
     833                return reinterpret_cast<char*>(vm->getCTIStub(throwExceptionFromCallSlowPathGenerator).code().executableAddress());
    854834            }
    855835        } else {
     
    867847        }
    868848    }
    869     return encodeResult(executable->entrypointFor(
    870         *vm, kind, MustCheckArity, callLinkInfo->registerPreservationMode()).executableAddress(),
    871         reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame));
    872 }
    873 
    874 SlowPathReturnType JIT_OPERATION operationLinkPolymorphicCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
     849    return reinterpret_cast<char*>(executable->entrypointFor(
     850        *vm, kind, MustCheckArity, callLinkInfo->registerPreservationMode()).executableAddress());
     851}
     852
     853char* JIT_OPERATION operationLinkPolymorphicCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    875854{
    876855    ASSERT(callLinkInfo->specializationKind() == CodeForCall);
    877856    JSCell* calleeAsFunctionCell;
    878     SlowPathReturnType result = virtualForWithFunction(execCallee, callLinkInfo, calleeAsFunctionCell);
     857    char* result = virtualForWithFunction(execCallee, callLinkInfo, calleeAsFunctionCell);
    879858
    880859    linkPolymorphicCall(execCallee, *callLinkInfo, CallVariant(calleeAsFunctionCell));
     
    883862}
    884863
    885 SlowPathReturnType JIT_OPERATION operationVirtualCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
     864char* JIT_OPERATION operationVirtualCall(ExecState* execCallee, CallLinkInfo* callLinkInfo)
    886865{
    887866    JSCell* calleeAsFunctionCellIgnored;
  • trunk/Source/JavaScriptCore/jit/JITOperations.h

    r189774 r189848  
    238238typedef char* JIT_OPERATION (*P_JITOperation_EStZ)(ExecState*, Structure*, int32_t);
    239239typedef char* JIT_OPERATION (*P_JITOperation_EZZ)(ExecState*, int32_t, int32_t);
    240 typedef SlowPathReturnType JIT_OPERATION (*Sprt_JITOperation_ECli)(ExecState*, CallLinkInfo*);
    241240typedef StringImpl* JIT_OPERATION (*T_JITOperation_EJss)(ExecState*, JSString*);
    242241typedef JSString* JIT_OPERATION (*Jss_JITOperation_EZ)(ExecState*, int32_t);
     
    280279void JIT_OPERATION operationDirectPutByValGeneric(ExecState*, EncodedJSValue, EncodedJSValue, EncodedJSValue, ByValInfo*) WTF_INTERNAL;
    281280EncodedJSValue JIT_OPERATION operationCallEval(ExecState*, ExecState*) WTF_INTERNAL;
    282 SlowPathReturnType JIT_OPERATION operationLinkCall(ExecState*, CallLinkInfo*) WTF_INTERNAL;
    283 SlowPathReturnType JIT_OPERATION operationLinkPolymorphicCall(ExecState*, CallLinkInfo*) WTF_INTERNAL;
    284 SlowPathReturnType JIT_OPERATION operationVirtualCall(ExecState*, CallLinkInfo*) WTF_INTERNAL;
     281char* JIT_OPERATION operationLinkCall(ExecState*, CallLinkInfo*) WTF_INTERNAL;
     282char* JIT_OPERATION operationLinkPolymorphicCall(ExecState*, CallLinkInfo*) WTF_INTERNAL;
     283char* JIT_OPERATION operationVirtualCall(ExecState*, CallLinkInfo*) WTF_INTERNAL;
    285284
    286285size_t JIT_OPERATION operationCompareLess(ExecState*, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
  • trunk/Source/JavaScriptCore/jit/Repatch.cpp

    r189774 r189848  
    610610    CodeBlock* callerCodeBlock = exec->callerFrame()->codeBlock();
    611611    VM* vm = callerCodeBlock->vm();
    612 
     612   
    613613    if (shouldShowDisassemblyFor(callerCodeBlock))
    614614        dataLog("Linking virtual call at ", *callerCodeBlock, " ", exec->callerFrame()->codeOrigin(), "\n");
     
    681681            // If we cannot handle a callee, assume that it's better for this whole thing to be a
    682682            // virtual call.
    683             if (exec->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()) || callLinkInfo.isVarargs()) {
     683            if (exec->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()) || callLinkInfo.callType() == CallLinkInfo::CallVarargs || callLinkInfo.callType() == CallLinkInfo::ConstructVarargs) {
    684684                linkVirtualFor(exec, callLinkInfo);
    685685                return;
     
    804804                CCallHelpers::Address(fastCountsBaseGPR, caseIndex * sizeof(uint32_t)));
    805805        }
    806         if (callLinkInfo.isTailCall()) {
    807             stubJit.prepareForTailCallSlow();
    808             calls[caseIndex].call = stubJit.nearTailCall();
    809         } else
    810             calls[caseIndex].call = stubJit.nearCall();
     806        calls[caseIndex].call = stubJit.nearCall();
    811807        calls[caseIndex].codePtr = codePtr;
    812808        done.append(stubJit.jump());
  • trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp

    r189774 r189848  
    8080
    8181static void slowPathFor(
    82     CCallHelpers& jit, VM* vm, Sprt_JITOperation_ECli slowPathFunction)
     82    CCallHelpers& jit, VM* vm, P_JITOperation_ECli slowPathFunction)
    8383{
    8484    jit.emitFunctionPrologue();
    8585    jit.storePtr(GPRInfo::callFrameRegister, &vm->topCallFrame);
    86 #if OS(WINDOWS) && CPU(X86_64)
    87     // Windows X86_64 needs some space pointed to by arg0 for return types larger than 64 bits.
    88     // Other argument values are shift by 1. Use space on the stack for our two return values.
    89     // Moving the stack down maxFrameExtentForSlowPathCall bytes gives us room for our 3 arguments
    90     // and space for the 16 byte return area.
    91     jit.addPtr(CCallHelpers::TrustedImm32(-maxFrameExtentForSlowPathCall), CCallHelpers::stackPointerRegister);
    92     jit.move(GPRInfo::regT2, GPRInfo::argumentGPR2);
    93     jit.addPtr(CCallHelpers::TrustedImm32(32), CCallHelpers::stackPointerRegister, GPRInfo::argumentGPR0);
    94     jit.move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1);
    95     jit.move(CCallHelpers::TrustedImmPtr(bitwise_cast<void*>(slowPathFunction)), GPRInfo::nonArgGPR0);
    96     emitPointerValidation(jit, GPRInfo::nonArgGPR0);
    97     jit.call(GPRInfo::nonArgGPR0);
    98     jit.loadPtr(CCallHelpers::Address(GPRInfo::returnValueGPR, 8), GPRInfo::returnValueGPR2);
    99     jit.loadPtr(CCallHelpers::Address(GPRInfo::returnValueGPR), GPRInfo::returnValueGPR);
    100     jit.addPtr(CCallHelpers::TrustedImm32(maxFrameExtentForSlowPathCall), CCallHelpers::stackPointerRegister);
    101 #else
    10286    if (maxFrameExtentForSlowPathCall)
    10387        jit.addPtr(CCallHelpers::TrustedImm32(-maxFrameExtentForSlowPathCall), CCallHelpers::stackPointerRegister);
     
    10892    if (maxFrameExtentForSlowPathCall)
    10993        jit.addPtr(CCallHelpers::TrustedImm32(maxFrameExtentForSlowPathCall), CCallHelpers::stackPointerRegister);
    110 #endif
    111 
     94   
    11295    // This slow call will return the address of one of the following:
    11396    // 1) Exception throwing thunk.
    11497    // 2) Host call return value returner thingy.
    11598    // 3) The function to call.
    116     // The second return value GPR will hold a non-zero value for tail calls.
    117 
    11899    emitPointerValidation(jit, GPRInfo::returnValueGPR);
    119100    jit.emitFunctionEpilogue();
    120 
    121     RELEASE_ASSERT(reinterpret_cast<void*>(KeepTheFrame) == reinterpret_cast<void*>(0));
    122     CCallHelpers::Jump doNotTrash = jit.branchTestPtr(CCallHelpers::Zero, GPRInfo::returnValueGPR2);
    123 
    124     jit.preserveReturnAddressAfterCall(GPRInfo::nonPreservedNonReturnGPR);
    125     jit.prepareForTailCallSlow(GPRInfo::returnValueGPR);
    126 
    127     doNotTrash.link(&jit);
    128101    jit.jump(GPRInfo::returnValueGPR);
    129102}
     
    136109    // to be in regT0/regT1 (payload/tag), the CallFrame to have already
    137110    // been adjusted, and all other registers to be available for use.
     111   
    138112    CCallHelpers jit(vm);
    139113   
     
    212186    // Make a tail call. This will return back to JIT code.
    213187    emitPointerValidation(jit, GPRInfo::regT4);
    214     if (callLinkInfo.isTailCall()) {
    215         jit.preserveReturnAddressAfterCall(GPRInfo::regT0);
    216         jit.prepareForTailCallSlow(GPRInfo::regT4);
    217     }
    218188    jit.jump(GPRInfo::regT4);
    219189
     
    227197    return FINALIZE_CODE(
    228198        patchBuffer,
    229         ("Virtual %s slow path thunk",
    230         callLinkInfo.callMode() == CallMode::Regular ? "call" : callLinkInfo.callMode() == CallMode::Tail ? "tail call" : "construct"));
     199        ("Virtual %s%s slow path thunk",
     200        callLinkInfo.specializationKind() == CodeForCall ? "call" : "construct",
     201        callLinkInfo.registerPreservationMode() == MustPreserveRegisters ? " that preserves registers" : ""));
    231202}
    232203
     
    397368    JSInterfaceJIT jit(vm);
    398369
    399     // We enter with fixup count in argumentGPR0
     370    // We enter with fixup count, in aligned stack units, in argumentGPR0 and the return thunk in argumentGPR1
    400371    // We have the guarantee that a0, a1, a2, t3, t4 and t5 (or t0 for Windows) are all distinct :-)
    401372#if USE(JSVALUE64)
     
    408379    jit.pop(JSInterfaceJIT::regT4);
    409380#  endif
     381    jit.lshift32(JSInterfaceJIT::TrustedImm32(logStackAlignmentRegisters()), JSInterfaceJIT::argumentGPR0);
     382    jit.neg64(JSInterfaceJIT::argumentGPR0);
    410383    jit.move(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT3);
    411384    jit.load32(JSInterfaceJIT::Address(JSInterfaceJIT::callFrameRegister, JSStack::ArgumentCount * sizeof(Register)), JSInterfaceJIT::argumentGPR2);
    412385    jit.add32(JSInterfaceJIT::TrustedImm32(JSStack::CallFrameHeaderSize), JSInterfaceJIT::argumentGPR2);
    413 
    414     // Check to see if we have extra slots we can use
    415     jit.move(JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::argumentGPR1);
    416     jit.and32(JSInterfaceJIT::TrustedImm32(stackAlignmentRegisters() - 1), JSInterfaceJIT::argumentGPR1);
    417     JSInterfaceJIT::Jump noExtraSlot = jit.branchTest32(MacroAssembler::Zero, JSInterfaceJIT::argumentGPR1);
    418     jit.move(JSInterfaceJIT::TrustedImm64(ValueUndefined), extraTemp);
    419     JSInterfaceJIT::Label fillExtraSlots(jit.label());
    420     jit.store64(extraTemp, MacroAssembler::BaseIndex(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::argumentGPR2, JSInterfaceJIT::TimesEight));
    421     jit.add32(JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::argumentGPR2);
    422     jit.branchSub32(JSInterfaceJIT::NonZero, JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::argumentGPR1).linkTo(fillExtraSlots, &jit);
    423     jit.and32(JSInterfaceJIT::TrustedImm32(-stackAlignmentRegisters()), JSInterfaceJIT::argumentGPR0);
    424     JSInterfaceJIT::Jump done = jit.branchTest32(MacroAssembler::Zero, JSInterfaceJIT::argumentGPR0);
    425     noExtraSlot.link(&jit);
    426 
    427     jit.neg64(JSInterfaceJIT::argumentGPR0);
    428386
    429387    // Move current frame down argumentGPR0 number of slots
     
    434392    jit.branchSub32(MacroAssembler::NonZero, JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::argumentGPR2).linkTo(copyLoop, &jit);
    435393
    436     // Fill in argumentGPR0 missing arg slots with undefined
     394    // Fill in argumentGPR0 - 1 missing arg slots with undefined
    437395    jit.move(JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::argumentGPR2);
    438396    jit.move(JSInterfaceJIT::TrustedImm64(ValueUndefined), extraTemp);
     397    jit.add32(JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::argumentGPR2);
    439398    JSInterfaceJIT::Label fillUndefinedLoop(jit.label());
    440399    jit.store64(extraTemp, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::TimesEight));
     
    448407    jit.addPtr(extraTemp, JSInterfaceJIT::stackPointerRegister);
    449408
    450     done.link(&jit);
    451 
    452409#  if CPU(X86_64)
    453410    jit.push(JSInterfaceJIT::regT4);
     
    458415    jit.pop(JSInterfaceJIT::regT4);
    459416#  endif
     417    jit.lshift32(JSInterfaceJIT::TrustedImm32(logStackAlignmentRegisters()), JSInterfaceJIT::argumentGPR0);
     418    jit.neg32(JSInterfaceJIT::argumentGPR0);
    460419    jit.move(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT3);
    461420    jit.load32(JSInterfaceJIT::Address(JSInterfaceJIT::callFrameRegister, JSStack::ArgumentCount * sizeof(Register)), JSInterfaceJIT::argumentGPR2);
    462421    jit.add32(JSInterfaceJIT::TrustedImm32(JSStack::CallFrameHeaderSize), JSInterfaceJIT::argumentGPR2);
    463422
    464     // Check to see if we have extra slots we can use
    465     jit.move(JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::argumentGPR1);
    466     jit.and32(JSInterfaceJIT::TrustedImm32(stackAlignmentRegisters() - 1), JSInterfaceJIT::argumentGPR1);
    467     JSInterfaceJIT::Jump noExtraSlot = jit.branchTest32(MacroAssembler::Zero, JSInterfaceJIT::argumentGPR1);
    468     JSInterfaceJIT::Label fillExtraSlots(jit.label());
    469     jit.move(JSInterfaceJIT::TrustedImm32(0), JSInterfaceJIT::regT5);
    470     jit.store32(JSInterfaceJIT::regT5, MacroAssembler::BaseIndex(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::argumentGPR2, JSInterfaceJIT::TimesEight, PayloadOffset));
    471     jit.move(JSInterfaceJIT::TrustedImm32(JSValue::UndefinedTag), JSInterfaceJIT::regT5);
    472     jit.store32(JSInterfaceJIT::regT5, MacroAssembler::BaseIndex(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::argumentGPR2, JSInterfaceJIT::TimesEight, TagOffset));
    473     jit.add32(JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::argumentGPR2);
    474     jit.branchSub32(JSInterfaceJIT::NonZero, JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::argumentGPR1).linkTo(fillExtraSlots, &jit);
    475     jit.and32(JSInterfaceJIT::TrustedImm32(-stackAlignmentRegisters()), JSInterfaceJIT::argumentGPR0);
    476     JSInterfaceJIT::Jump done = jit.branchTest32(MacroAssembler::Zero, JSInterfaceJIT::argumentGPR0);
    477     noExtraSlot.link(&jit);
    478 
    479     jit.neg32(JSInterfaceJIT::argumentGPR0);
    480 
    481423    // Move current frame down argumentGPR0 number of slots
    482424    JSInterfaceJIT::Label copyLoop(jit.label());
    483     jit.load32(MacroAssembler::Address(JSInterfaceJIT::regT3, PayloadOffset), JSInterfaceJIT::regT5);
    484     jit.store32(JSInterfaceJIT::regT5, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::TimesEight, PayloadOffset));
    485     jit.load32(MacroAssembler::Address(JSInterfaceJIT::regT3, TagOffset), JSInterfaceJIT::regT5);
    486     jit.store32(JSInterfaceJIT::regT5, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::TimesEight, TagOffset));
     425    jit.load32(JSInterfaceJIT::regT3, JSInterfaceJIT::regT5);
     426    jit.store32(JSInterfaceJIT::regT5, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::TimesEight));
     427    jit.load32(MacroAssembler::Address(JSInterfaceJIT::regT3, 4), JSInterfaceJIT::regT5);
     428    jit.store32(JSInterfaceJIT::regT5, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::TimesEight, 4));
    487429    jit.addPtr(JSInterfaceJIT::TrustedImm32(8), JSInterfaceJIT::regT3);
    488430    jit.branchSub32(MacroAssembler::NonZero, JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::argumentGPR2).linkTo(copyLoop, &jit);
    489431
    490     // Fill in argumentGPR0 missing arg slots with undefined
     432    // Fill in argumentGPR0 - 1 missing arg slots with undefined
    491433    jit.move(JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::argumentGPR2);
     434    jit.add32(JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::argumentGPR2);
    492435    JSInterfaceJIT::Label fillUndefinedLoop(jit.label());
    493436    jit.move(JSInterfaceJIT::TrustedImm32(0), JSInterfaceJIT::regT5);
    494     jit.store32(JSInterfaceJIT::regT5, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::TimesEight, PayloadOffset));
     437    jit.store32(JSInterfaceJIT::regT5, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::TimesEight));
    495438    jit.move(JSInterfaceJIT::TrustedImm32(JSValue::UndefinedTag), JSInterfaceJIT::regT5);
    496     jit.store32(JSInterfaceJIT::regT5, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::TimesEight, TagOffset));
     439    jit.store32(JSInterfaceJIT::regT5, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::argumentGPR0, JSInterfaceJIT::TimesEight, 4));
    497440
    498441    jit.addPtr(JSInterfaceJIT::TrustedImm32(8), JSInterfaceJIT::regT3);
     
    505448    jit.addPtr(JSInterfaceJIT::regT5, JSInterfaceJIT::stackPointerRegister);
    506449
    507     done.link(&jit);
    508 
    509450#  if CPU(X86)
    510451    jit.push(JSInterfaceJIT::regT4);
     
    515456    LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
    516457    return FINALIZE_CODE(patchBuffer, ("fixup arity"));
    517 }
    518 
    519 MacroAssemblerCodeRef unreachableGenerator(VM* vm)
    520 {
    521     JSInterfaceJIT jit(vm);
    522 
    523     jit.breakpoint();
    524 
    525     LinkBuffer patchBuffer(*vm, jit, GLOBAL_THUNK_ID);
    526     return FINALIZE_CODE(patchBuffer, ("unreachable thunk"));
    527458}
    528459
  • trunk/Source/JavaScriptCore/jit/ThunkGenerators.h

    r189774 r189848  
    3535
    3636class CallLinkInfo;
    37 class CCallHelpers;
    3837
    3938MacroAssemblerCodeRef throwExceptionFromCallSlowPathGenerator(VM*);
    4039
    41 MacroAssemblerCodeRef linkCallThunk(VM*, CallLinkInfo&, CodeSpecializationKind, RegisterPreservationMode);
    4240MacroAssemblerCodeRef linkCallThunkGenerator(VM*);
    4341MacroAssemblerCodeRef linkPolymorphicCallThunkGenerator(VM*);
     
    4947MacroAssemblerCodeRef nativeTailCallGenerator(VM*);
    5048MacroAssemblerCodeRef arityFixupGenerator(VM*);
    51 MacroAssemblerCodeRef unreachableGenerator(VM*);
    5249
    5350MacroAssemblerCodeRef baselineGetterReturnThunkGenerator(VM* vm);
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r189774 r189848  
    168168
    169169const StackAlignment = 16
    170 const StackAlignmentSlots = 2
    171170const StackAlignmentMask = StackAlignment - 1
    172171
     
    699698end
    700699
    701 macro callTargetFunction(callee)
     700macro callTargetFunction(callLinkInfo, calleeFramePtr)
     701    move calleeFramePtr, sp
    702702    if C_LOOP
    703         cloopCallJSFunction callee
     703        cloopCallJSFunction LLIntCallLinkInfo::machineCodeTarget[callLinkInfo]
    704704    else
    705         call callee
     705        call LLIntCallLinkInfo::machineCodeTarget[callLinkInfo]
    706706    end
    707707    restoreStackPointerAfterCall()
     
    709709end
    710710
    711 macro prepareForRegularCall(callee, temp1, temp2, temp3)
    712     addp CallerFrameAndPCSize, sp
    713 end
    714 
    715 # sp points to the new frame
    716 macro prepareForTailCall(callee, temp1, temp2, temp3)
    717     restoreCalleeSavesUsedByLLInt()
    718 
    719     loadi PayloadOffset + ArgumentCount[cfr], temp2
    720     loadp CodeBlock[cfr], temp1
    721     loadp CodeBlock::m_numParameters[temp1], temp1
    722     bilteq temp1, temp2, .noArityFixup
    723     move temp1, temp2
    724 
    725 .noArityFixup:
    726     # We assume < 2^28 arguments
    727     muli SlotSize, temp2
    728     addi StackAlignment - 1 + CallFrameHeaderSize, temp2
    729     andi ~StackAlignmentMask, temp2
    730 
    731     move cfr, temp1
    732     addp temp2, temp1
    733 
    734     loadi PayloadOffset + ArgumentCount[sp], temp2
    735     # We assume < 2^28 arguments
    736     muli SlotSize, temp2
    737     addi StackAlignment - 1 + CallFrameHeaderSize, temp2
    738     andi ~StackAlignmentMask, temp2
    739 
    740     if ARM or SH4 or ARM64 or C_LOOP or MIPS
    741         addp 2 * PtrSize, sp
    742         subi 2 * PtrSize, temp2
    743         loadp PtrSize[cfr], lr
    744     else
    745         addp PtrSize, sp
    746         subi PtrSize, temp2
    747         loadp PtrSize[cfr], temp3
    748         storep temp3, [sp]
    749     end
    750 
    751     subp temp2, temp1
    752     loadp [cfr], cfr
    753 
    754 .copyLoop:
    755     subi PtrSize, temp2
    756     loadp [sp, temp2, 1], temp3
    757     storep temp3, [temp1, temp2, 1]
    758     btinz temp2, .copyLoop
    759 
    760     move temp1, sp
    761     jmp callee
    762 end
    763 
    764 macro slowPathForCall(slowPath, prepareCall)
     711macro slowPathForCall(slowPath)
    765712    callCallSlowPath(
    766713        slowPath,
    767         # Those are r0 and r1
    768         macro (callee, calleeFramePtr)
    769             btpz calleeFramePtr, .dontUpdateSP
    770             move calleeFramePtr, sp
    771             prepareCall(callee, t2, t3, t4)
     714        macro (callee, calleeFrame)
     715            btpz calleeFrame, .dontUpdateSP
     716            if ARMv7
     717                addp CallerFrameAndPCSize, calleeFrame, calleeFrame
     718                move calleeFrame, sp
     719            else
     720                addp CallerFrameAndPCSize, calleeFrame, sp
     721            end
    772722        .dontUpdateSP:
    773             callTargetFunction(callee)
     723            if C_LOOP
     724                cloopCallJSFunction callee
     725            else
     726                call callee
     727            end
     728            restoreStackPointerAfterCall()
     729            dispatchAfterCall()
    774730        end)
    775731end
     
    14601416    traceExecution()
    14611417    arrayProfileForCall()
    1462     doCall(_llint_slow_path_call, prepareForRegularCall)
    1463 
    1464 _llint_op_tail_call:
    1465     traceExecution()
    1466     arrayProfileForCall()
    1467     checkSwitchToJITForEpilogue()
    1468     doCall(_llint_slow_path_call, prepareForTailCall)
     1418    doCall(_llint_slow_path_call)
     1419
    14691420
    14701421_llint_op_construct:
    14711422    traceExecution()
    1472     doCall(_llint_slow_path_construct, prepareForRegularCall)
    1473 
    1474 macro doCallVarargs(slowPath, prepareCall)
     1423    doCall(_llint_slow_path_construct)
     1424
     1425
     1426_llint_op_call_varargs:
     1427    traceExecution()
    14751428    callSlowPath(_llint_slow_path_size_frame_for_varargs)
    14761429    branchIfException(_llint_throw_from_slow_path_trampoline)
     
    14871440        end
    14881441    end
    1489     slowPathForCall(slowPath, prepareCall)
    1490 end
    1491 
    1492 _llint_op_call_varargs:
    1493     traceExecution()
    1494     doCallVarargs(_llint_slow_path_call_varargs, prepareForRegularCall)
    1495 
    1496 _llint_op_tail_call_varargs:
    1497     traceExecution()
    1498     checkSwitchToJITForEpilogue()
    1499     # We lie and perform the tail call instead of preparing it since we can't
    1500     # prepare the frame for a call opcode
    1501     doCallVarargs(_llint_slow_path_call_varargs, prepareForTailCall)
     1442    slowPathForCall(_llint_slow_path_call_varargs)
    15021443
    15031444_llint_op_construct_varargs:
    15041445    traceExecution()
    1505     doCallVarargs(_llint_slow_path_construct_varargs, prepareForRegularCall)
     1446    callSlowPath(_llint_slow_path_size_frame_for_varargs)
     1447    branchIfException(_llint_throw_from_slow_path_trampoline)
     1448    # calleeFrame in r1
     1449    if JSVALUE64
     1450        move r1, sp
     1451    else
     1452        # The calleeFrame is not stack aligned, move down by CallerFrameAndPCSize to align
     1453        if ARMv7
     1454            subp r1, CallerFrameAndPCSize, t2
     1455            move t2, sp
     1456        else
     1457            subp r1, CallerFrameAndPCSize, sp
     1458        end
     1459    end
     1460    slowPathForCall(_llint_slow_path_construct_varargs)
    15061461
    15071462
     
    15421497    # returns the JS value that the eval returned.
    15431498   
    1544     slowPathForCall(_llint_slow_path_call_eval, prepareForRegularCall)
     1499    slowPathForCall(_llint_slow_path_call_eval)
    15451500
    15461501
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

    r189775 r189848  
    603603    loadi CommonSlowPaths::ArityCheckData::paddedStackSpace[r1], t1
    604604    btiz t1, .continue
     605
     606    // Move frame up "t1 * 2" slots
     607    lshiftp 1, t1
     608    negi t1
     609    move cfr, t3
    605610    loadi PayloadOffset + ArgumentCount[cfr], t2
    606611    addi CallFrameHeaderSlots, t2
    607 
    608     // Check if there are some unaligned slots we can use
    609     move t1, t3
    610     andi StackAlignmentSlots - 1, t3
    611     btiz t3, .noExtraSlot
    612 .fillExtraSlots:
    613     move 0, t0
    614     storei t0, PayloadOffset[cfr, t2, 8]
    615     move UndefinedTag, t0
    616     storei t0, TagOffset[cfr, t2, 8]
    617     addi 1, t2
    618     bsubinz 1, t3, .fillExtraSlots
    619     andi ~(StackAlignmentSlots - 1), t1
    620     btiz t1, .continue
    621 
    622 .noExtraSlot:
    623     // Move frame up t1 slots
    624     negi t1
    625     move cfr, t3
    626612.copyLoop:
    627613    loadi PayloadOffset[t3], t0
     
    17791765end
    17801766
    1781 macro doCall(slowPath, prepareCall)
     1767macro doCall(slowPath)
    17821768    loadi 8[PC], t0
    17831769    loadi 20[PC], t1
     
    17941780    storei t2, ArgumentCount + PayloadOffset[t3]
    17951781    storei CellTag, Callee + TagOffset[t3]
    1796     move t3, sp
    1797     prepareCall(LLIntCallLinkInfo::machineCodeTarget[t1], t2, t3, t4)
    1798     callTargetFunction(LLIntCallLinkInfo::machineCodeTarget[t1])
     1782    addp CallerFrameAndPCSize, t3
     1783    callTargetFunction(t1, t3)
    17991784
    18001785.opCallSlow:
    1801     slowPathForCall(slowPath, prepareCall)
    1802 end
     1786    slowPathForCall(slowPath)
     1787end
     1788
    18031789
    18041790_llint_op_ret:
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

    r189775 r189848  
    511511    loadi CommonSlowPaths::ArityCheckData::paddedStackSpace[r1], t1
    512512    btiz t1, .continue
    513     loadi PayloadOffset + ArgumentCount[cfr], t2
    514     addi CallFrameHeaderSlots, t2
    515 
    516     // Check if there are some unaligned slots we can use
    517     move t1, t3
    518     andi StackAlignmentSlots - 1, t3
    519     btiz t3, .noExtraSlot
    520     move ValueUndefined, t0
    521 .fillExtraSlots:
    522     storeq t0, [cfr, t2, 8]
    523     addi 1, t2
    524     bsubinz 1, t3, .fillExtraSlots
    525     andi ~(StackAlignmentSlots - 1), t1
    526     btiz t1, .continue
    527 
    528 .noExtraSlot:
    529     // Move frame up t1 slots
     513
     514    // Move frame up "t1 * 2" slots
     515    lshiftp 1, t1
    530516    negq t1
    531517    move cfr, t3
    532518    subp CalleeSaveSpaceAsVirtualRegisters * 8, t3
    533     addi CalleeSaveSpaceAsVirtualRegisters, t2
     519    loadi PayloadOffset + ArgumentCount[cfr], t2
     520    addi CallFrameHeaderSlots + CalleeSaveSpaceAsVirtualRegisters, t2
    534521.copyLoop:
    535522    loadq [t3], t0
     
    16671654end
    16681655
    1669 macro doCall(slowPath, prepareCall)
     1656macro doCall(slowPath)
    16701657    loadisFromInstruction(2, t0)
    16711658    loadpFromInstruction(5, t1)
     
    16811668    storei PC, ArgumentCount + TagOffset[cfr]
    16821669    storei t2, ArgumentCount + PayloadOffset[t3]
    1683     move t3, sp
    1684     prepareCall(LLIntCallLinkInfo::machineCodeTarget[t1], t2, t3, t4)
    1685     callTargetFunction(LLIntCallLinkInfo::machineCodeTarget[t1])
     1670    addp CallerFrameAndPCSize, t3
     1671    callTargetFunction(t1, t3)
    16861672
    16871673.opCallSlow:
    1688     slowPathForCall(slowPath, prepareCall)
    1689 end
     1674    slowPathForCall(slowPath)
     1675end
     1676
    16901677
    16911678_llint_op_ret:
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.h

    r189774 r189848  
    6060   
    6161    ASSERT(argumentCountIncludingThis < newCodeBlock->numParameters());
    62     int frameSize = argumentCountIncludingThis + JSStack::CallFrameHeaderSize;
    63     int alignedFrameSizeForParameters = WTF::roundUpToMultipleOf(stackAlignmentRegisters(),
    64         newCodeBlock->numParameters() + JSStack::CallFrameHeaderSize);
    65     int paddedStackSpace = alignedFrameSizeForParameters - frameSize;
    66 
    67     if (!stack->ensureCapacityFor(exec->registers() - paddedStackSpace % stackAlignmentRegisters()))
     62    int missingArgumentCount = newCodeBlock->numParameters() - argumentCountIncludingThis;
     63    int neededStackSpace = missingArgumentCount + 1; // Allow space to save the original return PC.
     64    int paddedStackSpace = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), neededStackSpace);
     65
     66    if (!stack->ensureCapacityFor(exec->registers() - paddedStackSpace))
    6867        return -1;
    69     return paddedStackSpace;
     68    return paddedStackSpace / stackAlignmentRegisters();
    7069}
    7170
Note: See TracChangeset for help on using the changeset viewer.