Title: [137976] trunk/Source/_javascript_Core
Revision
137976
Author
[email protected]
Date
2012-12-17 19:51:07 -0800 (Mon, 17 Dec 2012)

Log Message

DFG: Refactor DFGCorrectableJumpPoint to reduce size of OSRExit data
https://bugs.webkit.org/show_bug.cgi?id=105237

Reviewed by Filip Pizlo.

Replaced DFGCorrectableJumpPoint with OSRExitCompilationInfo which is used and kept alive only while we are
compiling in the DFG.  Moved the patchable branch offset directly into OSRExit.

* CMakeLists.txt:
* GNUmakefile.list.am:
* _javascript_Core.xcodeproj/project.pbxproj:
* Target.pri:
* assembler/AbstractMacroAssembler.h:
* dfg/DFGCorrectableJumpPoint.cpp: Removed.
* dfg/DFGCorrectableJumpPoint.h: Removed.
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::linkOSRExits):
(JSC::DFG::JITCompiler::link):
* dfg/DFGJITCompiler.h:
(JSC::DFG::JITCompiler::appendExitJump):
(JITCompiler):
* dfg/DFGOSRExit.cpp:
(JSC::DFG::OSRExit::OSRExit):
(JSC::DFG::OSRExit::setPatchableCodeOffset):
(JSC::DFG::OSRExit::getPatchableCodeOffsetAsJump):
(JSC::DFG::OSRExit::codeLocationForRepatch):
(JSC::DFG::OSRExit::correctJump):
* dfg/DFGOSRExit.h:
(OSRExit):
* dfg/DFGOSRExitCompilationInfo.h: Added.
(OSRExitCompilationInfo):
(JSC::DFG::OSRExitCompilationInfo::OSRExitCompilationInfo):
(JSC::DFG::OSRExitCompilationInfo::failureJump):
* dfg/DFGOSRExitCompiler.cpp:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::speculationCheck):
(JSC::DFG::SpeculativeJIT::speculationWatchpoint):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/CMakeLists.txt (137975 => 137976)


--- trunk/Source/_javascript_Core/CMakeLists.txt	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/CMakeLists.txt	2012-12-18 03:51:07 UTC (rev 137976)
@@ -80,7 +80,6 @@
     dfg/DFGCFAPhase.cpp
     dfg/DFGCFGSimplificationPhase.cpp
     dfg/DFGConstantFoldingPhase.cpp
-    dfg/DFGCorrectableJumpPoint.cpp
     dfg/DFGCSEPhase.cpp
     dfg/DFGDisassembler.cpp
     dfg/DFGDominators.cpp

Modified: trunk/Source/_javascript_Core/ChangeLog (137975 => 137976)


--- trunk/Source/_javascript_Core/ChangeLog	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-12-18 03:51:07 UTC (rev 137976)
@@ -1,3 +1,43 @@
+2012-12-17  Michael Saboff  <[email protected]>
+
+        DFG: Refactor DFGCorrectableJumpPoint to reduce size of OSRExit data
+        https://bugs.webkit.org/show_bug.cgi?id=105237
+
+        Reviewed by Filip Pizlo.
+
+        Replaced DFGCorrectableJumpPoint with OSRExitCompilationInfo which is used and kept alive only while we are
+        compiling in the DFG.  Moved the patchable branch offset directly into OSRExit.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * _javascript_Core.xcodeproj/project.pbxproj:
+        * Target.pri:
+        * assembler/AbstractMacroAssembler.h:
+        * dfg/DFGCorrectableJumpPoint.cpp: Removed.
+        * dfg/DFGCorrectableJumpPoint.h: Removed.
+        * dfg/DFGJITCompiler.cpp:
+        (JSC::DFG::JITCompiler::linkOSRExits):
+        (JSC::DFG::JITCompiler::link):
+        * dfg/DFGJITCompiler.h:
+        (JSC::DFG::JITCompiler::appendExitJump):
+        (JITCompiler):
+        * dfg/DFGOSRExit.cpp:
+        (JSC::DFG::OSRExit::OSRExit):
+        (JSC::DFG::OSRExit::setPatchableCodeOffset):
+        (JSC::DFG::OSRExit::getPatchableCodeOffsetAsJump):
+        (JSC::DFG::OSRExit::codeLocationForRepatch):
+        (JSC::DFG::OSRExit::correctJump):
+        * dfg/DFGOSRExit.h:
+        (OSRExit):
+        * dfg/DFGOSRExitCompilationInfo.h: Added.
+        (OSRExitCompilationInfo):
+        (JSC::DFG::OSRExitCompilationInfo::OSRExitCompilationInfo):
+        (JSC::DFG::OSRExitCompilationInfo::failureJump):
+        * dfg/DFGOSRExitCompiler.cpp:
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::speculationCheck):
+        (JSC::DFG::SpeculativeJIT::speculationWatchpoint):
+
 2012-12-17  Filip Pizlo  <[email protected]>
 
         DFG is too aggressive with eliding overflow checks in loops

Modified: trunk/Source/_javascript_Core/GNUmakefile.list.am (137975 => 137976)


--- trunk/Source/_javascript_Core/GNUmakefile.list.am	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/GNUmakefile.list.am	2012-12-18 03:51:07 UTC (rev 137976)
@@ -186,8 +186,6 @@
 	Source/_javascript_Core/dfg/DFGCFAPhase.cpp \
 	Source/_javascript_Core/dfg/DFGCFAPhase.h \
 	Source/_javascript_Core/dfg/DFGCommon.h \
-	Source/_javascript_Core/dfg/DFGCorrectableJumpPoint.cpp \
-	Source/_javascript_Core/dfg/DFGCorrectableJumpPoint.h \
 	Source/_javascript_Core/dfg/DFGConstantFoldingPhase.cpp \
 	Source/_javascript_Core/dfg/DFGConstantFoldingPhase.h \
 	Source/_javascript_Core/dfg/DFGCSEPhase.cpp \
@@ -228,6 +226,7 @@
 	Source/_javascript_Core/dfg/DFGOSRExitCompiler.h \
 	Source/_javascript_Core/dfg/DFGOSRExit.h \
 	Source/_javascript_Core/dfg/DFGOSRExit.cpp \
+	Source/_javascript_Core/dfg/DFGOSRExitCompilationInfo.h \
 	Source/_javascript_Core/dfg/DFGPhase.cpp \
 	Source/_javascript_Core/dfg/DFGPhase.h \
 	Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp \

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (137975 => 137976)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2012-12-18 03:51:07 UTC (rev 137976)
@@ -236,8 +236,6 @@
 		0FC09776146943B000CF2442 /* DFGOSRExitCompiler32_64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC09775146943AD00CF2442 /* DFGOSRExitCompiler32_64.cpp */; };
 		0FC09791146A6F7100CF2442 /* DFGOSRExit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC0978E146A6F6300CF2442 /* DFGOSRExit.cpp */; };
 		0FC09792146A6F7300CF2442 /* DFGOSRExitCompiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC0978F146A6F6300CF2442 /* DFGOSRExitCompiler.cpp */; };
-		0FC0979C146A772500CF2442 /* DFGCorrectableJumpPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC0979A146A772000CF2442 /* DFGCorrectableJumpPoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		0FC0979E146B272100CF2442 /* DFGCorrectableJumpPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC0979D146B271E00CF2442 /* DFGCorrectableJumpPoint.cpp */; };
 		0FC097A1146B28CA00CF2442 /* DFGThunks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FC0979F146B28C700CF2442 /* DFGThunks.cpp */; };
 		0FC097A2146B28CC00CF2442 /* DFGThunks.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC097A0146B28C700CF2442 /* DFGThunks.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FC8150A14043BF500CFA603 /* WriteBarrierSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC8150914043BD200CFA603 /* WriteBarrierSupport.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1071,8 +1069,6 @@
 		0FC0977E1469EBC400CF2442 /* DFGCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCommon.h; path = dfg/DFGCommon.h; sourceTree = "<group>"; };
 		0FC0978E146A6F6300CF2442 /* DFGOSRExit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExit.cpp; path = dfg/DFGOSRExit.cpp; sourceTree = "<group>"; };
 		0FC0978F146A6F6300CF2442 /* DFGOSRExitCompiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGOSRExitCompiler.cpp; path = dfg/DFGOSRExitCompiler.cpp; sourceTree = "<group>"; };
-		0FC0979A146A772000CF2442 /* DFGCorrectableJumpPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCorrectableJumpPoint.h; path = dfg/DFGCorrectableJumpPoint.h; sourceTree = "<group>"; };
-		0FC0979D146B271E00CF2442 /* DFGCorrectableJumpPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGCorrectableJumpPoint.cpp; path = dfg/DFGCorrectableJumpPoint.cpp; sourceTree = "<group>"; };
 		0FC0979F146B28C700CF2442 /* DFGThunks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGThunks.cpp; path = dfg/DFGThunks.cpp; sourceTree = "<group>"; };
 		0FC097A0146B28C700CF2442 /* DFGThunks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGThunks.h; path = dfg/DFGThunks.h; sourceTree = "<group>"; };
 		0FC8150814043BCA00CFA603 /* WriteBarrierSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WriteBarrierSupport.cpp; sourceTree = "<group>"; };
@@ -1292,6 +1288,7 @@
 		6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
 		65621E6B089E859700760F35 /* PropertySlot.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PropertySlot.cpp; sourceTree = "<group>"; tabWidth = 8; };
 		65621E6C089E859700760F35 /* PropertySlot.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = PropertySlot.h; sourceTree = "<group>"; tabWidth = 8; };
+		65987F2C167FE84B003C2F8D /* DFGOSRExitCompilationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOSRExitCompilationInfo.h; path = dfg/DFGOSRExitCompilationInfo.h; sourceTree = "<group>"; };
 		65C02FBB0637462A003E7EE6 /* Protect.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Protect.h; sourceTree = "<group>"; tabWidth = 8; };
 		65C7A1710A8EAACB00FA37EA /* JSWrapperObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSWrapperObject.cpp; sourceTree = "<group>"; };
 		65C7A1720A8EAACB00FA37EA /* JSWrapperObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSWrapperObject.h; sourceTree = "<group>"; };
@@ -2455,6 +2452,7 @@
 		86EC9DB31328DF44002B2AD7 /* dfg */ = {
 			isa = PBXGroup;
 			children = (
+				65987F2C167FE84B003C2F8D /* DFGOSRExitCompilationInfo.h */,
 				0F62016D143FCD2F0068B77C /* DFGAbstractState.cpp */,
 				0F62016E143FCD2F0068B77C /* DFGAbstractState.h */,
 				0F62016F143FCD2F0068B77C /* DFGAbstractValue.h */,
@@ -2482,8 +2480,6 @@
 				0FC0977E1469EBC400CF2442 /* DFGCommon.h */,
 				0F3B3A17153E68EF003ED0FF /* DFGConstantFoldingPhase.cpp */,
 				0F3B3A18153E68EF003ED0FF /* DFGConstantFoldingPhase.h */,
-				0FC0979D146B271E00CF2442 /* DFGCorrectableJumpPoint.cpp */,
-				0FC0979A146A772000CF2442 /* DFGCorrectableJumpPoint.h */,
 				0FFFC94D14EF909500C72532 /* DFGCSEPhase.cpp */,
 				0FFFC94E14EF909500C72532 /* DFGCSEPhase.h */,
 				0FF427611591A1C9004CB9FF /* DFGDisassembler.cpp */,
@@ -2816,7 +2812,6 @@
 				0F620176143FCD3B0068B77C /* DFGBasicBlock.h in Headers */,
 				86EC9DC51328DF82002B2AD7 /* DFGByteCodeParser.h in Headers */,
 				0F2C556F14738F3100121E4F /* DFGCodeBlocks.h in Headers */,
-				0FC0979C146A772500CF2442 /* DFGCorrectableJumpPoint.h in Headers */,
 				0FD3C82814115D4F00FD81CB /* DFGDriver.h in Headers */,
 				0FBC0AE81496C7C700D4FBDD /* DFGExitProfile.h in Headers */,
 				86AE6C4D136A11E400963012 /* DFGFPRInfo.h in Headers */,
@@ -3531,7 +3526,6 @@
 				86EC9DC41328DF82002B2AD7 /* DFGByteCodeParser.cpp in Sources */,
 				0FD82E2114172CE300179C94 /* DFGCapabilities.cpp in Sources */,
 				0F2C557014738F3500121E4F /* DFGCodeBlocks.cpp in Sources */,
-				0FC0979E146B272100CF2442 /* DFGCorrectableJumpPoint.cpp in Sources */,
 				0FD3C82614115D4000FD81CB /* DFGDriver.cpp in Sources */,
 				0FBC0AE71496C7C400D4FBDD /* DFGExitProfile.cpp in Sources */,
 				86EC9DC71328DF82002B2AD7 /* DFGGraph.cpp in Sources */,

Modified: trunk/Source/_javascript_Core/Target.pri (137975 => 137976)


--- trunk/Source/_javascript_Core/Target.pri	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/Target.pri	2012-12-18 03:51:07 UTC (rev 137976)
@@ -116,7 +116,6 @@
     dfg/DFGCFAPhase.cpp \
     dfg/DFGCFGSimplificationPhase.cpp \
     dfg/DFGConstantFoldingPhase.cpp \
-    dfg/DFGCorrectableJumpPoint.cpp \
     dfg/DFGCSEPhase.cpp \
     dfg/DFGDisassembler.cpp \
     dfg/DFGDominators.cpp \

Modified: trunk/Source/_javascript_Core/assembler/AbstractMacroAssembler.h (137975 => 137976)


--- trunk/Source/_javascript_Core/assembler/AbstractMacroAssembler.h	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/assembler/AbstractMacroAssembler.h	2012-12-18 03:51:07 UTC (rev 137976)
@@ -51,7 +51,7 @@
 class RepatchBuffer;
 class Watchpoint;
 namespace DFG {
-class CorrectableJumpPoint;
+struct OSRExit;
 }
 
 template <class AssemblerType>
@@ -320,7 +320,7 @@
     class Label {
         template<class TemplateAssemblerType>
         friend class AbstractMacroAssembler;
-        friend class DFG::CorrectableJumpPoint;
+        friend struct DFG::OSRExit;
         friend class Jump;
         friend class JumpReplacementWatchpoint;
         friend class MacroAssemblerCodeRef;
@@ -501,7 +501,7 @@
         template<class TemplateAssemblerType>
         friend class AbstractMacroAssembler;
         friend class Call;
-        friend class DFG::CorrectableJumpPoint;
+        friend struct DFG::OSRExit;
         friend class LinkBuffer;
     public:
         Jump()

Deleted: trunk/Source/_javascript_Core/dfg/DFGCorrectableJumpPoint.cpp (137975 => 137976)


--- trunk/Source/_javascript_Core/dfg/DFGCorrectableJumpPoint.cpp	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/dfg/DFGCorrectableJumpPoint.cpp	2012-12-18 03:51:07 UTC (rev 137976)
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include "config.h"
-#include "DFGCorrectableJumpPoint.h"
-
-#if ENABLE(DFG_JIT)
-
-#include "CodeBlock.h"
-
-namespace JSC { namespace DFG {
-
-CodeLocationJump CorrectableJumpPoint::codeLocationForRepatch(CodeBlock* codeBlock) const
-{
-    ASSERT(m_mode == CorrectedJump);
-    return CodeLocationJump(codeBlock->getJITCode().dataAddressAtOffset(m_codeOffset));
-}
-
-} } // namespace JSC::DFG
-
-#endif // ENABLE(DFG_JIT)

Deleted: trunk/Source/_javascript_Core/dfg/DFGCorrectableJumpPoint.h (137975 => 137976)


--- trunk/Source/_javascript_Core/dfg/DFGCorrectableJumpPoint.h	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/dfg/DFGCorrectableJumpPoint.h	2012-12-18 03:51:07 UTC (rev 137976)
@@ -1,164 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef DFGCorrectableJumpPoint_h
-#define DFGCorrectableJumpPoint_h
-
-#if ENABLE(DFG_JIT)
-
-#include "LinkBuffer.h"
-#include "MacroAssembler.h"
-
-namespace JSC { namespace DFG {
-
-// This is a type-safe union of MacroAssembler::Jump and CodeLocationJump.
-// Furthermore, it supports the notion of branching (possibly conditionally, but
-// also possibly jumping unconditionally) to an out-of-line patchable jump.
-// Thus it goes through three states:
-//
-// 1) Label of unpatchable branch or jump (i.e. MacroAssembler::Jump).
-// 2) Label of patchable jump (i.e. MacroAssembler::PatchableJump).
-// 3) Corrected post-linking label of patchable jump (i.e. CodeLocationJump).
-//
-// The setting of state (1) corresponds to planting the in-line unpatchable
-// branch or jump. The state transition (1)->(2) corresponds to linking the
-// in-line branch or jump to the out-of-line patchable jump, and recording
-// the latter's label. The state transition (2)->(3) corresponds to recording
-// the out-of-line patchable jump's location after branch compaction has
-// completed.
-//
-// You can also go directly from the first state to the third state, if you
-// wish to use this class for in-line patchable jumps.
-
-class CorrectableJumpPoint {
-public:
-    CorrectableJumpPoint(MacroAssembler::Jump check)
-        : m_codeOffset(check.m_label.m_offset)
-#ifndef NDEBUG
-        , m_mode(InitialJump)
-#endif
-    {
-#if CPU(ARM_THUMB2)
-        m_type = check.m_type;
-        m_condition = check.m_condition;
-#endif
-    }
-    
-    bool isSet()
-    {
-        return m_codeOffset != std::numeric_limits<uint32_t>::max();
-    }
-    
-    void switchToLateJump(MacroAssembler::PatchableJump check)
-    {
-#ifndef NDEBUG
-        ASSERT(m_mode == InitialJump);
-        m_mode = LateJump;
-#endif
-        // Late jumps should only ever be real jumps.
-#if CPU(ARM_THUMB2)
-        ASSERT(check.m_jump.m_type == ARMv7Assembler::JumpNoConditionFixedSize);
-        ASSERT(check.m_jump.m_condition == ARMv7Assembler::ConditionInvalid);
-        m_type = ARMv7Assembler::JumpNoConditionFixedSize;
-        m_condition = ARMv7Assembler::ConditionInvalid;
-#endif
-        m_codeOffset = check.m_jump.m_label.m_offset;
-    }
-    
-    void correctInitialJump(LinkBuffer& linkBuffer)
-    {
-        ASSERT(m_mode == InitialJump);
-#if CPU(ARM_THUMB2)
-        ASSERT(m_type == ARMv7Assembler::JumpNoConditionFixedSize);
-        ASSERT(m_condition == ARMv7Assembler::ConditionInvalid);
-#endif
-        correctJump(linkBuffer);
-    }
-    
-    void correctLateJump(LinkBuffer& linkBuffer)
-    {
-        ASSERT(m_mode == LateJump);
-        correctJump(linkBuffer);
-    }
-    
-    MacroAssembler::Jump initialJump() const
-    {
-        ASSERT(m_mode == InitialJump);
-        return getJump();
-    }
-    
-    MacroAssembler::Jump lateJump() const
-    {
-        ASSERT(m_mode == LateJump);
-        return getJump();
-    }
-    
-    CodeLocationJump codeLocationForRepatch(CodeBlock*) const;
-    
-private:
-    void correctJump(LinkBuffer& linkBuffer)
-    {
-#ifndef NDEBUG
-        m_mode = CorrectedJump;
-#endif
-        MacroAssembler::Label label;
-        label.m_label.m_offset = m_codeOffset;
-        m_codeOffset = linkBuffer.offsetOf(label);
-    }
-    
-    MacroAssembler::Jump getJump() const
-    {
-        MacroAssembler::Jump jump;
-        jump.m_label.m_offset = m_codeOffset;
-#if CPU(ARM_THUMB2)
-        jump.m_type = m_type;
-        jump.m_condition = m_condition;
-#endif
-        return jump;
-    }
-    
-    unsigned m_codeOffset;
-
-#if CPU(ARM_THUMB2)
-    ARMv7Assembler::JumpType m_type : 8;
-    ARMv7Assembler::Condition m_condition : 8;
-#endif
-
-#ifndef NDEBUG
-    enum Mode {
-        InitialJump,
-        LateJump,
-        CorrectedJump
-    };
-
-    Mode m_mode;
-#endif
-};
-
-} } // namespace JSC::DFG
-
-#endif // ENABLE(DFG_JIT)
-
-#endif // DFGCorrectableJumpPoint_h

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (137975 => 137976)


--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp	2012-12-18 03:51:07 UTC (rev 137976)
@@ -51,11 +51,12 @@
 
 void JITCompiler::linkOSRExits()
 {
+    ASSERT(codeBlock()->numberOfOSRExits() == m_exitCompilationInfo.size());
     if (m_graph.m_compilation) {
         for (unsigned i = 0; i < codeBlock()->numberOfOSRExits(); ++i) {
             OSRExit& exit = codeBlock()->osrExit(i);
             if (exit.m_watchpointIndex == std::numeric_limits<unsigned>::max())
-                m_exitSiteLabels.append(exit.m_check.initialJump().label());
+                m_exitSiteLabels.append(m_exitCompilationInfo[i].failureJump().label());
             else
                 m_exitSiteLabels.append(codeBlock()->watchpoint(exit.m_watchpointIndex).sourceLabel());
         }
@@ -63,14 +64,15 @@
     
     for (unsigned i = 0; i < codeBlock()->numberOfOSRExits(); ++i) {
         OSRExit& exit = codeBlock()->osrExit(i);
-        ASSERT(!exit.m_check.isSet() == (exit.m_watchpointIndex != std::numeric_limits<unsigned>::max()));
+        Jump& failureJump = m_exitCompilationInfo[i].failureJump();
+        ASSERT(!failureJump.isSet() == (exit.m_watchpointIndex != std::numeric_limits<unsigned>::max()));
         if (exit.m_watchpointIndex == std::numeric_limits<unsigned>::max())
-            exit.m_check.initialJump().link(this);
+            failureJump.link(this);
         else
             codeBlock()->watchpoint(exit.m_watchpointIndex).setDestination(label());
         jitAssertHasValidCallFrame();
         store32(TrustedImm32(i), &globalData()->osrExitIndex);
-        exit.m_check.switchToLateJump(patchableJump());
+        exit.setPatchableCodeOffset(patchableJump());
     }
 }
 
@@ -210,8 +212,8 @@
     CodeLocationLabel target = CodeLocationLabel(osrExitThunk.code());
     for (unsigned i = 0; i < codeBlock()->numberOfOSRExits(); ++i) {
         OSRExit& exit = codeBlock()->osrExit(i);
-        linkBuffer.link(exit.m_check.lateJump(), target);
-        exit.m_check.correctLateJump(linkBuffer);
+        linkBuffer.link(exit.getPatchableCodeOffsetAsJump(), target);
+        exit.correctJump(linkBuffer);
         if (exit.m_watchpointIndex != std::numeric_limits<unsigned>::max())
             codeBlock()->watchpoint(exit.m_watchpointIndex).correctLabels(linkBuffer);
     }

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h (137975 => 137976)


--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h	2012-12-18 03:51:07 UTC (rev 137976)
@@ -34,6 +34,7 @@
 #include "DFGFPRInfo.h"
 #include "DFGGPRInfo.h"
 #include "DFGGraph.h"
+#include "DFGOSRExitCompilationInfo.h"
 #include "DFGRegisterBank.h"
 #include "DFGRegisterSet.h"
 #include "JITCode.h"
@@ -343,6 +344,8 @@
     SpeculatedType getSpeculation(NodeIndex nodeIndex) { return getSpeculation(graph()[nodeIndex]); }
     SpeculatedType getSpeculation(Edge nodeUse) { return getSpeculation(nodeUse.index()); }
 
+    void appendExitJump(MacroAssembler::Jump jumpToFail) { m_exitCompilationInfo.append(OSRExitCompilationInfo(jumpToFail)); }
+
 #if USE(JSVALUE32_64)
     void* addressOfDoubleConstant(NodeIndex nodeIndex)
     {
@@ -460,6 +463,7 @@
     
     Vector<PropertyAccessRecord, 4> m_propertyAccesses;
     Vector<JSCallRecord, 4> m_jsCalls;
+    Vector<OSRExitCompilationInfo> m_exitCompilationInfo;
     Vector<Label> m_exitSiteLabels;
     unsigned m_currentCodeOriginIndex;
 };

Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp (137975 => 137976)


--- trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp	2012-12-18 03:51:07 UTC (rev 137976)
@@ -33,10 +33,10 @@
 
 namespace JSC { namespace DFG {
 
-OSRExit::OSRExit(ExitKind kind, JSValueSource jsValueSource, MethodOfGettingAValueProfile valueProfile, MacroAssembler::Jump check, SpeculativeJIT* jit, unsigned streamIndex, unsigned recoveryIndex)
+OSRExit::OSRExit(ExitKind kind, JSValueSource jsValueSource, MethodOfGettingAValueProfile valueProfile, SpeculativeJIT* jit, unsigned streamIndex, unsigned recoveryIndex)
     : m_jsValueSource(jsValueSource)
     , m_valueProfile(valueProfile)
-    , m_check(check)
+    , m_patchableCodeOffset(0)
     , m_nodeIndex(jit->m_compileIndex)
     , m_codeOrigin(jit->m_codeOriginForOSR)
     , m_codeOriginForExitProfile(m_codeOrigin)
@@ -50,6 +50,28 @@
     ASSERT(m_codeOrigin.isSet());
 }
 
+void OSRExit::setPatchableCodeOffset(MacroAssembler::PatchableJump check)
+{
+    m_patchableCodeOffset = check.m_jump.m_label.m_offset;
+}
+
+MacroAssembler::Jump OSRExit::getPatchableCodeOffsetAsJump() const
+{
+    return MacroAssembler::Jump(AssemblerLabel(m_patchableCodeOffset));
+}
+
+CodeLocationJump OSRExit::codeLocationForRepatch(CodeBlock* dfgCodeBlock) const
+{
+    return CodeLocationJump(dfgCodeBlock->getJITCode().dataAddressAtOffset(m_patchableCodeOffset));
+}
+
+void OSRExit::correctJump(LinkBuffer& linkBuffer)
+{
+    MacroAssembler::Label label;
+    label.m_label.m_offset = m_patchableCodeOffset;
+    m_patchableCodeOffset = linkBuffer.offsetOf(label);
+}
+
 bool OSRExit::considerAddingAsFrequentExitSiteSlow(CodeBlock* dfgCodeBlock, CodeBlock* profiledCodeBlock)
 {
     if (static_cast<double>(m_count) / dfgCodeBlock->osrExitCounter() <= Options::osrExitProminenceForFrequentExitSite())

Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExit.h (137975 => 137976)


--- trunk/Source/_javascript_Core/dfg/DFGOSRExit.h	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExit.h	2012-12-18 03:51:07 UTC (rev 137976)
@@ -32,7 +32,6 @@
 
 #include "CodeOrigin.h"
 #include "DFGCommon.h"
-#include "DFGCorrectableJumpPoint.h"
 #include "DFGExitProfile.h"
 #include "DFGGPRInfo.h"
 #include "DFGValueRecoveryOverride.h"
@@ -84,14 +83,14 @@
 // 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);
+    OSRExit(ExitKind, JSValueSource, MethodOfGettingAValueProfile, SpeculativeJIT*, unsigned streamIndex, unsigned recoveryIndex = 0);
     
     MacroAssemblerCodeRef m_code;
     
     JSValueSource m_jsValueSource;
     MethodOfGettingAValueProfile m_valueProfile;
-    
-    CorrectableJumpPoint m_check;
+
+    unsigned m_patchableCodeOffset;
     NodeIndex m_nodeIndex;
     CodeOrigin m_codeOrigin;
     CodeOrigin m_codeOriginForExitProfile;
@@ -108,7 +107,12 @@
             return false;
         return considerAddingAsFrequentExitSiteSlow(dfgCodeBlock, profiledCodeBlock);
     }
-    
+
+    void setPatchableCodeOffset(MacroAssembler::PatchableJump);
+    MacroAssembler::Jump getPatchableCodeOffsetAsJump() const;
+    CodeLocationJump codeLocationForRepatch(CodeBlock*) const;
+    void correctJump(LinkBuffer&);
+
     unsigned m_streamIndex;
     int m_lastSetOperand;
     

Copied: trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilationInfo.h (from rev 137973, trunk/Source/_javascript_Core/dfg/DFGCorrectableJumpPoint.cpp) (0 => 137976)


--- trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilationInfo.h	                        (rev 0)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilationInfo.h	2012-12-18 03:51:07 UTC (rev 137976)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef DFGOSRExitCompilationInfo_h
+#define DFGOSRExitCompilationInfo_h
+
+#include <wtf/Platform.h>
+
+#if ENABLE(DFG_JIT)
+
+#include "CodeOrigin.h"
+#include "DFGCommon.h"
+#include "MacroAssembler.h"
+
+namespace JSC { namespace DFG {
+
+class OSRExitCompilationInfo {
+public:
+    OSRExitCompilationInfo(MacroAssembler::Jump failureJump)
+        : m_failureJump(failureJump)
+    {
+    }
+
+    MacroAssembler::Jump& failureJump() { return m_failureJump; }
+
+private:
+    MacroAssembler::Jump m_failureJump;
+};
+
+} } // namespace JSC::DFG
+
+#endif // ENABLE(DFG_JIT)
+
+#endif // DFGOSRExitCompilationInfo_h
+

Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler.cpp (137975 => 137976)


--- trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler.cpp	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler.cpp	2012-12-18 03:51:07 UTC (rev 137976)
@@ -118,7 +118,7 @@
     
     {
         RepatchBuffer repatchBuffer(codeBlock);
-        repatchBuffer.relink(exit.m_check.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code()));
+        repatchBuffer.relink(exit.codeLocationForRepatch(codeBlock), CodeLocationLabel(exit.m_code.code()));
     }
     
     globalData->osrExitJumpDestination = exit.m_code.code().executableAddress();

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (137975 => 137976)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2012-12-18 03:51:04 UTC (rev 137975)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2012-12-18 03:51:07 UTC (rev 137976)
@@ -109,7 +109,8 @@
     if (!m_compileOkay)
         return;
     ASSERT(at(m_compileIndex).canExit() || m_isCheckingArgumentTypes);
-    m_jit.codeBlock()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(nodeIndex), jumpToFail, this, m_stream->size()));
+    m_jit.appendExitJump(jumpToFail);
+    m_jit.codeBlock()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(nodeIndex), this, m_stream->size()));
 }
 
 void SpeculativeJIT::speculationCheck(ExitKind kind, JSValueSource jsValueSource, Edge nodeUse, MacroAssembler::Jump jumpToFail)
@@ -138,7 +139,8 @@
         return;
     ASSERT(at(m_compileIndex).canExit() || m_isCheckingArgumentTypes);
     m_jit.codeBlock()->appendSpeculationRecovery(recovery);
-    m_jit.codeBlock()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(nodeIndex), jumpToFail, this, m_stream->size(), m_jit.codeBlock()->numberOfSpeculationRecoveries()));
+    m_jit.appendExitJump(jumpToFail);
+    m_jit.codeBlock()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(nodeIndex), this, m_stream->size(), m_jit.codeBlock()->numberOfSpeculationRecoveries()));
 }
 
 void SpeculativeJIT::speculationCheck(ExitKind kind, JSValueSource jsValueSource, Edge nodeUse, MacroAssembler::Jump jumpToFail, const SpeculationRecovery& recovery)
@@ -159,11 +161,12 @@
     if (!m_compileOkay)
         return 0;
     ASSERT(at(m_compileIndex).canExit() || m_isCheckingArgumentTypes);
+    m_jit.appendExitJump(JITCompiler::Jump());
     OSRExit& exit = m_jit.codeBlock()->osrExit(
         m_jit.codeBlock()->appendOSRExit(
             OSRExit(kind, jsValueSource,
                     m_jit.graph().methodOfGettingAValueProfileFor(nodeIndex),
-                    JITCompiler::Jump(), this, m_stream->size())));
+                    this, m_stream->size())));
     exit.m_watchpointIndex = m_jit.codeBlock()->appendWatchpoint(
         JumpReplacementWatchpoint(m_jit.watchpointLabel()));
     return &m_jit.codeBlock()->watchpoint(exit.m_watchpointIndex);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to