Changeset 102694 in webkit


Ignore:
Timestamp:
Dec 13, 2011 11:49:49 AM (12 years ago)
Author:
fpizlo@apple.com
Message:

DFG should know exactly why recompilation was triggered
https://bugs.webkit.org/show_bug.cgi?id=74362

Reviewed by Oliver Hunt.

Each OSR exit is now individually counted, as well as counting the total number
of OSR exits that occurred in a code block. If recompilation is triggered, we
check to see if there are OSR exit sites that make up a sufficiently large
portion of the total OSR exits that occurred. For any such OSR exit sites, we
add a description of the site (bytecode index, kind) to a data structure in the
corresponding baseline CodeBlock. Then, when we recompile the code, we immediately
know which speculations would be unwise based on the fact that previous such
speculations proved to be fruitless.

This means 2% win on two of the SunSpider string tests, a 4% win on V8's deltablue,
and 5% on Kraken's imaging-darkroom. It is only a minor win in the averages, less
than 0.5%.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Target.pri:
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::tallyFrequentExitSites):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::addFrequentExitSite):
(JSC::CodeBlock::exitProfile):
(JSC::CodeBlock::reoptimize):
(JSC::CodeBlock::tallyFrequentExitSites):

  • bytecode/DFGExitProfile.cpp: Added.

(JSC::DFG::ExitProfile::ExitProfile):
(JSC::DFG::ExitProfile::~ExitProfile):
(JSC::DFG::ExitProfile::add):
(JSC::DFG::QueryableExitProfile::QueryableExitProfile):
(JSC::DFG::QueryableExitProfile::~QueryableExitProfile):

  • bytecode/DFGExitProfile.h: Added.

(JSC::DFG::exitKindToString):
(JSC::DFG::exitKindIsCountable):
(JSC::DFG::FrequentExitSite::FrequentExitSite):
(JSC::DFG::FrequentExitSite::operator!):
(JSC::DFG::FrequentExitSite::operator==):
(JSC::DFG::FrequentExitSite::hash):
(JSC::DFG::FrequentExitSite::bytecodeOffset):
(JSC::DFG::FrequentExitSite::kind):
(JSC::DFG::FrequentExitSite::isHashTableDeletedValue):
(JSC::DFG::FrequentExitSiteHash::hash):
(JSC::DFG::FrequentExitSiteHash::equal):
(JSC::DFG::QueryableExitProfile::hasExitSite):

  • dfg/DFGAssemblyHelpers.h:

(JSC::DFG::AssemblyHelpers::baselineCodeBlockForOriginAndBaselineCodeBlock):
(JSC::DFG::AssemblyHelpers::baselineCodeBlockFor):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::makeSafe):
(JSC::DFG::ByteCodeParser::makeDivSafe):
(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::handleIntrinsic):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::OSRExit):
(JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):

  • dfg/DFGOSRExit.h:

(JSC::DFG::OSRExit::considerAddingAsFrequentExitSite):

  • dfg/DFGOSRExitCompiler.cpp:
  • dfg/DFGOSRExitCompiler32_64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGOSRExitCompiler64.cpp:

(JSC::DFG::OSRExitCompiler::compileExit):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):
(JSC::DFG::SpeculativeJIT::checkArgumentTypes):
(JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
(JSC::DFG::SpeculativeJIT::compileGetByValOnString):
(JSC::DFG::SpeculativeJIT::compilePutByValForByteArray):
(JSC::DFG::SpeculativeJIT::compileGetByValOnByteArray):
(JSC::DFG::SpeculativeJIT::compileGetTypedArrayLength):
(JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
(JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
(JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
(JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
(JSC::DFG::SpeculativeJIT::compileInstanceOfForObject):
(JSC::DFG::SpeculativeJIT::compileSoftModulo):
(JSC::DFG::SpeculativeJIT::compileArithMul):
(JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):

  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::speculationCheck):
(JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
(JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
(JSC::DFG::SpeculativeJIT::compileObjectEquality):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
(JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
(JSC::DFG::SpeculativeJIT::fillSpeculateCell):
(JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
(JSC::DFG::SpeculativeJIT::compileObjectEquality):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::compileLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):

  • runtime/Heuristics.cpp:

(JSC::Heuristics::initializeHeuristics):

  • runtime/Heuristics.h:
Location:
trunk/Source/JavaScriptCore
Files:
1 added
20 edited
1 copied

Legend:

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

    r101052 r102694  
    3636
    3737    bytecode/CodeBlock.cpp
     38    bytecode/DFGExitProfile.cpp
    3839    bytecode/JumpTable.cpp
    3940    bytecode/Opcode.cpp
  • trunk/Source/JavaScriptCore/ChangeLog

    r102692 r102694  
     12011-12-13  Filip Pizlo  <fpizlo@apple.com>
     2
     3        DFG should know exactly why recompilation was triggered
     4        https://bugs.webkit.org/show_bug.cgi?id=74362
     5
     6        Reviewed by Oliver Hunt.
     7       
     8        Each OSR exit is now individually counted, as well as counting the total number
     9        of OSR exits that occurred in a code block. If recompilation is triggered, we
     10        check to see if there are OSR exit sites that make up a sufficiently large
     11        portion of the total OSR exits that occurred. For any such OSR exit sites, we
     12        add a description of the site (bytecode index, kind) to a data structure in the
     13        corresponding baseline CodeBlock. Then, when we recompile the code, we immediately
     14        know which speculations would be unwise based on the fact that previous such
     15        speculations proved to be fruitless.
     16       
     17        This means 2% win on two of the SunSpider string tests, a 4% win on V8's deltablue,
     18        and 5% on Kraken's imaging-darkroom. It is only a minor win in the averages, less
     19        than 0.5%.
     20
     21        * CMakeLists.txt:
     22        * GNUmakefile.list.am:
     23        * JavaScriptCore.xcodeproj/project.pbxproj:
     24        * Target.pri:
     25        * bytecode/CodeBlock.cpp:
     26        (JSC::CodeBlock::tallyFrequentExitSites):
     27        * bytecode/CodeBlock.h:
     28        (JSC::CodeBlock::addFrequentExitSite):
     29        (JSC::CodeBlock::exitProfile):
     30        (JSC::CodeBlock::reoptimize):
     31        (JSC::CodeBlock::tallyFrequentExitSites):
     32        * bytecode/DFGExitProfile.cpp: Added.
     33        (JSC::DFG::ExitProfile::ExitProfile):
     34        (JSC::DFG::ExitProfile::~ExitProfile):
     35        (JSC::DFG::ExitProfile::add):
     36        (JSC::DFG::QueryableExitProfile::QueryableExitProfile):
     37        (JSC::DFG::QueryableExitProfile::~QueryableExitProfile):
     38        * bytecode/DFGExitProfile.h: Added.
     39        (JSC::DFG::exitKindToString):
     40        (JSC::DFG::exitKindIsCountable):
     41        (JSC::DFG::FrequentExitSite::FrequentExitSite):
     42        (JSC::DFG::FrequentExitSite::operator!):
     43        (JSC::DFG::FrequentExitSite::operator==):
     44        (JSC::DFG::FrequentExitSite::hash):
     45        (JSC::DFG::FrequentExitSite::bytecodeOffset):
     46        (JSC::DFG::FrequentExitSite::kind):
     47        (JSC::DFG::FrequentExitSite::isHashTableDeletedValue):
     48        (JSC::DFG::FrequentExitSiteHash::hash):
     49        (JSC::DFG::FrequentExitSiteHash::equal):
     50        (JSC::DFG::QueryableExitProfile::hasExitSite):
     51        * dfg/DFGAssemblyHelpers.h:
     52        (JSC::DFG::AssemblyHelpers::baselineCodeBlockForOriginAndBaselineCodeBlock):
     53        (JSC::DFG::AssemblyHelpers::baselineCodeBlockFor):
     54        * dfg/DFGByteCodeParser.cpp:
     55        (JSC::DFG::ByteCodeParser::makeSafe):
     56        (JSC::DFG::ByteCodeParser::makeDivSafe):
     57        (JSC::DFG::ByteCodeParser::handleCall):
     58        (JSC::DFG::ByteCodeParser::handleIntrinsic):
     59        (JSC::DFG::ByteCodeParser::parseBlock):
     60        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
     61        * dfg/DFGOSRExit.cpp:
     62        (JSC::DFG::OSRExit::OSRExit):
     63        (JSC::DFG::OSRExit::considerAddingAsFrequentExitSiteSlow):
     64        * dfg/DFGOSRExit.h:
     65        (JSC::DFG::OSRExit::considerAddingAsFrequentExitSite):
     66        * dfg/DFGOSRExitCompiler.cpp:
     67        * dfg/DFGOSRExitCompiler32_64.cpp:
     68        (JSC::DFG::OSRExitCompiler::compileExit):
     69        * dfg/DFGOSRExitCompiler64.cpp:
     70        (JSC::DFG::OSRExitCompiler::compileExit):
     71        * dfg/DFGSpeculativeJIT.cpp:
     72        (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality):
     73        (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
     74        (JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
     75        (JSC::DFG::SpeculativeJIT::compileGetByValOnString):
     76        (JSC::DFG::SpeculativeJIT::compilePutByValForByteArray):
     77        (JSC::DFG::SpeculativeJIT::compileGetByValOnByteArray):
     78        (JSC::DFG::SpeculativeJIT::compileGetTypedArrayLength):
     79        (JSC::DFG::SpeculativeJIT::compileGetByValOnIntTypedArray):
     80        (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray):
     81        (JSC::DFG::SpeculativeJIT::compileGetByValOnFloatTypedArray):
     82        (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray):
     83        (JSC::DFG::SpeculativeJIT::compileInstanceOfForObject):
     84        (JSC::DFG::SpeculativeJIT::compileSoftModulo):
     85        (JSC::DFG::SpeculativeJIT::compileArithMul):
     86        (JSC::DFG::SpeculativeJIT::compileGetIndexedPropertyStorage):
     87        * dfg/DFGSpeculativeJIT.h:
     88        (JSC::DFG::SpeculativeJIT::speculationCheck):
     89        (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution):
     90        * dfg/DFGSpeculativeJIT32_64.cpp:
     91        (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
     92        (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
     93        (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
     94        (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
     95        (JSC::DFG::SpeculativeJIT::compileObjectEquality):
     96        (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
     97        (JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
     98        (JSC::DFG::SpeculativeJIT::compile):
     99        * dfg/DFGSpeculativeJIT64.cpp:
     100        (JSC::DFG::SpeculativeJIT::fillSpeculateIntInternal):
     101        (JSC::DFG::SpeculativeJIT::fillSpeculateDouble):
     102        (JSC::DFG::SpeculativeJIT::fillSpeculateCell):
     103        (JSC::DFG::SpeculativeJIT::fillSpeculateBoolean):
     104        (JSC::DFG::SpeculativeJIT::compileObjectEquality):
     105        (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
     106        (JSC::DFG::SpeculativeJIT::compileLogicalNot):
     107        (JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
     108        (JSC::DFG::SpeculativeJIT::emitBranch):
     109        (JSC::DFG::SpeculativeJIT::compile):
     110        * runtime/Heuristics.cpp:
     111        (JSC::Heuristics::initializeHeuristics):
     112        * runtime/Heuristics.h:
     113
    11142011-12-13  Michael Saboff  <msaboff@apple.com>
    2115
  • trunk/Source/JavaScriptCore/GNUmakefile.list.am

    r102564 r102694  
    8686        Source/JavaScriptCore/bytecode/CodeOrigin.h \
    8787        Source/JavaScriptCore/bytecode/DataFormat.h \
     88        Source/JavaScriptCore/bytecode/DFGExitProfile.cpp \
     89        Source/JavaScriptCore/bytecode/DFGExitProfile.h \
    8890        Source/JavaScriptCore/bytecode/EvalCodeCache.h \
    8991        Source/JavaScriptCore/bytecode/Instruction.h \
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r102167 r102694  
    7373                0F963B2F13FC66BB0002D9B2 /* MetaAllocatorHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F963B2E13FC66AE0002D9B2 /* MetaAllocatorHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
    7474                0F963B3813FC6FE90002D9B2 /* ValueProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F963B3613FC6FDE0002D9B2 /* ValueProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
     75                0FBC0AE71496C7C400D4FBDD /* DFGExitProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */; };
     76                0FBC0AE81496C7C700D4FBDD /* DFGExitProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
    7577                0FBD7E691447999600481315 /* CodeOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FBD7E671447998F00481315 /* CodeOrigin.h */; settings = {ATTRIBUTES = (Private, ); }; };
    7678                0FC0976A1468A6F700CF2442 /* DFGOSRExit.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC097681468A6EF00CF2442 /* DFGOSRExit.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    852854                0F963B2E13FC66AE0002D9B2 /* MetaAllocatorHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetaAllocatorHandle.h; sourceTree = "<group>"; };
    853855                0F963B3613FC6FDE0002D9B2 /* ValueProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueProfile.h; sourceTree = "<group>"; };
     856                0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFGExitProfile.cpp; sourceTree = "<group>"; };
     857                0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFGExitProfile.h; sourceTree = "<group>"; };
    854858                0FBD7E671447998F00481315 /* CodeOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeOrigin.h; sourceTree = "<group>"; };
    855859                0FC097681468A6EF00CF2442 /* DFGOSRExit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOSRExit.h; path = dfg/DFGOSRExit.h; sourceTree = "<group>"; };
     
    24612465                        isa = PBXGroup;
    24622466                        children = (
     2467                                0FBC0AE41496C7C100D4FBDD /* DFGExitProfile.cpp */,
     2468                                0FBC0AE51496C7C100D4FBDD /* DFGExitProfile.h */,
    24632469                                0F426A4A1460CD6B00131F8F /* DataFormat.h */,
    24642470                                0F426A451460CBAB00131F8F /* ValueRecovery.h */,
     
    29822988                                A73BE180148420A80091204B /* IntegralTypedArrayBase.h in Headers */,
    29832989                                860BD801148EA6F200112B2F /* Intrinsic.h in Headers */,
     2990                                0FBC0AE81496C7C700D4FBDD /* DFGExitProfile.h in Headers */,
    29842991                        );
    29852992                        runOnlyForDeploymentPostprocessing = 0;
     
    35193526                                A73BE168148420520091204B /* ArrayBuffer.cpp in Sources */,
    35203527                                A73BE16A148420520091204B /* ArrayBufferView.cpp in Sources */,
     3528                                0FBC0AE71496C7C400D4FBDD /* DFGExitProfile.cpp in Sources */,
    35213529                        );
    35223530                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/JavaScriptCore/Target.pri

    r101253 r102694  
    5656    assembler/MacroAssemblerSH4.cpp \
    5757    bytecode/CodeBlock.cpp \
     58    bytecode/DFGExitProfile.cpp \
    5859    bytecode/JumpTable.cpp \
    5960    bytecode/Opcode.cpp \
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r102489 r102694  
    22422242#endif
    22432243
     2244#if ENABLE(DFG_JIT)
     2245void CodeBlock::tallyFrequentExitSites()
     2246{
     2247    ASSERT(getJITType() == JITCode::DFGJIT);
     2248    ASSERT(alternative()->getJITType() == JITCode::BaselineJIT);
     2249    ASSERT(!!m_dfgData);
     2250   
     2251    CodeBlock* profiledBlock = alternative();
     2252   
     2253    for (unsigned i = 0; i < m_dfgData->osrExit.size(); ++i) {
     2254        DFG::OSRExit& exit = m_dfgData->osrExit[i];
     2255       
     2256        if (!exit.considerAddingAsFrequentExitSite(this, profiledBlock))
     2257            continue;
     2258       
     2259#if DFG_ENABLE(DEBUG_VERBOSE)
     2260        fprintf(stderr, "OSR exit #%u (bc#%u, @%u, %s) for code block %p occurred frequently; counting as frequent exit site.\n", i, exit.m_codeOrigin.bytecodeIndex, exit.m_nodeIndex, DFG::exitKindToString(exit.m_kind), this);
     2261#endif
     2262    }
     2263}
     2264#endif // ENABLE(DFG_JIT)
     2265
    22442266#if ENABLE(VERBOSE_VALUE_PROFILE)
    22452267void CodeBlock::dumpValueProfiles()
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r102545 r102694  
    3434#include "CompactJITCodeMap.h"
    3535#include "DFGCodeBlocks.h"
     36#include "DFGExitProfile.h"
    3637#include "DFGOSREntry.h"
    3738#include "DFGOSRExit.h"
     
    797798            return binarySearch<CodeOriginAtCallReturnOffset, unsigned, getCallReturnOffsetForCodeOrigin>(codeOrigins().begin(), codeOrigins().size(), getJITCode().offsetOf(returnAddress.value()))->codeOrigin;
    798799        }
     800       
     801        bool addFrequentExitSite(const DFG::FrequentExitSite& site)
     802        {
     803            ASSERT(getJITType() == JITCode::BaselineJIT);
     804            return m_exitProfile.add(site);
     805        }
     806
     807        DFG::ExitProfile& exitProfile() { return m_exitProfile; }
    799808#endif
    800809
     
    10661075        {
    10671076            ASSERT(replacement() != this);
     1077            ASSERT(replacement()->alternative() == this);
     1078            replacement()->tallyFrequentExitSites();
    10681079            replacement()->jettison();
    10691080            countReoptimization();
     
    10931104    private:
    10941105        friend class DFGCodeBlocks;
     1106       
     1107#if ENABLE(DFG_JIT)
     1108        void tallyFrequentExitSites();
     1109#else
     1110        void tallyFrequentExitSites() { }
     1111#endif
    10951112       
    10961113#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
     
    12131230       
    12141231        OwnPtr<DFGData> m_dfgData;
     1232       
     1233        // This is relevant to non-DFG code blocks that serve as the profiled code block
     1234        // for DFG code blocks.
     1235        DFG::ExitProfile m_exitProfile;
    12151236#endif
    12161237#if ENABLE(VALUE_PROFILER)
  • trunk/Source/JavaScriptCore/bytecode/DFGExitProfile.cpp

    r102693 r102694  
    2525
    2626#include "config.h"
    27 #include "DFGOSRExit.h"
     27#include "DFGExitProfile.h"
    2828
    29 #if ENABLE(DFG_JIT)
    30 
    31 #include "DFGSpeculativeJIT.h"
     29#include <wtf/PassOwnPtr.h>
    3230
    3331namespace JSC { namespace DFG {
    3432
    35 OSRExit::OSRExit(JSValueSource jsValueSource, ValueProfile* valueProfile, MacroAssembler::Jump check, SpeculativeJIT* jit, unsigned recoveryIndex)
    36     : m_jsValueSource(jsValueSource)
    37     , m_valueProfile(valueProfile)
    38     , m_check(check)
    39     , m_nodeIndex(jit->m_compileIndex)
    40     , m_codeOrigin(jit->m_codeOriginForOSR)
    41     , m_recoveryIndex(recoveryIndex)
    42     , m_arguments(jit->m_arguments.size())
    43     , m_variables(jit->m_variables.size())
    44     , m_lastSetOperand(jit->m_lastSetOperand)
     33ExitProfile::ExitProfile() { }
     34ExitProfile::~ExitProfile() { }
     35
     36bool ExitProfile::add(const FrequentExitSite& site)
    4537{
    46     ASSERT(m_codeOrigin.isSet());
    47     for (unsigned argument = 0; argument < m_arguments.size(); ++argument)
    48         m_arguments[argument] = jit->computeValueRecoveryFor(jit->m_arguments[argument]);
    49     for (unsigned variable = 0; variable < m_variables.size(); ++variable)
    50         m_variables[variable] = jit->computeValueRecoveryFor(jit->m_variables[variable]);
     38    // If we've never seen any frequent exits then create the list and put this site
     39    // into it.
     40    if (!m_frequentExitSites) {
     41        m_frequentExitSites = adoptPtr(new Vector<FrequentExitSite>());
     42        m_frequentExitSites->append(site);
     43        return true;
     44    }
     45   
     46    // Don't add it if it's already there. This is O(n), but that's OK, because we
     47    // know that the total number of places where code exits tends to not be large,
     48    // and this code is only used when recompilation is triggered.
     49    for (unsigned i = 0; i < m_frequentExitSites->size(); ++i) {
     50        if (m_frequentExitSites->at(i) == site)
     51            return false;
     52    }
     53   
     54    m_frequentExitSites->append(site);
     55    return true;
    5156}
    5257
    53 #ifndef NDEBUG
    54 void OSRExit::dump(FILE* out) const
     58QueryableExitProfile::QueryableExitProfile(const ExitProfile& profile)
    5559{
    56     for (unsigned argument = 0; argument < m_arguments.size(); ++argument)
    57         m_arguments[argument].dump(out);
    58     fprintf(out, " : ");
    59     for (unsigned variable = 0; variable < m_variables.size(); ++variable)
    60         m_variables[variable].dump(out);
     60    if (!profile.m_frequentExitSites)
     61        return;
     62   
     63    for (unsigned i = 0; i < profile.m_frequentExitSites->size(); ++i)
     64        m_frequentExitSites.add(profile.m_frequentExitSites->at(i));
    6165}
    62 #endif
     66
     67QueryableExitProfile::~QueryableExitProfile() { }
    6368
    6469} } // namespace JSC::DFG
    65 
    66 #endif // ENABLE(DFG_JIT)
  • trunk/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h

    r101334 r102694  
    285285    }
    286286   
    287     CodeBlock* baselineCodeBlockFor(const CodeOrigin& codeOrigin)
     287    static CodeBlock* baselineCodeBlockForOriginAndBaselineCodeBlock(const CodeOrigin& codeOrigin, CodeBlock* baselineCodeBlock)
    288288    {
    289289        if (codeOrigin.inlineCallFrame) {
     
    292292            return static_cast<FunctionExecutable*>(executable)->baselineCodeBlockFor(codeOrigin.inlineCallFrame->isCall ? CodeForCall : CodeForConstruct);
    293293        }
    294         return baselineCodeBlock();
     294        return baselineCodeBlock;
     295    }
     296   
     297    CodeBlock* baselineCodeBlockFor(const CodeOrigin& codeOrigin)
     298    {
     299        return baselineCodeBlockForOriginAndBaselineCodeBlock(codeOrigin, baselineCodeBlock());
    295300    }
    296301   
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r102545 r102694  
    632632    NodeIndex makeSafe(NodeIndex nodeIndex)
    633633    {
    634         if (!m_inlineStackTop->m_profiledBlock->likelyToTakeSlowCase(m_currentIndex))
     634        if (!m_inlineStackTop->m_profiledBlock->likelyToTakeSlowCase(m_currentIndex)
     635            && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow)
     636            && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, NegativeZero))
    635637            return nodeIndex;
    636638       
    637639#if DFG_ENABLE(DEBUG_VERBOSE)
    638         printf("Making %s @%u safe at bc#%u because slow-case counter is at %u\n", Graph::opName(m_graph[nodeIndex].op), nodeIndex, m_currentIndex, m_inlineStackTop->m_profiledBlock->rareCaseProfileForBytecodeOffset(m_currentIndex)->m_counter);
     640        printf("Making %s @%u safe at bc#%u because slow-case counter is at %u and exit profiles say %d, %d\n", Graph::opName(m_graph[nodeIndex].op), nodeIndex, m_currentIndex, m_inlineStackTop->m_profiledBlock->rareCaseProfileForBytecodeOffset(m_currentIndex)->m_counter, m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow), m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, NegativeZero));
    639641#endif
    640642       
     
    649651           
    650652        case ArithMul:
    651             if (m_inlineStackTop->m_profiledBlock->likelyToTakeDeepestSlowCase(m_currentIndex)) {
     653            if (m_inlineStackTop->m_profiledBlock->likelyToTakeDeepestSlowCase(m_currentIndex)
     654                || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow)) {
    652655#if DFG_ENABLE(DEBUG_VERBOSE)
    653656                printf("Making ArithMul @%u take deepest slow case.\n", nodeIndex);
    654657#endif
    655658                m_graph[nodeIndex].mergeArithNodeFlags(NodeMayOverflow | NodeMayNegZero);
    656             } else {
     659            } else if (m_inlineStackTop->m_profiledBlock->likelyToTakeSlowCase(m_currentIndex)
     660                       || m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, NegativeZero)) {
    657661#if DFG_ENABLE(DEBUG_VERBOSE)
    658662                printf("Making ArithMul @%u take faster slow case.\n", nodeIndex);
     
    680684        // is what the special fast case counter tells us.
    681685       
    682         if (!m_inlineStackTop->m_profiledBlock->likelyToTakeSpecialFastCase(m_currentIndex))
     686        if (!m_inlineStackTop->m_profiledBlock->likelyToTakeSpecialFastCase(m_currentIndex)
     687            && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow)
     688            && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, NegativeZero))
    683689            return nodeIndex;
    684690       
    685691#if DFG_ENABLE(DEBUG_VERBOSE)
    686         printf("Making %s @%u safe at bc#%u because special fast-case counter is at %u\n", Graph::opName(m_graph[nodeIndex].op), nodeIndex, m_currentIndex, m_inlineStackTop->m_profiledBlock->specialFastCaseProfileForBytecodeOffset(m_currentIndex)->m_counter);
    687 #endif
    688        
     692        printf("Making %s @%u safe at bc#%u because special fast-case counter is at %u and exit profiles say %d, %d\n", Graph::opName(m_graph[nodeIndex].op), nodeIndex, m_currentIndex, m_inlineStackTop->m_profiledBlock->specialFastCaseProfileForBytecodeOffset(m_currentIndex)->m_counter, m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow), m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, NegativeZero));
     693#endif
     694       
     695        // FIXME: It might be possible to make this more granular. The DFG certainly can
     696        // distinguish between negative zero and overflow in its exit profiles.
    689697        m_graph[nodeIndex].mergeArithNodeFlags(NodeMayOverflow | NodeMayNegZero);
    690698       
     
    794802        ScriptExecutable* executable() { return m_codeBlock->ownerExecutable(); }
    795803       
     804        QueryableExitProfile m_exitProfile;
     805       
    796806        // Remapping of identifier and constant numbers from the code block being
    797807        // inlined (inline callee) to the code block that we're inlining into
     
    888898           
    889899#if DFG_ENABLE(DEBUG_VERBOSE)
    890     printf("Slow case count for call at @%lu bc#%u: %u/%u.\n", m_graph.size(), m_currentIndex, m_inlineStackTop->m_profiledBlock->rareCaseProfileForBytecodeOffset(m_currentIndex)->m_counter, m_inlineStackTop->m_profiledBlock->executionEntryCount());
     900    printf("Slow case count for call at @%lu bc#%u: %u/%u; exit profile: %d.\n", m_graph.size(), m_currentIndex, m_inlineStackTop->m_profiledBlock->rareCaseProfileForBytecodeOffset(m_currentIndex)->m_counter, m_inlineStackTop->m_profiledBlock->executionEntryCount(), m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache));
    891901#endif
    892902           
    893903    if (m_graph.isFunctionConstant(m_codeBlock, callTarget))
    894904        callType = ConstantFunction;
    895     else if (!!m_inlineStackTop->m_profiledBlock->getCallLinkInfo(m_currentIndex).lastSeenCallee && !m_inlineStackTop->m_profiledBlock->couldTakeSlowCase(m_currentIndex))
     905    else if (!!m_inlineStackTop->m_profiledBlock->getCallLinkInfo(m_currentIndex).lastSeenCallee
     906             && !m_inlineStackTop->m_profiledBlock->couldTakeSlowCase(m_currentIndex)
     907             && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache))
    896908        callType = LinkedFunction;
    897909    else
     
    11681180            return false;
    11691181
    1170         set(resultOperand, addToGraph(ArithAbs, OpInfo(NodeUseBottom), getToNumber(registerOffset + argumentToOperand(1))));
     1182        NodeIndex nodeIndex = addToGraph(ArithAbs, OpInfo(NodeUseBottom), getToNumber(registerOffset + argumentToOperand(1)));
     1183        if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow))
     1184            m_graph[nodeIndex].mergeArithNodeFlags(NodeMayOverflow);
     1185        set(resultOperand, nodeIndex);
    11711186        return true;
    11721187    }
     
    16691684            MethodCallLinkInfo& methodCall = m_inlineStackTop->m_profiledBlock->getMethodCallLinkInfo(m_currentIndex);
    16701685           
    1671             if (methodCall.seen && !!methodCall.cachedStructure && !stubInfo.seen) {
     1686            if (methodCall.seen
     1687                && !!methodCall.cachedStructure
     1688                && !stubInfo.seen
     1689                && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache)) {
    16721690                // It's monomorphic as far as we can tell, since the method_check was linked
    16731691                // but the slow path (i.e. the normal get_by_id) never fired.
     
    17121730           
    17131731#if DFG_ENABLE(DEBUG_VERBOSE)
    1714             printf("Slow case count for GetById @%lu bc#%u: %u\n", m_graph.size(), m_currentIndex, m_inlineStackTop->m_profiledBlock->rareCaseProfileForBytecodeOffset(m_currentIndex)->m_counter);
     1732            printf("Slow case count for GetById @%lu bc#%u: %u; exit profile: %d\n", m_graph.size(), m_currentIndex, m_inlineStackTop->m_profiledBlock->rareCaseProfileForBytecodeOffset(m_currentIndex)->m_counter, m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache));
    17151733#endif
    17161734           
    17171735            size_t offset = notFound;
    17181736            StructureSet structureSet;
    1719             if (stubInfo.seen && !m_inlineStackTop->m_profiledBlock->likelyToTakeSlowCase(m_currentIndex)) {
     1737            if (stubInfo.seen
     1738                && !m_inlineStackTop->m_profiledBlock->likelyToTakeSlowCase(m_currentIndex)
     1739                && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache)) {
    17201740                switch (stubInfo.accessType) {
    17211741                case access_get_by_id_self: {
     
    18061826           
    18071827#if DFG_ENABLE(DEBUG_VERBOSE)
    1808             printf("Slow case count for PutById @%lu bc#%u: %u\n", m_graph.size(), m_currentIndex, m_inlineStackTop->m_profiledBlock->rareCaseProfileForBytecodeOffset(m_currentIndex)->m_counter);
     1828            printf("Slow case count for PutById @%lu bc#%u: %u; exit profile: %d\n", m_graph.size(), m_currentIndex, m_inlineStackTop->m_profiledBlock->rareCaseProfileForBytecodeOffset(m_currentIndex)->m_counter, m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache));
    18091829#endif           
    18101830
    1811             if (stubInfo.seen && !m_inlineStackTop->m_profiledBlock->likelyToTakeSlowCase(m_currentIndex)) {
     1831            if (stubInfo.seen
     1832                && !m_inlineStackTop->m_profiledBlock->likelyToTakeSlowCase(m_currentIndex)
     1833                && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache)) {
    18121834                switch (stubInfo.accessType) {
    18131835                case access_put_by_id_replace: {
     
    24262448    , m_profiledBlock(profiledBlock)
    24272449    , m_calleeVR(calleeVR)
     2450    , m_exitProfile(profiledBlock->exitProfile())
    24282451    , m_callsiteBlockHead(callsiteBlockHead)
    24292452    , m_returnValue(returnValueVR)
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExit.cpp

    r99787 r102694  
    2929#if ENABLE(DFG_JIT)
    3030
     31#include "DFGAssemblyHelpers.h"
    3132#include "DFGSpeculativeJIT.h"
    3233
    3334namespace JSC { namespace DFG {
    3435
    35 OSRExit::OSRExit(JSValueSource jsValueSource, ValueProfile* valueProfile, MacroAssembler::Jump check, SpeculativeJIT* jit, unsigned recoveryIndex)
     36OSRExit::OSRExit(ExitKind kind, JSValueSource jsValueSource, ValueProfile* valueProfile, MacroAssembler::Jump check, SpeculativeJIT* jit, unsigned recoveryIndex)
    3637    : m_jsValueSource(jsValueSource)
    3738    , m_valueProfile(valueProfile)
     
    4041    , m_codeOrigin(jit->m_codeOriginForOSR)
    4142    , m_recoveryIndex(recoveryIndex)
     43    , m_kind(kind)
     44    , m_count(0)
    4245    , m_arguments(jit->m_arguments.size())
    4346    , m_variables(jit->m_variables.size())
     
    6265#endif
    6366
     67bool OSRExit::considerAddingAsFrequentExitSiteSlow(CodeBlock* dfgCodeBlock, CodeBlock* profiledCodeBlock)
     68{
     69    if (static_cast<double>(m_count) / dfgCodeBlock->speculativeFailCounter() <= Heuristics::osrExitProminenceForFrequentExitSite)
     70        return false;
     71   
     72    return AssemblyHelpers::baselineCodeBlockForOriginAndBaselineCodeBlock(m_codeOrigin, profiledCodeBlock)->addFrequentExitSite(FrequentExitSite(m_codeOrigin.bytecodeIndex, m_kind));
     73}
     74
    6475} } // namespace JSC::DFG
    6576
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExit.h

    r102545 r102694  
    3434#include "DFGCommon.h"
    3535#include "DFGCorrectableJumpPoint.h"
     36#include "DFGExitProfile.h"
    3637#include "DFGGPRInfo.h"
    3738#include "DFGOperands.h"
     
    8283// going into baseline code.
    8384struct OSRExit {
    84     OSRExit(JSValueSource, ValueProfile*, MacroAssembler::Jump, SpeculativeJIT*, unsigned recoveryIndex = 0);
     85    OSRExit(ExitKind, JSValueSource, ValueProfile*, MacroAssembler::Jump, SpeculativeJIT*, unsigned recoveryIndex = 0);
    8586   
    8687    MacroAssemblerCodeRef m_code;
     
    9495   
    9596    unsigned m_recoveryIndex;
     97   
     98    ExitKind m_kind;
     99    uint32_t m_count;
    96100   
    97101    // Convenient way of iterating over ValueRecoveries while being
     
    121125    }
    122126   
     127    bool considerAddingAsFrequentExitSite(CodeBlock* dfgCodeBlock, CodeBlock* profiledCodeBlock)
     128    {
     129        if (!m_count || !exitKindIsCountable(m_kind))
     130            return false;
     131        return considerAddingAsFrequentExitSiteSlow(dfgCodeBlock, profiledCodeBlock);
     132    }
     133   
    123134#ifndef NDEBUG
    124135    void dump(FILE* out) const;
     
    128139    Vector<ValueRecovery, 0> m_variables;
    129140    int m_lastSetOperand;
     141
     142private:
     143    bool considerAddingAsFrequentExitSiteSlow(CodeBlock* dfgCodeBlock, CodeBlock* profiledCodeBlock);
    130144};
    131145
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler.cpp

    r100975 r102694  
    5454
    5555#if DFG_ENABLE(DEBUG_VERBOSE)
    56     fprintf(stderr, "Generating OSR exit #%u for code block %p.\n", exitIndex, codeBlock);
     56    fprintf(stderr, "Generating OSR exit #%u (bc#%u, @%u, %s) for code block %p.\n", exitIndex, exit.m_codeOrigin.bytecodeIndex, exit.m_nodeIndex, exitKindToString(exit.m_kind), codeBlock);
    5757#endif
    5858
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler32_64.cpp

    r100820 r102694  
    452452    //     counterValueForOptimizeAfterWarmUp().
    453453   
     454    m_jit.add32(AssemblyHelpers::Imm32(1), AssemblyHelpers::AbsoluteAddress(&exit.m_count));
     455   
    454456    m_jit.move(AssemblyHelpers::TrustedImmPtr(m_jit.codeBlock()), GPRInfo::regT0);
    455457   
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExitCompiler64.cpp

    r100363 r102694  
    462462    //     counterValueForOptimizeAfterWarmUp().
    463463   
     464    m_jit.add32(AssemblyHelpers::Imm32(1), AssemblyHelpers::AbsoluteAddress(&exit.m_count));
     465   
    464466    m_jit.move(AssemblyHelpers::TrustedImmPtr(m_jit.codeBlock()), GPRInfo::regT0);
    465467   
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r102629 r102694  
    825825   
    826826    if (!predictionCheck(m_state.forNode(node.child1()).m_type))
    827         speculationCheck(JSValueSource::unboxedCell(op1GPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR), MacroAssembler::TrustedImmPtr(vptr)));
     827        speculationCheck(BadType, JSValueSource::unboxedCell(op1GPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR), MacroAssembler::TrustedImmPtr(vptr)));
    828828    if (!predictionCheck(m_state.forNode(node.child2()).m_type))
    829         speculationCheck(JSValueSource::unboxedCell(op2GPR), node.child2(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op2GPR), MacroAssembler::TrustedImmPtr(vptr)));
     829        speculationCheck(BadType, JSValueSource::unboxedCell(op2GPR), node.child2(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op2GPR), MacroAssembler::TrustedImmPtr(vptr)));
    830830   
    831831    addBranch(m_jit.branchPtr(condition, op1GPR, op2GPR), taken);
     
    10601060#if USE(JSVALUE64)
    10611061        if (isInt32Prediction(predictedType))
    1062             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::Below, JITCompiler::addressFor(virtualRegister), GPRInfo::tagTypeNumberRegister));
     1062            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::Below, JITCompiler::addressFor(virtualRegister), GPRInfo::tagTypeNumberRegister));
    10631063        else if (isArrayPrediction(predictedType)) {
    10641064            GPRTemporary temp(this);
    10651065            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    1066             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
    1067             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     1066            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
     1067            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    10681068        } else if (isByteArrayPrediction(predictedType)) {
    10691069            GPRTemporary temp(this);
    10701070            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    1071             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
    1072             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
     1071            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
     1072            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
    10731073        } else if (isBooleanPrediction(predictedType)) {
    10741074            GPRTemporary temp(this);
    10751075            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    10761076            m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), temp.gpr());
    1077             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), TrustedImm32(static_cast<int32_t>(~1))));
     1077            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), TrustedImm32(static_cast<int32_t>(~1))));
    10781078        } else if (isInt8ArrayPrediction(predictedType)) {
    10791079            GPRTemporary temp(this);
    10801080            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    1081             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
    1082             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int8ArrayDescriptor().m_vptr)));
     1081            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
     1082            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int8ArrayDescriptor().m_vptr)));
    10831083        } else if (isInt16ArrayPrediction(predictedType)) {
    10841084            GPRTemporary temp(this);
    10851085            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    1086             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
    1087             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int16ArrayDescriptor().m_vptr)));
     1086            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
     1087            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int16ArrayDescriptor().m_vptr)));
    10881088        } else if (isInt32ArrayPrediction(predictedType)) {
    10891089            GPRTemporary temp(this);
    10901090            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    1091             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
    1092             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int32ArrayDescriptor().m_vptr)));
     1091            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
     1092            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int32ArrayDescriptor().m_vptr)));
    10931093        } else if (isUint8ArrayPrediction(predictedType)) {
    10941094            GPRTemporary temp(this);
    10951095            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    1096             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
    1097             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint8ArrayDescriptor().m_vptr)));
     1096            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
     1097            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint8ArrayDescriptor().m_vptr)));
    10981098        } else if (isUint16ArrayPrediction(predictedType)) {
    10991099            GPRTemporary temp(this);
    11001100            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    1101             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
    1102             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint16ArrayDescriptor().m_vptr)));
     1101            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
     1102            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint16ArrayDescriptor().m_vptr)));
    11031103        } else if (isUint32ArrayPrediction(predictedType)) {
    11041104            GPRTemporary temp(this);
    11051105            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    1106             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
    1107             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint32ArrayDescriptor().m_vptr)));
     1106            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
     1107            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint32ArrayDescriptor().m_vptr)));
    11081108        } else if (isFloat32ArrayPrediction(predictedType)) {
    11091109            GPRTemporary temp(this);
    11101110            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    1111             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
    1112             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->float32ArrayDescriptor().m_vptr)));
     1111            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
     1112            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->float32ArrayDescriptor().m_vptr)));
    11131113        } else if (isFloat64ArrayPrediction(predictedType)) {
    11141114            GPRTemporary temp(this);
    11151115            m_jit.loadPtr(JITCompiler::addressFor(virtualRegister), temp.gpr());
    1116             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
    1117             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->float64ArrayDescriptor().m_vptr)));
     1116            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::NonZero, temp.gpr(), GPRInfo::tagMaskRegister));
     1117            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->float64ArrayDescriptor().m_vptr)));
    11181118        }
    11191119#else
    11201120        if (isInt32Prediction(predictedType))
    1121             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::Int32Tag)));
     1121            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::Int32Tag)));
    11221122        else if (isArrayPrediction(predictedType)) {
    11231123            GPRTemporary temp(this);
    11241124            m_jit.load32(JITCompiler::tagFor(virtualRegister), temp.gpr());
    1125             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
     1125            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
    11261126            m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr());
    1127             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     1127            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    11281128        } else if (isByteArrayPrediction(predictedType)) {
    11291129            GPRTemporary temp(this);
    11301130            m_jit.load32(JITCompiler::tagFor(virtualRegister), temp.gpr());
    1131             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
     1131            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
    11321132            m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr());
    1133             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
     1133            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
    11341134        } else if (isBooleanPrediction(predictedType))
    1135             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::BooleanTag)));
     1135            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::BooleanTag)));
    11361136        else if (isInt8ArrayPrediction(predictedType)) {
    11371137            GPRTemporary temp(this);
    11381138            m_jit.load32(JITCompiler::tagFor(virtualRegister), temp.gpr());
    1139             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
     1139            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
    11401140            m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr());
    1141             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int8ArrayDescriptor().m_vptr)));
     1141            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int8ArrayDescriptor().m_vptr)));
    11421142        } else if (isInt16ArrayPrediction(predictedType)) {
    11431143            GPRTemporary temp(this);
    11441144            m_jit.load32(JITCompiler::tagFor(virtualRegister), temp.gpr());
    1145             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
     1145            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
    11461146            m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr());
    1147             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int16ArrayDescriptor().m_vptr)));
     1147            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int16ArrayDescriptor().m_vptr)));
    11481148        } else if (isInt32ArrayPrediction(predictedType)) {
    11491149            GPRTemporary temp(this);
    11501150            m_jit.load32(JITCompiler::tagFor(virtualRegister), temp.gpr());
    1151             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
     1151            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
    11521152            m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr());
    1153             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int32ArrayDescriptor().m_vptr)));
     1153            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->int32ArrayDescriptor().m_vptr)));
    11541154        } else if (isUint8ArrayPrediction(predictedType)) {
    11551155            GPRTemporary temp(this);
    11561156            m_jit.load32(JITCompiler::tagFor(virtualRegister), temp.gpr());
    1157             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
     1157            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
    11581158            m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr());
    1159             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint8ArrayDescriptor().m_vptr)));
     1159            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint8ArrayDescriptor().m_vptr)));
    11601160        } else if (isUint16ArrayPrediction(predictedType)) {
    11611161            GPRTemporary temp(this);
    11621162            m_jit.load32(JITCompiler::tagFor(virtualRegister), temp.gpr());
    1163             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
     1163            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
    11641164            m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr());
    1165             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint16ArrayDescriptor().m_vptr)));
     1165            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint16ArrayDescriptor().m_vptr)));
    11661166        }  else if (isUint32ArrayPrediction(predictedType)) {
    11671167            GPRTemporary temp(this);
    11681168            m_jit.load32(JITCompiler::tagFor(virtualRegister), temp.gpr());
    1169             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
     1169            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
    11701170            m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr());
    1171             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint32ArrayDescriptor().m_vptr)));
     1171            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->uint32ArrayDescriptor().m_vptr)));
    11721172        }  else if (isFloat32ArrayPrediction(predictedType)) {
    11731173            GPRTemporary temp(this);
    11741174            m_jit.load32(JITCompiler::tagFor(virtualRegister), temp.gpr());
    1175             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
     1175            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
    11761176            m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr());
    1177             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->float32ArrayDescriptor().m_vptr)));
     1177            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->float32ArrayDescriptor().m_vptr)));
    11781178        }   else if (isFloat64ArrayPrediction(predictedType)) {
    11791179            GPRTemporary temp(this);
    11801180            m_jit.load32(JITCompiler::tagFor(virtualRegister), temp.gpr());
    1181             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
     1181            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, temp.gpr(), TrustedImm32(JSValue::CellTag)));
    11821182            m_jit.load32(JITCompiler::payloadFor(virtualRegister), temp.gpr());
    1183             speculationCheck(JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->float64ArrayDescriptor().m_vptr)));
     1183            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(temp.gpr()), MacroAssembler::TrustedImmPtr(m_jit.globalData()->float64ArrayDescriptor().m_vptr)));
    11841184        }
    11851185#endif
     
    13551355    if (!isStringPrediction(m_state.forNode(node.child1()).m_type)) {
    13561356        ASSERT(!(at(node.child1()).prediction() & PredictString));
    1357         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1357        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    13581358        noResult(m_compileIndex);
    13591359        return;
     
    13611361
    13621362    // unsigned comparison so we can filter out negative indices and indices that are too large
    1363     speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, indexReg, MacroAssembler::Address(stringReg, JSString::offsetOfLength())));
     1363    speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, indexReg, MacroAssembler::Address(stringReg, JSString::offsetOfLength())));
    13641364
    13651365    GPRTemporary scratch(this);
     
    13941394    if (!isStringPrediction(m_state.forNode(node.child1()).m_type)) {
    13951395        ASSERT(!(at(node.child1()).prediction() & PredictString));
    1396         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1396        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    13971397        noResult(m_compileIndex);
    13981398        return;
     
    14001400
    14011401    // unsigned comparison so we can filter out negative indices and indices that are too large
    1402     speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(baseReg, JSString::offsetOfLength())));
     1402    speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(baseReg, JSString::offsetOfLength())));
    14031403
    14041404    GPRTemporary scratch(this);
     
    14181418
    14191419    // We only support ascii characters
    1420     speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, scratchReg, TrustedImm32(0x100)));
     1420    speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, scratchReg, TrustedImm32(0x100)));
    14211421
    14221422    // 8 bit string values don't need the isASCII check.
     
    14271427    m_jit.move(MacroAssembler::TrustedImmPtr(m_jit.globalData()->smallStrings.singleCharacterStrings()), smallStringsReg);
    14281428    m_jit.loadPtr(MacroAssembler::BaseIndex(smallStringsReg, scratchReg, MacroAssembler::ScalePtr, 0), scratchReg);
    1429     speculationCheck(JSValueRegs(), NoNode, m_jit.branchTest32(MacroAssembler::Zero, scratchReg));
     1429    speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTest32(MacroAssembler::Zero, scratchReg));
    14301430    cellResult(scratchReg, m_compileIndex);
    14311431}
     
    14961496   
    14971497    if (!isByteArrayPrediction(m_state.forNode(baseIndex).m_type))
    1498         speculationCheck(JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
     1498        speculationCheck(BadType, JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
    14991499    GPRTemporary value;
    15001500    GPRReg valueGPR;
     
    15031503        JSValue jsValue = valueOfJSConstant(valueIndex);
    15041504        if (!jsValue.isNumber()) {
    1505             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1505            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    15061506            noResult(m_compileIndex);
    15071507            return;
     
    15641564
    15651565    if (!isByteArrayPrediction(m_state.forNode(node.child1()).m_type)) {
    1566         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1566        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    15671567        noResult(m_compileIndex);
    15681568        return;
     
    15751575   
    15761576    // unsigned comparison so we can filter out negative indices and indices that are too large
    1577     speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(storageReg, ByteArray::offsetOfSize())));
     1577    speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(storageReg, ByteArray::offsetOfSize())));
    15781578
    15791579    m_jit.load8(MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::TimesOne, ByteArray::offsetOfData()), storageReg);
     
    15901590   
    15911591    if (needsSpeculationCheck)
    1592         speculationCheck(JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     1592        speculationCheck(BadType, JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    15931593   
    15941594    m_jit.load32(MacroAssembler::Address(baseGPR, descriptor.m_lengthOffset), resultGPR);
     
    16121612    if (speculationRequirements != NoTypedArrayTypeSpecCheck) {
    16131613        ASSERT_NOT_REACHED();
    1614         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1614        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    16151615        noResult(m_compileIndex);
    16161616        return;
     
    16531653   
    16541654    if (speculationRequirements != NoTypedArrayTypeSpecCheck)
    1655         speculationCheck(JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     1655        speculationCheck(BadType, JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    16561656    GPRTemporary value;
    16571657    GPRReg valueGPR;
     
    16601660        JSValue jsValue = valueOfJSConstant(valueIndex);
    16611661        if (!jsValue.isNumber()) {
    1662             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1662            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    16631663            noResult(m_compileIndex);
    16641664            return;
     
    17351735    if (speculationRequirements != NoTypedArrayTypeSpecCheck) {
    17361736        ASSERT_NOT_REACHED();
    1737         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1737        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    17381738        noResult(m_compileIndex);
    17391739        return;
     
    17761776   
    17771777    if (speculationRequirements != NoTypedArrayTypeSpecCheck)
    1778         speculationCheck(JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     1778        speculationCheck(BadType, JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    17791779   
    17801780    GPRTemporary result(this);
     
    18111811    // Check that prototype is an object.
    18121812    m_jit.loadPtr(MacroAssembler::Address(prototypeReg, JSCell::structureOffset()), scratchReg);
    1813     speculationCheck(JSValueRegs(), NoNode, m_jit.branchIfNotObject(scratchReg));
     1813    speculationCheck(BadType, JSValueRegs(), NoNode, m_jit.branchIfNotObject(scratchReg));
    18141814   
    18151815    // Initialize scratchReg with the value being checked.
     
    19651965    GPRReg op2Gpr = op2.gpr();
    19661966
    1967     speculationCheck(JSValueRegs(), NoNode, m_jit.branchTest32(JITCompiler::Zero, op2Gpr));
     1967    speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchTest32(JITCompiler::Zero, op2Gpr));
    19681968
    19691969#if CPU(X86) || CPU(X86_64)
     
    20932093        // domain.
    20942094           
    2095         speculationCheck(JSValueRegs(), NoNode, m_jit.branchMul32(MacroAssembler::Overflow, reg1, reg2, result.gpr()));
     2095        speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchMul32(MacroAssembler::Overflow, reg1, reg2, result.gpr()));
    20962096           
    20972097        // Check for negative zero, if the users of this node care about such things.
    20982098        if (!nodeCanIgnoreNegativeZero(node.arithNodeFlags())) {
    20992099            MacroAssembler::Jump resultNonZero = m_jit.branchTest32(MacroAssembler::NonZero, result.gpr());
    2100             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, reg1, TrustedImm32(0)));
    2101             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, reg2, TrustedImm32(0)));
     2100            speculationCheck(NegativeZero, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, reg1, TrustedImm32(0)));
     2101            speculationCheck(NegativeZero, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, reg2, TrustedImm32(0)));
    21022102            resultNonZero.link(&m_jit);
    21032103        }
     
    23232323    if (!(basePrediction & PredictInt32) && basePrediction) {
    23242324        ASSERT_NOT_REACHED();
    2325         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     2325        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    23262326        noResult(m_compileIndex);
    23272327        return;
     
    23322332    if (at(node.child1()).prediction() == PredictString) {
    23332333        if (!isStringPrediction(m_state.forNode(node.child1()).m_type))
    2334             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
     2334            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
    23352335
    23362336        m_jit.loadPtr(MacroAssembler::Address(baseReg, JSString::offsetOfValue()), storageReg);
    23372337       
    23382338        // Speculate that we're not accessing a rope
    2339         speculationCheck(JSValueRegs(), NoNode, m_jit.branchTest32(MacroAssembler::Zero, storageReg));
     2339        speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTest32(MacroAssembler::Zero, storageReg));
    23402340
    23412341        m_jit.loadPtr(MacroAssembler::Address(storageReg, StringImpl::dataOffset()), storageReg);
    23422342    } else if (at(node.child1()).shouldSpeculateByteArray()) {
    23432343        if (!isByteArrayPrediction(m_state.forNode(node.child1()).m_type))
    2344             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
     2344            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
    23452345        m_jit.loadPtr(MacroAssembler::Address(baseReg, JSByteArray::offsetOfStorage()), storageReg);
    23462346    } else if (at(node.child1()).shouldSpeculateInt8Array()) {
    23472347        const TypedArrayDescriptor& descriptor = m_jit.globalData()->int8ArrayDescriptor();
    23482348        if (!isInt8ArrayPrediction(m_state.forNode(node.child1()).m_type))
    2349             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     2349            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    23502350        m_jit.loadPtr(MacroAssembler::Address(baseReg, descriptor.m_storageOffset), storageReg);
    23512351    } else if (at(node.child1()).shouldSpeculateInt16Array()) {
    23522352        const TypedArrayDescriptor& descriptor = m_jit.globalData()->int16ArrayDescriptor();
    23532353        if (!isInt16ArrayPrediction(m_state.forNode(node.child1()).m_type))
    2354             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     2354            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    23552355        m_jit.loadPtr(MacroAssembler::Address(baseReg, descriptor.m_storageOffset), storageReg);
    23562356    } else if (at(node.child1()).shouldSpeculateInt32Array()) {
    23572357        const TypedArrayDescriptor& descriptor = m_jit.globalData()->int32ArrayDescriptor();
    23582358        if (!isInt32ArrayPrediction(m_state.forNode(node.child1()).m_type))
    2359             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     2359            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    23602360        m_jit.loadPtr(MacroAssembler::Address(baseReg, descriptor.m_storageOffset), storageReg);
    23612361    } else if (at(node.child1()).shouldSpeculateUint8Array()) {
    23622362        const TypedArrayDescriptor& descriptor = m_jit.globalData()->uint8ArrayDescriptor();
    23632363        if (!isUint8ArrayPrediction(m_state.forNode(node.child1()).m_type))
    2364             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     2364            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    23652365        m_jit.loadPtr(MacroAssembler::Address(baseReg, descriptor.m_storageOffset), storageReg);
    23662366    } else if (at(node.child1()).shouldSpeculateUint16Array()) {
    23672367        const TypedArrayDescriptor& descriptor = m_jit.globalData()->uint16ArrayDescriptor();
    23682368        if (!isUint16ArrayPrediction(m_state.forNode(node.child1()).m_type))
    2369             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     2369            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    23702370        m_jit.loadPtr(MacroAssembler::Address(baseReg, descriptor.m_storageOffset), storageReg);
    23712371    } else if (at(node.child1()).shouldSpeculateUint32Array()) {
    23722372        const TypedArrayDescriptor& descriptor = m_jit.globalData()->uint32ArrayDescriptor();
    23732373        if (!isUint32ArrayPrediction(m_state.forNode(node.child1()).m_type))
    2374             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     2374            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    23752375        m_jit.loadPtr(MacroAssembler::Address(baseReg, descriptor.m_storageOffset), storageReg);
    23762376    } else if (at(node.child1()).shouldSpeculateFloat32Array()) {
    23772377        const TypedArrayDescriptor& descriptor = m_jit.globalData()->float32ArrayDescriptor();
    23782378        if (!isFloat32ArrayPrediction(m_state.forNode(node.child1()).m_type))
    2379             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     2379            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    23802380        m_jit.loadPtr(MacroAssembler::Address(baseReg, descriptor.m_storageOffset), storageReg);
    23812381    } else if (at(node.child1()).shouldSpeculateFloat64Array()) {
    23822382        const TypedArrayDescriptor& descriptor = m_jit.globalData()->float64ArrayDescriptor();
    23832383        if (!isFloat64ArrayPrediction(m_state.forNode(node.child1()).m_type))
    2384             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
     2384            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(descriptor.m_vptr)));
    23852385        m_jit.loadPtr(MacroAssembler::Address(baseReg, descriptor.m_storageOffset), storageReg);
    23862386    } else {
    23872387        if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2388             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2388            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    23892389        m_jit.loadPtr(MacroAssembler::Address(baseReg, JSArray::storageOffset()), storageReg);
    23902390    }
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r102545 r102694  
    20302030
    20312031    // Add a speculation check without additional recovery.
    2032     void speculationCheck(JSValueSource jsValueSource, NodeIndex nodeIndex, MacroAssembler::Jump jumpToFail)
     2032    void speculationCheck(ExitKind kind, JSValueSource jsValueSource, NodeIndex nodeIndex, MacroAssembler::Jump jumpToFail)
    20332033    {
    20342034        if (!m_compileOkay)
    20352035            return;
    2036         m_jit.codeBlock()->appendOSRExit(OSRExit(jsValueSource, m_jit.valueProfileFor(nodeIndex), jumpToFail, this));
     2036        m_jit.codeBlock()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.valueProfileFor(nodeIndex), jumpToFail, this));
    20372037    }
    20382038    // Add a set of speculation checks without additional recovery.
    2039     void speculationCheck(JSValueSource jsValueSource, NodeIndex nodeIndex, MacroAssembler::JumpList& jumpsToFail)
     2039    void speculationCheck(ExitKind kind, JSValueSource jsValueSource, NodeIndex nodeIndex, MacroAssembler::JumpList& jumpsToFail)
    20402040    {
    20412041        Vector<MacroAssembler::Jump, 16> JumpVector = jumpsToFail.jumps();
    20422042        for (unsigned i = 0; i < JumpVector.size(); ++i)
    2043             speculationCheck(jsValueSource, nodeIndex, JumpVector[i]);
     2043            speculationCheck(kind, jsValueSource, nodeIndex, JumpVector[i]);
    20442044    }
    20452045    // Add a speculation check with additional recovery.
    2046     void speculationCheck(JSValueSource jsValueSource, NodeIndex nodeIndex, MacroAssembler::Jump jumpToFail, const SpeculationRecovery& recovery)
     2046    void speculationCheck(ExitKind kind, JSValueSource jsValueSource, NodeIndex nodeIndex, MacroAssembler::Jump jumpToFail, const SpeculationRecovery& recovery)
    20472047    {
    20482048        if (!m_compileOkay)
    20492049            return;
    20502050        m_jit.codeBlock()->appendSpeculationRecovery(recovery);
    2051         m_jit.codeBlock()->appendOSRExit(OSRExit(jsValueSource, m_jit.valueProfileFor(nodeIndex), jumpToFail, this, m_jit.codeBlock()->numberOfSpeculationRecoveries()));
     2051        m_jit.codeBlock()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.valueProfileFor(nodeIndex), jumpToFail, this, m_jit.codeBlock()->numberOfSpeculationRecoveries()));
    20522052    }
    20532053
    20542054    // Called when we statically determine that a speculation will fail.
    2055     void terminateSpeculativeExecution(JSValueRegs jsValueRegs, NodeIndex nodeIndex)
     2055    void terminateSpeculativeExecution(ExitKind kind, JSValueRegs jsValueRegs, NodeIndex nodeIndex)
    20562056    {
    20572057#if DFG_ENABLE(DEBUG_VERBOSE)
     
    20602060        if (!m_compileOkay)
    20612061            return;
    2062         speculationCheck(jsValueRegs, nodeIndex, m_jit.jump());
     2062        speculationCheck(kind, jsValueRegs, nodeIndex, m_jit.jump());
    20632063        m_compileOkay = false;
    20642064    }
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r102545 r102694  
    13421342                return gpr;
    13431343            }
    1344             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1344            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    13451345            returnFormat = DataFormatInteger;
    13461346            return allocate();
     
    13541354        // If we know this was spilled as an integer we can fill without checking.
    13551355        if (spillFormat != DataFormatJSInteger)
    1356             speculationCheck(JSValueSource(JITCompiler::addressFor(virtualRegister)), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::Int32Tag)));
     1356            speculationCheck(BadType, JSValueSource(JITCompiler::addressFor(virtualRegister)), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::Int32Tag)));
    13571357
    13581358        m_jit.load32(JITCompiler::payloadFor(virtualRegister), gpr);
     
    13701370        m_gprs.lock(payloadGPR);
    13711371        if (info.registerFormat() != DataFormatJSInteger)
    1372             speculationCheck(JSValueRegs(tagGPR, payloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, tagGPR, TrustedImm32(JSValue::Int32Tag)));
     1372            speculationCheck(BadType, JSValueRegs(tagGPR, payloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, tagGPR, TrustedImm32(JSValue::Int32Tag)));
    13731373        m_gprs.unlock(tagGPR);
    13741374        m_gprs.release(tagGPR);
     
    13941394    case DataFormatJSCell:
    13951395    case DataFormatJSBoolean: {
    1396         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1396        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    13971397        returnFormat = DataFormatInteger;
    13981398        return allocate();
     
    14451445                return fpr;
    14461446            } else {
    1447                 terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1447                terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    14481448                return fprAllocate();
    14491449            }
     
    14611461            FPRReg fpr = fprAllocate();
    14621462            JITCompiler::Jump isInteger = m_jit.branch32(MacroAssembler::Equal, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::Int32Tag));
    1463             speculationCheck(JSValueSource(JITCompiler::addressFor(virtualRegister)), nodeIndex, m_jit.branch32(MacroAssembler::AboveOrEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::LowestTag)));
     1463            speculationCheck(BadType, JSValueSource(JITCompiler::addressFor(virtualRegister)), nodeIndex, m_jit.branch32(MacroAssembler::AboveOrEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::LowestTag)));
    14641464            m_jit.loadDouble(JITCompiler::addressFor(virtualRegister), fpr);
    14651465            JITCompiler::Jump hasUnboxedDouble = m_jit.jump();
     
    14831483
    14841484    case DataFormatCell:
    1485         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1485        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    14861486        return fprAllocate();
    14871487
     
    15021502            FPRTemporary scratch(this);
    15031503            JITCompiler::Jump isInteger = m_jit.branch32(MacroAssembler::Equal, tagGPR, TrustedImm32(JSValue::Int32Tag));
    1504             speculationCheck(JSValueRegs(tagGPR, payloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::AboveOrEqual, tagGPR, TrustedImm32(JSValue::LowestTag)));
     1504            speculationCheck(BadType, JSValueRegs(tagGPR, payloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::AboveOrEqual, tagGPR, TrustedImm32(JSValue::LowestTag)));
    15051505            unboxDouble(tagGPR, payloadGPR, fpr, scratch.fpr());
    15061506            hasUnboxedDouble = m_jit.jump();
     
    15651565                return gpr;
    15661566            }
    1567             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1567            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    15681568            return gpr;
    15691569        }
    15701570        ASSERT(info.spillFormat() & DataFormatJS);
    15711571        if (info.spillFormat() != DataFormatJSCell)
    1572             speculationCheck(JSValueSource(JITCompiler::addressFor(virtualRegister)), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::CellTag)));
     1572            speculationCheck(BadType, JSValueSource(JITCompiler::addressFor(virtualRegister)), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::CellTag)));
    15731573        m_jit.load32(JITCompiler::payloadFor(virtualRegister), gpr);
    15741574        m_gprs.retain(gpr, virtualRegister, SpillOrderSpilled);
     
    15901590        m_gprs.lock(payloadGPR);
    15911591        if (info.spillFormat() != DataFormatJSCell)
    1592             speculationCheck(JSValueRegs(tagGPR, payloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, tagGPR, TrustedImm32(JSValue::CellTag)));
     1592            speculationCheck(BadType, JSValueRegs(tagGPR, payloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, tagGPR, TrustedImm32(JSValue::CellTag)));
    15931593        m_gprs.unlock(tagGPR);
    15941594        m_gprs.release(tagGPR);
     
    16051605    case DataFormatJSBoolean:
    16061606    case DataFormatBoolean: {
    1607         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1607        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    16081608        return allocate();
    16091609    }
     
    16381638                return gpr;
    16391639            }
    1640             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1640            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    16411641            return gpr;
    16421642        }
     
    16451645
    16461646        if (info.spillFormat() != DataFormatJSBoolean)
    1647             speculationCheck(JSValueSource(JITCompiler::addressFor(virtualRegister)), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::BooleanTag)));
     1647            speculationCheck(BadType, JSValueSource(JITCompiler::addressFor(virtualRegister)), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, JITCompiler::tagFor(virtualRegister), TrustedImm32(JSValue::BooleanTag)));
    16481648
    16491649        m_jit.load32(JITCompiler::payloadFor(virtualRegister), gpr);
     
    16651665        m_gprs.lock(payloadGPR);
    16661666        if (info.registerFormat() != DataFormatJSBoolean)
    1667             speculationCheck(JSValueRegs(tagGPR, payloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, tagGPR, TrustedImm32(JSValue::BooleanTag)));
     1667            speculationCheck(BadType, JSValueRegs(tagGPR, payloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, tagGPR, TrustedImm32(JSValue::BooleanTag)));
    16681668
    16691669        m_gprs.unlock(tagGPR);
     
    16811681    case DataFormatJSCell:
    16821682    case DataFormatCell: {
    1683         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1683        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    16841684        return allocate();
    16851685    }
     
    17221722   
    17231723    if (!predictionCheck(m_state.forNode(node.child1()).m_type))
    1724         speculationCheck(JSValueSource::unboxedCell(op1GPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR), MacroAssembler::TrustedImmPtr(vptr)));
     1724        speculationCheck(BadType, JSValueSource::unboxedCell(op1GPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR), MacroAssembler::TrustedImmPtr(vptr)));
    17251725    if (!predictionCheck(m_state.forNode(node.child2()).m_type))
    1726         speculationCheck(JSValueSource::unboxedCell(op2GPR), node.child2(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op2GPR), MacroAssembler::TrustedImmPtr(vptr)));
     1726        speculationCheck(BadType, JSValueSource::unboxedCell(op2GPR), node.child2(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op2GPR), MacroAssembler::TrustedImmPtr(vptr)));
    17271727   
    17281728    MacroAssembler::Jump falseCase = m_jit.branchPtr(MacroAssembler::NotEqual, op1GPR, op2GPR);
     
    17941794    MacroAssembler::Jump notCell = m_jit.branch32(MacroAssembler::NotEqual, valueTagGPR, TrustedImm32(JSValue::CellTag));
    17951795    if (needSpeculationCheck)
    1796         speculationCheck(JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valuePayloadGPR), MacroAssembler::TrustedImmPtr(vptr)));
     1796        speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valuePayloadGPR), MacroAssembler::TrustedImmPtr(vptr)));
    17971797    m_jit.move(TrustedImm32(0), resultPayloadGPR);
    17981798    MacroAssembler::Jump done = m_jit.jump();
     
    18041804        m_jit.move(valueTagGPR, resultPayloadGPR);
    18051805        m_jit.or32(TrustedImm32(1), resultPayloadGPR);
    1806         speculationCheck(JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, resultPayloadGPR, TrustedImm32(JSValue::NullTag)));
     1806        speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, resultPayloadGPR, TrustedImm32(JSValue::NullTag)));
    18071807    }
    18081808    m_jit.move(TrustedImm32(1), resultPayloadGPR);
     
    18821882    MacroAssembler::Jump notCell = m_jit.branch32(MacroAssembler::NotEqual, valueTagGPR, TrustedImm32(JSValue::CellTag));
    18831883    if (needSpeculationCheck)
    1884         speculationCheck(JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valuePayloadGPR), MacroAssembler::TrustedImmPtr(vptr)));
     1884        speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valuePayloadGPR), MacroAssembler::TrustedImmPtr(vptr)));
    18851885    addBranch(m_jit.jump(), taken);
    18861886   
     
    18911891        m_jit.move(valueTagGPR, scratchGPR);
    18921892        m_jit.or32(TrustedImm32(1), scratchGPR);
    1893         speculationCheck(JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, scratchGPR, TrustedImm32(JSValue::NullTag)));
     1893        speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, scratchGPR, TrustedImm32(JSValue::NullTag)));
    18941894    }
    18951895
     
    19991999        // If we have no prediction for this local, then don't attempt to compile.
    20002000        if (prediction == PredictNone) {
    2001             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     2001            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    20022002            break;
    20032003        }
     
    20812081            GPRReg cellGPR = cell.gpr();
    20822082            if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2083                 speculationCheck(JSValueSource::unboxedCell(cellGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(cellGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2083                speculationCheck(BadType, JSValueSource::unboxedCell(cellGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(cellGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    20842084            m_jit.storePtr(cellGPR, JITCompiler::payloadFor(node.local()));
    20852085            noResult(m_compileIndex);
     
    20882088            GPRReg cellGPR = cell.gpr();
    20892089            if (!isByteArrayPrediction(m_state.forNode(node.child1()).m_type))
    2090                 speculationCheck(JSValueSource::unboxedCell(cellGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(cellGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
     2090                speculationCheck(BadType, JSValueSource::unboxedCell(cellGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(cellGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
    20912091            m_jit.storePtr(cellGPR, JITCompiler::payloadFor(node.local()));
    20922092            noResult(m_compileIndex);
     
    21942194
    21952195        // Test the operand is positive.
    2196         speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, op1.gpr(), TrustedImm32(0)));
     2196        speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, op1.gpr(), TrustedImm32(0)));
    21972197
    21982198        m_jit.move(op1.gpr(), result.gpr());
     
    22422242                    m_jit.add32(Imm32(imm1), result.gpr());
    22432243                } else
    2244                     speculationCheck(JSValueRegs(), NoNode, m_jit.branchAdd32(MacroAssembler::Overflow, op2.gpr(), Imm32(imm1), result.gpr()));
     2244                    speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchAdd32(MacroAssembler::Overflow, op2.gpr(), Imm32(imm1), result.gpr()));
    22452245
    22462246                integerResult(result.gpr(), m_compileIndex);
     
    22572257                    m_jit.add32(Imm32(imm2), result.gpr());
    22582258                } else
    2259                     speculationCheck(JSValueRegs(), NoNode, m_jit.branchAdd32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
     2259                    speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchAdd32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
    22602260
    22612261                integerResult(result.gpr(), m_compileIndex);
     
    22822282               
    22832283                if (gpr1 == gprResult)
    2284                     speculationCheck(JSValueRegs(), NoNode, check, SpeculationRecovery(SpeculativeAdd, gprResult, gpr2));
     2284                    speculationCheck(Overflow, JSValueRegs(), NoNode, check, SpeculationRecovery(SpeculativeAdd, gprResult, gpr2));
    22852285                else if (gpr2 == gprResult)
    2286                     speculationCheck(JSValueRegs(), NoNode, check, SpeculationRecovery(SpeculativeAdd, gprResult, gpr1));
     2286                    speculationCheck(Overflow, JSValueRegs(), NoNode, check, SpeculationRecovery(SpeculativeAdd, gprResult, gpr1));
    22872287                else
    2288                     speculationCheck(JSValueRegs(), NoNode, check);
     2288                    speculationCheck(Overflow, JSValueRegs(), NoNode, check);
    22892289            }
    22902290
     
    23222322                    m_jit.sub32(Imm32(imm2), result.gpr());
    23232323                } else
    2324                     speculationCheck(JSValueRegs(), NoNode, m_jit.branchSub32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
     2324                    speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchSub32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
    23252325
    23262326                integerResult(result.gpr(), m_compileIndex);
     
    23362336                m_jit.sub32(op2.gpr(), result.gpr());
    23372337            } else
    2338                 speculationCheck(JSValueRegs(), NoNode, m_jit.branchSub32(MacroAssembler::Overflow, op1.gpr(), op2.gpr(), result.gpr()));
     2338                speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchSub32(MacroAssembler::Overflow, op1.gpr(), op2.gpr(), result.gpr()));
    23392339
    23402340            integerResult(result.gpr(), m_compileIndex);
     
    23692369            GPRReg op2GPR = op2.gpr();
    23702370           
    2371             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTest32(JITCompiler::Zero, op2GPR));
     2371            speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchTest32(JITCompiler::Zero, op2GPR));
    23722372           
    23732373            // If the user cares about negative zero, then speculate that we're not about
     
    23752375            if (!nodeCanIgnoreNegativeZero(node.arithNodeFlags())) {
    23762376                MacroAssembler::Jump numeratorNonZero = m_jit.branchTest32(MacroAssembler::NonZero, op1GPR);
    2377                 speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, op2GPR, TrustedImm32(0)));
     2377                speculationCheck(NegativeZero, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, op2GPR, TrustedImm32(0)));
    23782378                numeratorNonZero.link(&m_jit);
    23792379            }
     
    23952395            // Check that there was no remainder. If there had been, then we'd be obligated to
    23962396            // produce a double result instead.
    2397             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTest32(JITCompiler::NonZero, edx.gpr()));
     2397            speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchTest32(JITCompiler::NonZero, edx.gpr()));
    23982398           
    23992399            integerResult(eax.gpr(), m_compileIndex);
     
    24152415            JITCompiler::JumpList failureCases;
    24162416            m_jit.branchConvertDoubleToInt32(resultFPR, resultGPR, failureCases, scratchFPR);
    2417             speculationCheck(JSValueRegs(), NoNode, failureCases);
     2417            speculationCheck(Overflow, JSValueRegs(), NoNode, failureCases);
    24182418
    24192419            integerResult(resultGPR, m_compileIndex);
     
    24492449            m_jit.add32(scratch.gpr(), result.gpr());
    24502450            m_jit.xor32(scratch.gpr(), result.gpr());
    2451             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::Equal, result.gpr(), MacroAssembler::TrustedImm32(1 << 31)));
     2451            speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::Equal, result.gpr(), MacroAssembler::TrustedImm32(1 << 31)));
    24522452            integerResult(result.gpr(), m_compileIndex);
    24532453            break;
     
    26862686            GPRReg baseReg = base.gpr();
    26872687            if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2688                 speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    2689             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(baseReg, JSArray::vectorLengthOffset())));
     2688                speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2689            speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(baseReg, JSArray::vectorLengthOffset())));
    26902690        }
    26912691
     
    26942694        // then we'll need to allocate a new temporary for result.
    26952695        m_jit.load32(MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.tag)), resultTag.gpr());
    2696         speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::Equal, resultTag.gpr(), TrustedImm32(JSValue::EmptyValueTag)));
     2696        speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::Equal, resultTag.gpr(), TrustedImm32(JSValue::EmptyValueTag)));
    26972697        m_jit.load32(MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::TimesEight, OBJECT_OFFSETOF(ArrayStorage, m_vector[0]) + OBJECT_OFFSETOF(JSValue, u.asBits.payload)), resultPayload.gpr());
    26982698
     
    28052805        // If we have predicted the base to be type array, we can skip the check.
    28062806        if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2807             speculationCheck(JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2807            speculationCheck(BadType, JSValueSource::unboxedCell(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    28082808
    28092809        base.use();
     
    29492949
    29502950        if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2951             speculationCheck(JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2951            speculationCheck(BadType, JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    29522952       
    29532953        m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSArray::storageOffset()), storageGPR);
     
    29552955       
    29562956        // Refuse to handle bizarre lengths.
    2957         speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::Above, storageLengthGPR, TrustedImm32(0x7ffffffe)));
     2957        speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::Above, storageLengthGPR, TrustedImm32(0x7ffffffe)));
    29582958       
    29592959        MacroAssembler::Jump slowPath = m_jit.branch32(MacroAssembler::AboveOrEqual, storageLengthGPR, MacroAssembler::Address(baseGPR, JSArray::vectorLengthOffset()));
     
    29952995       
    29962996        if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2997             speculationCheck(JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2997            speculationCheck(BadType, JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    29982998       
    29992999        m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSArray::storageOffset()), storageGPR);
     
    31163116        // We expect that throw statements are rare and are intended to exit the code block
    31173117        // anyway, so we just OSR back to the old JIT for now.
    3118         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     3118        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    31193119        break;
    31203120    }
     
    32643264            // This is hard. It would be better to save the value, but we can't quite do it,
    32653265            // since this operation does not otherwise get the payload.
    3266             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, scratchGPR, TrustedImm32(JSValue::NullTag)));
     3266            speculationCheck(BadType, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::NotEqual, scratchGPR, TrustedImm32(JSValue::NullTag)));
    32673267           
    32683268            m_jit.move(MacroAssembler::TrustedImmPtr(m_jit.globalObjectFor(node.codeOrigin)), scratchGPR);
     
    32783278           
    32793279            if (!isObjectPrediction(m_state.forNode(node.child1()).m_type))
    3280                 speculationCheck(JSValueSource::unboxedCell(thisValueGPR), node.child1(), m_jit.branchPtr(JITCompiler::Equal, JITCompiler::Address(thisValueGPR), JITCompiler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
     3280                speculationCheck(BadType, JSValueSource::unboxedCell(thisValueGPR), node.child1(), m_jit.branchPtr(JITCompiler::Equal, JITCompiler::Address(thisValueGPR), JITCompiler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
    32813281           
    32823282            m_jit.move(thisValueGPR, resultGPR);
     
    33233323        if (at(node.child1()).shouldSpeculateFinalObject()) {
    33243324            if (!isFinalObjectPrediction(m_state.forNode(node.child1()).m_type))
    3325                 speculationCheck(JSValueSource::unboxedCell(protoGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(protoGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsFinalObjectVPtr)));
     3325                speculationCheck(BadType, JSValueSource::unboxedCell(protoGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(protoGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsFinalObjectVPtr)));
    33263326        } else {
    33273327            m_jit.loadPtr(MacroAssembler::Address(protoGPR, JSCell::structureOffset()), scratchGPR);
     
    34353435    case GetById: {
    34363436        if (!node.prediction()) {
    3437             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     3437            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    34383438            break;
    34393439        }
     
    34953495       
    34963496        if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    3497             speculationCheck(JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     3497            speculationCheck(BadType, JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    34983498       
    34993499        m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSArray::storageOffset()), resultGPR);
    35003500        m_jit.load32(MacroAssembler::Address(resultGPR, OBJECT_OFFSETOF(ArrayStorage, m_length)), resultGPR);
    35013501       
    3502         speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, resultGPR, MacroAssembler::TrustedImm32(0)));
     3502        speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, resultGPR, MacroAssembler::TrustedImm32(0)));
    35033503       
    35043504        integerResult(resultGPR, m_compileIndex);
     
    35143514       
    35153515        if (!isStringPrediction(m_state.forNode(node.child1()).m_type))
    3516             speculationCheck(JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
     3516            speculationCheck(BadType, JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
    35173517       
    35183518        m_jit.load32(MacroAssembler::Address(baseGPR, JSString::offsetOfLength()), resultGPR);
     
    35303530       
    35313531        if (!isByteArrayPrediction(m_state.forNode(node.child1()).m_type))
    3532             speculationCheck(JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
     3532            speculationCheck(BadType, JSValueSource::unboxedCell(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
    35333533       
    35343534        m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSByteArray::offsetOfStorage()), resultGPR);
     
    35733573    case CheckFunction: {
    35743574        SpeculateCellOperand function(this, node.child1());
    3575         speculationCheck(JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, function.gpr(), node.function()));
     3575        speculationCheck(BadCache, JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, function.gpr(), node.function()));
    35763576        noResult(m_compileIndex);
    35773577        break;
     
    35893589       
    35903590        if (node.structureSet().size() == 1)
    3591             speculationCheck(JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, JITCompiler::Address(base.gpr(), JSCell::structureOffset()), node.structureSet()[0]));
     3591            speculationCheck(BadCache, JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, JITCompiler::Address(base.gpr(), JSCell::structureOffset()), node.structureSet()[0]));
    35923592        else {
    35933593            GPRTemporary structure(this);
     
    36003600                done.append(m_jit.branchWeakPtr(JITCompiler::Equal, structure.gpr(), node.structureSet()[i]));
    36013601           
    3602             speculationCheck(JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, structure.gpr(), node.structureSet().last()));
     3602            speculationCheck(BadCache, JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, structure.gpr(), node.structureSet().last()));
    36033603           
    36043604            done.link(&m_jit);
     
    37663766        // Speculate that base 'ImplementsDefaultHasInstance'.
    37673767        m_jit.loadPtr(MacroAssembler::Address(base.gpr(), JSCell::structureOffset()), structure.gpr());
    3768         speculationCheck(JSValueRegs(), NoNode, m_jit.branchTest8(MacroAssembler::Zero, MacroAssembler::Address(structure.gpr(), Structure::typeInfoFlagsOffset()), MacroAssembler::TrustedImm32(ImplementsDefaultHasInstance)));
     3768        speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTest8(MacroAssembler::Zero, MacroAssembler::Address(structure.gpr(), Structure::typeInfoFlagsOffset()), MacroAssembler::TrustedImm32(ImplementsDefaultHasInstance)));
    37693769
    37703770        noResult(m_compileIndex);
     
    38623862
    38633863    case ForceOSRExit: {
    3864         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     3864        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    38653865        break;
    38663866    }
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r102545 r102694  
    12831283    case DataFormatNone: {
    12841284        if ((node.hasConstant() && !isInt32Constant(nodeIndex)) || info.spillFormat() == DataFormatDouble) {
    1285             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1285            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    12861286            returnFormat = DataFormatInteger;
    12871287            return allocate();
     
    13331333        GPRReg gpr = info.gpr();
    13341334        m_gprs.lock(gpr);
    1335         speculationCheck(JSValueRegs(gpr), nodeIndex, m_jit.branchPtr(MacroAssembler::Below, gpr, GPRInfo::tagTypeNumberRegister));
     1335        speculationCheck(BadType, JSValueRegs(gpr), nodeIndex, m_jit.branchPtr(MacroAssembler::Below, gpr, GPRInfo::tagTypeNumberRegister));
    13361336        info.fillJSValue(gpr, DataFormatJSInteger);
    13371337        // If !strict we're done, return.
     
    13901390    case DataFormatJSCell:
    13911391    case DataFormatJSBoolean: {
    1392         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1392        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    13931393        returnFormat = DataFormatInteger;
    13941394        return allocate();
     
    14491449                return fpr;
    14501450            }
    1451             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1451            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    14521452            return fprAllocate();
    14531453        }
     
    14921492
    14931493    case DataFormatCell:
    1494         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1494        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    14951495        return fprAllocate();
    14961496
     
    15051505        JITCompiler::Jump isInteger = m_jit.branchPtr(MacroAssembler::AboveOrEqual, jsValueGpr, GPRInfo::tagTypeNumberRegister);
    15061506
    1507         speculationCheck(JSValueRegs(jsValueGpr), nodeIndex, m_jit.branchTestPtr(MacroAssembler::Zero, jsValueGpr, GPRInfo::tagTypeNumberRegister));
     1507        speculationCheck(BadType, JSValueRegs(jsValueGpr), nodeIndex, m_jit.branchTestPtr(MacroAssembler::Zero, jsValueGpr, GPRInfo::tagTypeNumberRegister));
    15081508
    15091509        // First, if we get here we have a double encoded as a JSValue
     
    15791579    case DataFormatNone: {
    15801580        if (info.spillFormat() == DataFormatInteger || info.spillFormat() == DataFormatDouble) {
    1581             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1581            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    15821582            return allocate();
    15831583        }
     
    15931593                return gpr;
    15941594            }
    1595             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1595            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    15961596            return gpr;
    15971597        }
     
    16021602        info.fillJSValue(gpr, DataFormatJS);
    16031603        if (info.spillFormat() != DataFormatJSCell)
    1604             speculationCheck(JSValueRegs(gpr), nodeIndex, m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, GPRInfo::tagMaskRegister));
     1604            speculationCheck(BadType, JSValueRegs(gpr), nodeIndex, m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, GPRInfo::tagMaskRegister));
    16051605        info.fillJSValue(gpr, DataFormatJSCell);
    16061606        return gpr;
     
    16171617        GPRReg gpr = info.gpr();
    16181618        m_gprs.lock(gpr);
    1619         speculationCheck(JSValueRegs(gpr), nodeIndex, m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, GPRInfo::tagMaskRegister));
     1619        speculationCheck(BadType, JSValueRegs(gpr), nodeIndex, m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, GPRInfo::tagMaskRegister));
    16201620        info.fillJSValue(gpr, DataFormatJSCell);
    16211621        return gpr;
     
    16281628    case DataFormatJSBoolean:
    16291629    case DataFormatBoolean: {
    1630         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1630        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    16311631        return allocate();
    16321632    }
     
    16521652    case DataFormatNone: {
    16531653        if (info.spillFormat() == DataFormatInteger || info.spillFormat() == DataFormatDouble) {
    1654             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1654            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    16551655            return allocate();
    16561656        }
     
    16661666                return gpr;
    16671667            }
    1668             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1668            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    16691669            return gpr;
    16701670        }
     
    16761676        if (info.spillFormat() != DataFormatJSBoolean) {
    16771677            m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), gpr);
    1678             speculationCheck(JSValueRegs(gpr), nodeIndex, m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, TrustedImm32(static_cast<int32_t>(~1))), SpeculationRecovery(BooleanSpeculationCheck, gpr, InvalidGPRReg));
     1678            speculationCheck(BadType, JSValueRegs(gpr), nodeIndex, m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, TrustedImm32(static_cast<int32_t>(~1))), SpeculationRecovery(BooleanSpeculationCheck, gpr, InvalidGPRReg));
    16791679            m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), gpr);
    16801680        }
     
    16941694        m_gprs.lock(gpr);
    16951695        m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), gpr);
    1696         speculationCheck(JSValueRegs(gpr), nodeIndex, m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, TrustedImm32(static_cast<int32_t>(~1))), SpeculationRecovery(BooleanSpeculationCheck, gpr, InvalidGPRReg));
     1696        speculationCheck(BadType, JSValueRegs(gpr), nodeIndex, m_jit.branchTestPtr(MacroAssembler::NonZero, gpr, TrustedImm32(static_cast<int32_t>(~1))), SpeculationRecovery(BooleanSpeculationCheck, gpr, InvalidGPRReg));
    16971697        m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), gpr);
    16981698        info.fillJSValue(gpr, DataFormatJSBoolean);
     
    17061706    case DataFormatJSCell:
    17071707    case DataFormatCell: {
    1708         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     1708        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    17091709        return allocate();
    17101710    }
     
    17491749   
    17501750    if (!predictionCheck(m_state.forNode(node.child1()).m_type))
    1751         speculationCheck(JSValueRegs(op1GPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR), MacroAssembler::TrustedImmPtr(vptr)));
     1751        speculationCheck(BadType, JSValueRegs(op1GPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR), MacroAssembler::TrustedImmPtr(vptr)));
    17521752    if (!predictionCheck(m_state.forNode(node.child2()).m_type))
    1753         speculationCheck(JSValueRegs(op2GPR), node.child2(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op2GPR), MacroAssembler::TrustedImmPtr(vptr)));
     1753        speculationCheck(BadType, JSValueRegs(op2GPR), node.child2(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op2GPR), MacroAssembler::TrustedImmPtr(vptr)));
    17541754   
    17551755    MacroAssembler::Jump falseCase = m_jit.branchPtr(MacroAssembler::NotEqual, op1GPR, op2GPR);
     
    18181818    MacroAssembler::Jump notCell = m_jit.branchTestPtr(MacroAssembler::NonZero, valueGPR, GPRInfo::tagMaskRegister);
    18191819    if (needSpeculationCheck)
    1820         speculationCheck(JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valueGPR), MacroAssembler::TrustedImmPtr(vptr)));
     1820        speculationCheck(BadType, JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valueGPR), MacroAssembler::TrustedImmPtr(vptr)));
    18211821    m_jit.move(TrustedImm32(static_cast<int32_t>(ValueFalse)), resultGPR);
    18221822    MacroAssembler::Jump done = m_jit.jump();
     
    18271827        m_jit.move(valueGPR, resultGPR);
    18281828        m_jit.andPtr(MacroAssembler::TrustedImm32(~TagBitUndefined), resultGPR);
    1829         speculationCheck(JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, resultGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull))));
     1829        speculationCheck(BadType, JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, resultGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull))));
    18301830    }
    18311831    m_jit.move(TrustedImm32(static_cast<int32_t>(ValueTrue)), resultGPR);
     
    18831883        m_jit.move(value.gpr(), result.gpr());
    18841884        m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueFalse)), result.gpr());
    1885         speculationCheck(JSValueRegs(value.gpr()), node.child1(), m_jit.branchTestPtr(JITCompiler::NonZero, result.gpr(), TrustedImm32(static_cast<int32_t>(~1))));
     1885        speculationCheck(BadType, JSValueRegs(value.gpr()), node.child1(), m_jit.branchTestPtr(JITCompiler::NonZero, result.gpr(), TrustedImm32(static_cast<int32_t>(~1))));
    18861886        m_jit.xorPtr(TrustedImm32(static_cast<int32_t>(ValueTrue)), result.gpr());
    18871887       
     
    19221922    MacroAssembler::Jump notCell = m_jit.branchTestPtr(MacroAssembler::NonZero, valueGPR, GPRInfo::tagMaskRegister);
    19231923    if (needSpeculationCheck)
    1924         speculationCheck(JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valueGPR), MacroAssembler::TrustedImmPtr(vptr)));
     1924        speculationCheck(BadType, JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valueGPR), MacroAssembler::TrustedImmPtr(vptr)));
    19251925    addBranch(m_jit.jump(), taken);
    19261926   
     
    19301930        m_jit.move(valueGPR, scratchGPR);
    19311931        m_jit.andPtr(MacroAssembler::TrustedImm32(~TagBitUndefined), scratchGPR);
    1932         speculationCheck(JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, scratchGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull))));
     1932        speculationCheck(BadType, JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, scratchGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull))));
    19331933    }
    19341934    if (notTaken != (m_block + 1))
     
    19981998            addBranch(m_jit.branchPtr(MacroAssembler::Equal, valueGPR, MacroAssembler::ImmPtr(JSValue::encode(jsBoolean(true)))), taken);
    19991999
    2000             speculationCheck(JSValueRegs(valueGPR), node.child1(), m_jit.jump());
     2000            speculationCheck(BadType, JSValueRegs(valueGPR), node.child1(), m_jit.jump());
    20012001            value.use();
    20022002        } else {
     
    20442044        // If we have no prediction for this local, then don't attempt to compile.
    20452045        if (prediction == PredictNone || value.isClear()) {
    2046             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     2046            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    20472047            break;
    20482048        }
     
    21142114            GPRReg cellGPR = cell.gpr();
    21152115            if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2116                 speculationCheck(JSValueRegs(cellGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(cellGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2116                speculationCheck(BadType, JSValueRegs(cellGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(cellGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    21172117            m_jit.storePtr(cellGPR, JITCompiler::addressFor(node.local()));
    21182118            noResult(m_compileIndex);
     
    21212121            GPRReg cellGPR = cell.gpr();
    21222122            if (!isByteArrayPrediction(m_state.forNode(node.child1()).m_type))
    2123                 speculationCheck(JSValueRegs(cellGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(cellGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
     2123                speculationCheck(BadType, JSValueRegs(cellGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(cellGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
    21242124            m_jit.storePtr(cellGPR, JITCompiler::addressFor(node.local()));
    21252125            noResult(m_compileIndex);
     
    22262226
    22272227        // Test the operand is positive.
    2228         speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, op1.gpr(), TrustedImm32(0)));
     2228        speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, op1.gpr(), TrustedImm32(0)));
    22292229
    22302230        m_jit.move(op1.gpr(), result.gpr());
     
    22742274                    m_jit.add32(Imm32(imm1), result.gpr());
    22752275                } else
    2276                     speculationCheck(JSValueRegs(), NoNode, m_jit.branchAdd32(MacroAssembler::Overflow, op2.gpr(), Imm32(imm1), result.gpr()));
     2276                    speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchAdd32(MacroAssembler::Overflow, op2.gpr(), Imm32(imm1), result.gpr()));
    22772277
    22782278                integerResult(result.gpr(), m_compileIndex);
     
    22892289                    m_jit.add32(Imm32(imm2), result.gpr());
    22902290                } else
    2291                     speculationCheck(JSValueRegs(), NoNode, m_jit.branchAdd32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
     2291                    speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchAdd32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
    22922292
    22932293                integerResult(result.gpr(), m_compileIndex);
     
    23142314               
    23152315                if (gpr1 == gprResult)
    2316                     speculationCheck(JSValueRegs(), NoNode, check, SpeculationRecovery(SpeculativeAdd, gprResult, gpr2));
     2316                    speculationCheck(Overflow, JSValueRegs(), NoNode, check, SpeculationRecovery(SpeculativeAdd, gprResult, gpr2));
    23172317                else if (gpr2 == gprResult)
    2318                     speculationCheck(JSValueRegs(), NoNode, check, SpeculationRecovery(SpeculativeAdd, gprResult, gpr1));
     2318                    speculationCheck(Overflow, JSValueRegs(), NoNode, check, SpeculationRecovery(SpeculativeAdd, gprResult, gpr1));
    23192319                else
    2320                     speculationCheck(JSValueRegs(), NoNode, check);
     2320                    speculationCheck(Overflow, JSValueRegs(), NoNode, check);
    23212321            }
    23222322
     
    23542354                    m_jit.sub32(Imm32(imm2), result.gpr());
    23552355                } else
    2356                     speculationCheck(JSValueRegs(), NoNode, m_jit.branchSub32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
     2356                    speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchSub32(MacroAssembler::Overflow, op1.gpr(), Imm32(imm2), result.gpr()));
    23572357
    23582358                integerResult(result.gpr(), m_compileIndex);
     
    23682368                m_jit.sub32(op2.gpr(), result.gpr());
    23692369            } else
    2370                 speculationCheck(JSValueRegs(), NoNode, m_jit.branchSub32(MacroAssembler::Overflow, op1.gpr(), op2.gpr(), result.gpr()));
     2370                speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchSub32(MacroAssembler::Overflow, op1.gpr(), op2.gpr(), result.gpr()));
    23712371
    23722372            integerResult(result.gpr(), m_compileIndex);
     
    24002400            GPRReg op2GPR = op2.gpr();
    24012401           
    2402             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTest32(JITCompiler::Zero, op2GPR));
     2402            speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchTest32(JITCompiler::Zero, op2GPR));
    24032403           
    24042404            // If the user cares about negative zero, then speculate that we're not about
     
    24062406            if (!nodeCanIgnoreNegativeZero(node.arithNodeFlags())) {
    24072407                MacroAssembler::Jump numeratorNonZero = m_jit.branchTest32(MacroAssembler::NonZero, op1GPR);
    2408                 speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, op2GPR, TrustedImm32(0)));
     2408                speculationCheck(NegativeZero, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, op2GPR, TrustedImm32(0)));
    24092409                numeratorNonZero.link(&m_jit);
    24102410            }
     
    24262426            // Check that there was no remainder. If there had been, then we'd be obligated to
    24272427            // produce a double result instead.
    2428             speculationCheck(JSValueRegs(), NoNode, m_jit.branchTest32(JITCompiler::NonZero, edx.gpr()));
     2428            speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branchTest32(JITCompiler::NonZero, edx.gpr()));
    24292429           
    24302430            integerResult(eax.gpr(), m_compileIndex);
     
    24592459            m_jit.add32(scratch.gpr(), result.gpr());
    24602460            m_jit.xor32(scratch.gpr(), result.gpr());
    2461             speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::Equal, result.gpr(), MacroAssembler::TrustedImm32(1 << 31)));
     2461            speculationCheck(Overflow, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::Equal, result.gpr(), MacroAssembler::TrustedImm32(1 << 31)));
    24622462            integerResult(result.gpr(), m_compileIndex);
    24632463            break;
     
    26892689
    26902690        if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2691             speculationCheck(JSValueRegs(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    2692         speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(baseReg, JSArray::vectorLengthOffset())));
     2691            speculationCheck(BadType, JSValueRegs(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2692        speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::AboveOrEqual, propertyReg, MacroAssembler::Address(baseReg, JSArray::vectorLengthOffset())));
    26932693
    26942694        // FIXME: In cases where there are subsequent by_val accesses to the same base it might help to cache
     
    26972697        GPRTemporary result(this);
    26982698        m_jit.loadPtr(MacroAssembler::BaseIndex(storageReg, propertyReg, MacroAssembler::ScalePtr, OBJECT_OFFSETOF(ArrayStorage, m_vector[0])), result.gpr());
    2699         speculationCheck(JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::Zero, result.gpr()));
     2699        speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTestPtr(MacroAssembler::Zero, result.gpr()));
    27002700
    27012701        jsValueResult(result.gpr(), m_compileIndex);
     
    28002800        // If we have predicted the base to be type array, we can skip the check.
    28012801        if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2802             speculationCheck(JSValueRegs(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2802            speculationCheck(BadType, JSValueRegs(baseReg), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseReg), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    28032803
    28042804        base.use();
     
    29442944
    29452945        if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2946             speculationCheck(JSValueRegs(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2946            speculationCheck(BadType, JSValueRegs(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    29472947       
    29482948        m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSArray::storageOffset()), storageGPR);
     
    29502950       
    29512951        // Refuse to handle bizarre lengths.
    2952         speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::Above, storageLengthGPR, TrustedImm32(0x7ffffffe)));
     2952        speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::Above, storageLengthGPR, TrustedImm32(0x7ffffffe)));
    29532953       
    29542954        MacroAssembler::Jump slowPath = m_jit.branch32(MacroAssembler::AboveOrEqual, storageLengthGPR, MacroAssembler::Address(baseGPR, JSArray::vectorLengthOffset()));
     
    29872987       
    29882988        if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    2989             speculationCheck(JSValueRegs(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     2989            speculationCheck(BadType, JSValueRegs(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    29902990       
    29912991        m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSArray::storageOffset()), storageGPR);
     
    30923092        // We expect that throw statements are rare and are intended to exit the code block
    30933093        // anyway, so we just OSR back to the old JIT for now.
    3094         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     3094        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    30953095        break;
    30963096    }
     
    32253225                m_jit.move(thisValueGPR, scratchGPR);
    32263226                m_jit.andPtr(MacroAssembler::TrustedImm32(~TagBitUndefined), scratchGPR);
    3227                 speculationCheck(JSValueRegs(thisValueGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, scratchGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull))));
     3227                speculationCheck(BadType, JSValueRegs(thisValueGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, scratchGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull))));
    32283228            }
    32293229           
     
    32403240           
    32413241            if (!isObjectPrediction(m_state.forNode(node.child1()).m_type))
    3242                 speculationCheck(JSValueRegs(thisValueGPR), node.child1(), m_jit.branchPtr(JITCompiler::Equal, JITCompiler::Address(thisValueGPR), JITCompiler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
     3242                speculationCheck(BadType, JSValueRegs(thisValueGPR), node.child1(), m_jit.branchPtr(JITCompiler::Equal, JITCompiler::Address(thisValueGPR), JITCompiler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
    32433243           
    32443244            m_jit.move(thisValueGPR, resultGPR);
     
    32843284        if (at(node.child1()).shouldSpeculateFinalObject()) {
    32853285            if (!isFinalObjectPrediction(m_state.forNode(node.child1()).m_type))
    3286                 speculationCheck(JSValueRegs(protoGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(protoGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsFinalObjectVPtr)));
     3286                speculationCheck(BadType, JSValueRegs(protoGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(protoGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsFinalObjectVPtr)));
    32873287        } else {
    32883288            m_jit.loadPtr(MacroAssembler::Address(protoGPR, JSCell::structureOffset()), scratchGPR);
     
    33913391    case GetById: {
    33923392        if (!node.prediction()) {
    3393             terminateSpeculativeExecution(JSValueRegs(), NoNode);
     3393            terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    33943394            break;
    33953395        }
     
    34473447       
    34483448        if (!isArrayPrediction(m_state.forNode(node.child1()).m_type))
    3449             speculationCheck(JSValueRegs(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
     3449            speculationCheck(BadType, JSValueRegs(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsArrayVPtr)));
    34503450       
    34513451        m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSArray::storageOffset()), resultGPR);
    34523452        m_jit.load32(MacroAssembler::Address(resultGPR, OBJECT_OFFSETOF(ArrayStorage, m_length)), resultGPR);
    34533453       
    3454         speculationCheck(JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, resultGPR, MacroAssembler::TrustedImm32(0)));
     3454        speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branch32(MacroAssembler::LessThan, resultGPR, MacroAssembler::TrustedImm32(0)));
    34553455       
    34563456        integerResult(resultGPR, m_compileIndex);
     
    34663466       
    34673467        if (!isStringPrediction(m_state.forNode(node.child1()).m_type))
    3468             speculationCheck(JSValueRegs(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
     3468            speculationCheck(BadType, JSValueRegs(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsStringVPtr)));
    34693469       
    34703470        m_jit.load32(MacroAssembler::Address(baseGPR, JSString::offsetOfLength()), resultGPR);
     
    34823482       
    34833483        if (!isByteArrayPrediction(m_state.forNode(node.child1()).m_type))
    3484             speculationCheck(JSValueRegs(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
     3484            speculationCheck(BadType, JSValueRegs(baseGPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(baseGPR), MacroAssembler::TrustedImmPtr(m_jit.globalData()->jsByteArrayVPtr)));
    34853485       
    34863486        m_jit.loadPtr(MacroAssembler::Address(baseGPR, JSByteArray::offsetOfStorage()), resultGPR);
     
    35243524    case CheckFunction: {
    35253525        SpeculateCellOperand function(this, node.child1());
    3526         speculationCheck(JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, function.gpr(), node.function()));
     3526        speculationCheck(BadCache, JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, function.gpr(), node.function()));
    35273527        noResult(m_compileIndex);
    35283528        break;
     
    35393539       
    35403540        if (node.structureSet().size() == 1)
    3541             speculationCheck(JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, JITCompiler::Address(base.gpr(), JSCell::structureOffset()), node.structureSet()[0]));
     3541            speculationCheck(BadCache, JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, JITCompiler::Address(base.gpr(), JSCell::structureOffset()), node.structureSet()[0]));
    35423542        else {
    35433543            GPRTemporary structure(this);
     
    35503550                done.append(m_jit.branchWeakPtr(JITCompiler::Equal, structure.gpr(), node.structureSet()[i]));
    35513551           
    3552             speculationCheck(JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, structure.gpr(), node.structureSet().last()));
     3552            speculationCheck(BadCache, JSValueRegs(), NoNode, m_jit.branchWeakPtr(JITCompiler::NotEqual, structure.gpr(), node.structureSet().last()));
    35533553           
    35543554            done.link(&m_jit);
     
    37063706        // Speculate that base 'ImplementsDefaultHasInstance'.
    37073707        m_jit.loadPtr(MacroAssembler::Address(base.gpr(), JSCell::structureOffset()), structure.gpr());
    3708         speculationCheck(JSValueRegs(), NoNode, m_jit.branchTest8(MacroAssembler::Zero, MacroAssembler::Address(structure.gpr(), Structure::typeInfoFlagsOffset()), MacroAssembler::TrustedImm32(ImplementsDefaultHasInstance)));
     3708        speculationCheck(Uncountable, JSValueRegs(), NoNode, m_jit.branchTest8(MacroAssembler::Zero, MacroAssembler::Address(structure.gpr(), Structure::typeInfoFlagsOffset()), MacroAssembler::TrustedImm32(ImplementsDefaultHasInstance)));
    37093709
    37103710        noResult(m_compileIndex);
     
    37953795
    37963796    case ForceOSRExit: {
    3797         terminateSpeculativeExecution(JSValueRegs(), NoNode);
     3797        terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode);
    37983798        break;
    37993799    }
  • trunk/Source/JavaScriptCore/runtime/Heuristics.cpp

    r102489 r102694  
    6868unsigned couldTakeSlowCaseMinimumCount;
    6969
     70double osrExitProminenceForFrequentExitSite;
     71
    7072unsigned largeFailCountThresholdBase;
    7173unsigned largeFailCountThresholdBaseForLoop;
     
    148150    SET(likelyToTakeSlowCaseMinimumCount, 100);
    149151    SET(couldTakeSlowCaseMinimumCount,    10);
     152   
     153    SET(osrExitProminenceForFrequentExitSite, 0.3);
    150154
    151155    SET(largeFailCountThresholdBase,        20);
  • trunk/Source/JavaScriptCore/runtime/Heuristics.h

    r102489 r102694  
    5454extern unsigned couldTakeSlowCaseMinimumCount;
    5555
     56extern double osrExitProminenceForFrequentExitSite;
     57
    5658extern unsigned largeFailCountThresholdBase;
    5759extern unsigned largeFailCountThresholdBaseForLoop;
Note: See TracChangeset for help on using the changeset viewer.