Changeset 207475 in webkit for trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h
- Timestamp:
- Oct 18, 2016, 11:30:05 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/CallLinkInfo.h
r207222 r207475 29 29 #include "CodeLocation.h" 30 30 #include "CodeSpecializationKind.h" 31 #include "JSFunction.h"32 31 #include "PolymorphicCallStubRoutine.h" 33 32 #include "WriteBarrier.h" … … 38 37 #if ENABLE(JIT) 39 38 39 class FunctionCodeBlock; 40 class JSFunction; 40 41 enum OpcodeID : unsigned; 41 42 struct CallFrameShuffleData; … … 43 44 class CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> { 44 45 public: 45 enum CallType { None, Call, CallVarargs, Construct, ConstructVarargs, TailCall, TailCallVarargs }; 46 enum CallType { 47 None, 48 Call, 49 CallVarargs, 50 Construct, 51 ConstructVarargs, 52 TailCall, 53 TailCallVarargs, 54 DirectCall, 55 DirectConstruct, 56 DirectTailCall 57 }; 58 46 59 static CallType callTypeFor(OpcodeID opcodeID); 47 60 … … 65 78 static CodeSpecializationKind specializationKindFor(CallType callType) 66 79 { 67 return specializationFromIsConstruct(callType == Construct || callType == ConstructVarargs );80 return specializationFromIsConstruct(callType == Construct || callType == ConstructVarargs || callType == DirectConstruct); 68 81 } 69 82 CodeSpecializationKind specializationKind() const … … 71 84 return specializationKindFor(static_cast<CallType>(m_callType)); 72 85 } 73 86 74 87 static CallMode callModeFor(CallType callType) 75 88 { … … 77 90 case Call: 78 91 case CallVarargs: 92 case DirectCall: 79 93 return CallMode::Regular; 80 94 case TailCall: 81 95 case TailCallVarargs: 96 case DirectTailCall: 82 97 return CallMode::Tail; 83 98 case Construct: 84 99 case ConstructVarargs: 100 case DirectConstruct: 85 101 return CallMode::Construct; 86 102 case None: … … 90 106 RELEASE_ASSERT_NOT_REACHED(); 91 107 } 92 108 109 static bool isDirect(CallType callType) 110 { 111 switch (callType) { 112 case DirectCall: 113 case DirectTailCall: 114 case DirectConstruct: 115 return true; 116 case Call: 117 case CallVarargs: 118 case TailCall: 119 case TailCallVarargs: 120 case Construct: 121 case ConstructVarargs: 122 return false; 123 case None: 124 RELEASE_ASSERT_NOT_REACHED(); 125 return false; 126 } 127 128 RELEASE_ASSERT_NOT_REACHED(); 129 return false; 130 } 131 93 132 CallMode callMode() const 94 133 { … … 96 135 } 97 136 137 bool isDirect() 138 { 139 return isDirect(static_cast<CallType>(m_callType)); 140 } 141 98 142 bool isTailCall() const 99 143 { 100 144 return callMode() == CallMode::Tail; 101 145 } 146 147 NearCallMode nearCallMode() const 148 { 149 return isTailCall() ? Tail : Regular; 150 } 102 151 103 152 bool isVarargs() const … … 106 155 } 107 156 108 bool isLinked() { return m_stub || m_callee ; }157 bool isLinked() { return m_stub || m_calleeOrCodeBlock; } 109 158 void unlink(VM&); 110 159 … … 116 165 } 117 166 118 void setCallLocations(CodeLocationNearCall callReturnLocation, CodeLocationDataLabelPtr hotPathBegin, 167 void setCallLocations( 168 CodeLocationLabel callReturnLocationOrPatchableJump, 169 CodeLocationLabel hotPathBeginOrSlowPathStart, 119 170 CodeLocationNearCall hotPathOther) 120 171 { 121 m_callReturnLocation = callReturnLocation;122 m_hotPathBegin = hotPathBegin;172 m_callReturnLocationOrPatchableJump = callReturnLocationOrPatchableJump; 173 m_hotPathBeginOrSlowPathStart = hotPathBeginOrSlowPathStart; 123 174 m_hotPathOther = hotPathOther; 124 175 } … … 131 182 } 132 183 133 void setUpCallFromFTL(CallType callType, CodeOrigin codeOrigin, 134 CodeLocationNearCall callReturnLocation, CodeLocationDataLabelPtr hotPathBegin, 135 CodeLocationNearCall hotPathOther, unsigned calleeGPR) 136 { 137 m_callType = callType; 138 m_codeOrigin = codeOrigin; 139 m_callReturnLocation = callReturnLocation; 140 m_hotPathBegin = hotPathBegin; 141 m_hotPathOther = hotPathOther; 142 m_calleeGPR = calleeGPR; 143 } 144 145 CodeLocationNearCall callReturnLocation() 146 { 147 return m_callReturnLocation; 148 } 149 150 CodeLocationDataLabelPtr hotPathBegin() 151 { 152 return m_hotPathBegin; 153 } 184 CodeLocationNearCall callReturnLocation(); 185 CodeLocationJump patchableJump(); 186 CodeLocationDataLabelPtr hotPathBegin(); 187 CodeLocationLabel slowPathStart(); 154 188 155 189 CodeLocationNearCall hotPathOther() … … 159 193 160 194 void setCallee(VM&, JSCell*, JSFunction* callee); 161 162 195 void clearCallee(); 163 164 JSFunction* callee() 165 { 166 return m_callee.get(); 167 } 168 169 void setLastSeenCallee(VM& vm, const JSCell* owner, JSFunction* callee) 170 { 171 m_lastSeenCallee.set(vm, owner, callee); 172 } 173 174 void clearLastSeenCallee() 175 { 176 m_lastSeenCallee.clear(); 177 } 178 179 JSFunction* lastSeenCallee() 180 { 181 return m_lastSeenCallee.get(); 182 } 183 184 bool haveLastSeenCallee() 185 { 186 return !!m_lastSeenCallee; 187 } 188 196 JSFunction* callee(); 197 198 void setCodeBlock(VM&, JSCell*, FunctionCodeBlock*); 199 void clearCodeBlock(); 200 FunctionCodeBlock* codeBlock(); 201 202 void setLastSeenCallee(VM& vm, const JSCell* owner, JSFunction* callee); 203 void clearLastSeenCallee(); 204 JSFunction* lastSeenCallee(); 205 bool haveLastSeenCallee(); 206 207 void setExecutableDuringCompilation(ExecutableBase*); 208 ExecutableBase* executable(); 209 189 210 void setStub(PassRefPtr<PolymorphicCallStubRoutine> newStub) 190 211 { … … 255 276 } 256 277 257 uint 8_t* addressOfMaxNumArguments()278 uint32_t* addressOfMaxNumArguments() 258 279 { 259 280 return &m_maxNumArguments; 260 281 } 261 282 262 uint 8_t maxNumArguments()283 uint32_t maxNumArguments() 263 284 { 264 285 return m_maxNumArguments; 265 286 } 287 288 void setMaxNumArguments(unsigned); 266 289 267 290 static ptrdiff_t offsetOfSlowPathCount() … … 305 328 306 329 private: 307 CodeLocation NearCall m_callReturnLocation;308 CodeLocation DataLabelPtr m_hotPathBegin;330 CodeLocationLabel m_callReturnLocationOrPatchableJump; 331 CodeLocationLabel m_hotPathBeginOrSlowPathStart; 309 332 CodeLocationNearCall m_hotPathOther; 310 WriteBarrier<JS Function> m_callee;311 WriteBarrier<JS Function> m_lastSeenCallee;333 WriteBarrier<JSCell> m_calleeOrCodeBlock; 334 WriteBarrier<JSCell> m_lastSeenCalleeOrExecutable; 312 335 RefPtr<PolymorphicCallStubRoutine> m_stub; 313 336 RefPtr<JITStubRoutine> m_slowStub; … … 317 340 bool m_clearedByGC : 1; 318 341 bool m_allowStubs : 1; 342 bool m_isLinked : 1; 319 343 unsigned m_callType : 4; // CallType 320 344 unsigned m_calleeGPR : 8; 321 uint 8_t m_maxNumArguments; // Only used for varargs calls.345 uint32_t m_maxNumArguments; // For varargs: the profiled maximum number of arguments. For direct: the number of stack slots allocated for arguments. 322 346 uint32_t m_slowPathCount; 323 347 CodeOrigin m_codeOrigin;
Note:
See TracChangeset
for help on using the changeset viewer.