fourthTier: Landing the initial FTL logic in a single commit to avoid spurious
[WebKit-https.git] / Source / JavaScriptCore / dfg / DFGOSRExit.h
index cd2434c..50bddd4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,9 +32,9 @@
 
 #include "CodeOrigin.h"
 #include "DFGCommon.h"
-#include "DFGCorrectableJumpPoint.h"
 #include "DFGExitProfile.h"
 #include "DFGGPRInfo.h"
+#include "DFGOSRExitBase.h"
 #include "DFGValueRecoveryOverride.h"
 #include "MacroAssembler.h"
 #include "MethodOfGettingAValueProfile.h"
@@ -46,6 +46,8 @@
 namespace JSC { namespace DFG {
 
 class SpeculativeJIT;
+struct BasicBlock;
+struct Node;
 
 // This enum describes the types of additional recovery that
 // may need be performed should a speculation check fail.
@@ -83,47 +85,35 @@ private:
 //
 // This structure describes how to exit the speculative path by
 // going into baseline code.
-struct OSRExit {
-    OSRExit(ExitKind, JSValueSource, MethodOfGettingAValueProfile, MacroAssembler::Jump, SpeculativeJIT*, unsigned streamIndex, unsigned recoveryIndex = 0);
+struct OSRExit : public OSRExitBase {
+    OSRExit(ExitKind, JSValueSource, MethodOfGettingAValueProfile, SpeculativeJIT*, unsigned streamIndex, unsigned recoveryIndex = UINT_MAX);
     
     MacroAssemblerCodeRef m_code;
     
     JSValueSource m_jsValueSource;
     MethodOfGettingAValueProfile m_valueProfile;
-    
-    CorrectableJumpPoint m_check;
-    NodeIndex m_nodeIndex;
-    CodeOrigin m_codeOrigin;
-    CodeOrigin m_codeOriginForExitProfile;
+
+    unsigned m_patchableCodeOffset;
     
     unsigned m_recoveryIndex;
     unsigned m_watchpointIndex;
     
-    ExitKind m_kind;
-    uint32_t m_count;
-    
-    bool considerAddingAsFrequentExitSite(CodeBlock* dfgCodeBlock, CodeBlock* profiledCodeBlock)
-    {
-        if (!m_count || !exitKindIsCountable(m_kind))
-            return false;
-        return considerAddingAsFrequentExitSiteSlow(dfgCodeBlock, profiledCodeBlock);
-    }
+    void setPatchableCodeOffset(MacroAssembler::PatchableJump);
+    MacroAssembler::Jump getPatchableCodeOffsetAsJump() const;
+    CodeLocationJump codeLocationForRepatch(CodeBlock*) const;
+    void correctJump(LinkBuffer&);
     
+    void convertToForward(BasicBlock*, Node*, unsigned nodeIndex, const ValueRecovery&);
+
     unsigned m_streamIndex;
     int m_lastSetOperand;
     
     RefPtr<ValueRecoveryOverride> m_valueRecoveryOverride;
-
-private:
-    bool considerAddingAsFrequentExitSiteSlow(CodeBlock* dfgCodeBlock, CodeBlock* profiledCodeBlock);
 };
 
-#if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
 struct SpeculationFailureDebugInfo {
     CodeBlock* codeBlock;
-    NodeIndex nodeIndex;
 };
-#endif
 
 } } // namespace JSC::DFG