JITTimeProfileInfo.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #include "Backend.h"
  6. JITTimeProfileInfo::JITTimeProfileInfo(ProfileDataIDL * profileData) :
  7. m_profileData(*profileData)
  8. {
  9. CompileAssert(sizeof(JITTimeProfileInfo) == sizeof(ProfileDataIDL));
  10. }
  11. /* static */
  12. void
  13. JITTimeProfileInfo::InitializeJITProfileData(
  14. __in ArenaAllocator * alloc,
  15. __in Js::DynamicProfileInfo * profileInfo,
  16. __in Js::FunctionBody *functionBody,
  17. __out ProfileDataIDL * data,
  18. bool isForegroundJIT)
  19. {
  20. if (profileInfo == nullptr)
  21. {
  22. return;
  23. }
  24. CompileAssert(sizeof(LdElemIDL) == sizeof(Js::LdElemInfo));
  25. CompileAssert(sizeof(StElemIDL) == sizeof(Js::StElemInfo));
  26. data->profiledLdElemCount = functionBody->GetProfiledLdElemCount();
  27. data->profiledStElemCount = functionBody->GetProfiledStElemCount();
  28. if (JITManager::GetJITManager()->IsOOPJITEnabled() || isForegroundJIT)
  29. {
  30. data->ldElemData = (LdElemIDL*)profileInfo->GetLdElemInfo();
  31. data->stElemData = (StElemIDL*)profileInfo->GetStElemInfo();
  32. }
  33. else
  34. {
  35. // for in-proc background JIT we need to explicitly copy LdElem and StElem info
  36. data->ldElemData = AnewArray(alloc, LdElemIDL, data->profiledLdElemCount);
  37. memcpy_s(
  38. data->ldElemData,
  39. data->profiledLdElemCount * sizeof(LdElemIDL),
  40. profileInfo->GetLdElemInfo(),
  41. functionBody->GetProfiledLdElemCount() * sizeof(Js::LdElemInfo)
  42. );
  43. data->stElemData = AnewArray(alloc, StElemIDL, data->profiledStElemCount);
  44. memcpy_s(
  45. data->stElemData,
  46. data->profiledStElemCount * sizeof(StElemIDL),
  47. profileInfo->GetStElemInfo(),
  48. functionBody->GetProfiledStElemCount() * sizeof(Js::StElemInfo)
  49. );
  50. }
  51. CompileAssert(sizeof(ArrayCallSiteIDL) == sizeof(Js::ArrayCallSiteInfo));
  52. data->profiledArrayCallSiteCount = functionBody->GetProfiledArrayCallSiteCount();
  53. data->arrayCallSiteData = (ArrayCallSiteIDL*)profileInfo->GetArrayCallSiteInfo();
  54. data->arrayCallSiteDataAddr = (intptr_t)profileInfo->GetArrayCallSiteInfo();
  55. CompileAssert(sizeof(FldIDL) == sizeof(Js::FldInfo));
  56. data->inlineCacheCount = functionBody->GetProfiledFldCount();
  57. data->fldData = (FldIDL*)profileInfo->GetFldInfo();
  58. data->fldDataAddr = (intptr_t)profileInfo->GetFldInfo();
  59. CompileAssert(sizeof(ThisIDL) == sizeof(Js::ThisInfo));
  60. data->thisData = *reinterpret_cast<ThisIDL*>(&profileInfo->GetThisInfo());
  61. CompileAssert(sizeof(CallSiteIDL) == sizeof(Js::CallSiteInfo));
  62. data->profiledCallSiteCount = functionBody->GetProfiledCallSiteCount();
  63. data->callSiteData = reinterpret_cast<CallSiteIDL*>(profileInfo->GetCallSiteInfo());
  64. CompileAssert(sizeof(BVUnitIDL) == sizeof(BVUnit));
  65. data->loopFlags = (BVFixedIDL*)profileInfo->GetLoopFlags();
  66. CompileAssert(sizeof(ValueType) == sizeof(uint16));
  67. data->profiledSlotCount = functionBody->GetProfiledSlotCount();
  68. data->slotData = reinterpret_cast<uint16*>(profileInfo->GetSlotInfo());
  69. data->profiledReturnTypeCount = functionBody->GetProfiledReturnTypeCount();
  70. data->returnTypeData = reinterpret_cast<uint16*>(profileInfo->GetReturnTypeInfo());
  71. data->profiledDivOrRemCount = functionBody->GetProfiledDivOrRemCount();
  72. data->divideTypeInfo = reinterpret_cast<uint16*>(profileInfo->GetDivideTypeInfo());
  73. data->profiledSwitchCount = functionBody->GetProfiledSwitchCount();
  74. data->switchTypeInfo = reinterpret_cast<uint16*>(profileInfo->GetSwitchTypeInfo());
  75. data->profiledInParamsCount = functionBody->GetProfiledInParamsCount();
  76. data->parameterInfo = reinterpret_cast<uint16*>(profileInfo->GetParameterInfo());
  77. data->loopCount = functionBody->GetLoopCount();
  78. data->loopImplicitCallFlags = reinterpret_cast<byte*>(profileInfo->GetLoopImplicitCallFlags());
  79. data->implicitCallFlags = static_cast<byte>(profileInfo->GetImplicitCallFlags());
  80. data->flags = 0;
  81. data->flags |= profileInfo->IsAggressiveIntTypeSpecDisabled(false) ? Flags_disableAggressiveIntTypeSpec : 0;
  82. data->flags |= profileInfo->IsAggressiveIntTypeSpecDisabled(true) ? Flags_disableAggressiveIntTypeSpec_jitLoopBody : 0;
  83. data->flags |= profileInfo->IsAggressiveMulIntTypeSpecDisabled(false) ? Flags_disableAggressiveMulIntTypeSpec : 0;
  84. data->flags |= profileInfo->IsAggressiveMulIntTypeSpecDisabled(true) ? Flags_disableAggressiveMulIntTypeSpec_jitLoopBody : 0;
  85. data->flags |= profileInfo->IsDivIntTypeSpecDisabled(false) ? Flags_disableDivIntTypeSpec : 0;
  86. data->flags |= profileInfo->IsDivIntTypeSpecDisabled(true) ? Flags_disableDivIntTypeSpec_jitLoopBody : 0;
  87. data->flags |= profileInfo->IsLossyIntTypeSpecDisabled() ? Flags_disableLossyIntTypeSpec : 0;
  88. data->flags |= profileInfo->IsTrackCompoundedIntOverflowDisabled() ? Flags_disableTrackCompoundedIntOverflow : 0;
  89. data->flags |= profileInfo->IsFloatTypeSpecDisabled() ? Flags_disableFloatTypeSpec : 0;
  90. data->flags |= profileInfo->IsArrayCheckHoistDisabled(false) ? Flags_disableArrayCheckHoist : 0;
  91. data->flags |= profileInfo->IsArrayCheckHoistDisabled(true) ? Flags_disableArrayCheckHoist_jitLoopBody : 0;
  92. data->flags |= profileInfo->IsArrayMissingValueCheckHoistDisabled(false) ? Flags_disableArrayMissingValueCheckHoist : 0;
  93. data->flags |= profileInfo->IsArrayMissingValueCheckHoistDisabled(true) ? Flags_disableArrayMissingValueCheckHoist_jitLoopBody : 0;
  94. data->flags |= profileInfo->IsJsArraySegmentHoistDisabled(false) ? Flags_disableJsArraySegmentHoist : 0;
  95. data->flags |= profileInfo->IsJsArraySegmentHoistDisabled(true) ? Flags_disableJsArraySegmentHoist_jitLoopBody : 0;
  96. data->flags |= profileInfo->IsArrayLengthHoistDisabled(false) ? Flags_disableArrayLengthHoist : 0;
  97. data->flags |= profileInfo->IsArrayLengthHoistDisabled(true) ? Flags_disableArrayLengthHoist_jitLoopBody : 0;
  98. data->flags |= profileInfo->IsTypedArrayTypeSpecDisabled(false) ? Flags_disableTypedArrayTypeSpec : 0;
  99. data->flags |= profileInfo->IsTypedArrayTypeSpecDisabled(true) ? Flags_disableTypedArrayTypeSpec_jitLoopBody : 0;
  100. data->flags |= profileInfo->IsLdLenIntSpecDisabled() ? Flags_disableLdLenIntSpec : 0;
  101. data->flags |= profileInfo->IsBoundCheckHoistDisabled(false) ? Flags_disableBoundCheckHoist : 0;
  102. data->flags |= profileInfo->IsBoundCheckHoistDisabled(true) ? Flags_disableBoundCheckHoist_jitLoopBody : 0;
  103. data->flags |= profileInfo->IsLoopCountBasedBoundCheckHoistDisabled(false) ? Flags_disableLoopCountBasedBoundCheckHoist : 0;
  104. data->flags |= profileInfo->IsLoopCountBasedBoundCheckHoistDisabled(true) ? Flags_disableLoopCountBasedBoundCheckHoist_jitLoopBody : 0;
  105. data->flags |= profileInfo->IsFloorInliningDisabled() ? Flags_disableFloorInlining : 0;
  106. data->flags |= profileInfo->IsNoProfileBailoutsDisabled() ? Flags_disableNoProfileBailouts : 0;
  107. data->flags |= profileInfo->IsSwitchOptDisabled() ? Flags_disableSwitchOpt : 0;
  108. data->flags |= profileInfo->IsEquivalentObjTypeSpecDisabled() ? Flags_disableEquivalentObjTypeSpec : 0;
  109. data->flags |= profileInfo->IsObjTypeSpecDisabledInJitLoopBody() ? Flags_disableObjTypeSpec_jitLoopBody : 0;
  110. data->flags |= profileInfo->IsMemOpDisabled() ? Flags_disableMemOp : 0;
  111. data->flags |= profileInfo->IsCheckThisDisabled() ? Flags_disableCheckThis : 0;
  112. data->flags |= profileInfo->HasLdFldCallSiteInfo() ? Flags_hasLdFldCallSiteInfo : 0;
  113. data->flags |= profileInfo->IsStackArgOptDisabled() ? Flags_disableStackArgOpt : 0;
  114. data->flags |= profileInfo->IsLoopImplicitCallInfoDisabled() ? Flags_disableLoopImplicitCallInfo : 0;
  115. data->flags |= profileInfo->IsPowIntIntTypeSpecDisabled() ? Flags_disablePowIntIntTypeSpec : 0;
  116. data->flags |= profileInfo->IsTagCheckDisabled() ? Flags_disableTagCheck : 0;
  117. data->flags |= profileInfo->IsOptimizeTryFinallyDisabled() ? Flags_disableOptimizeTryFinally : 0;
  118. }
  119. const Js::LdElemInfo *
  120. JITTimeProfileInfo::GetLdElemInfo(Js::ProfileId ldElemId) const
  121. {
  122. AssertOrFailFast(ldElemId < m_profileData.profiledLdElemCount);
  123. return &(reinterpret_cast<Js::LdElemInfo*>(m_profileData.ldElemData)[ldElemId]);
  124. }
  125. const Js::StElemInfo *
  126. JITTimeProfileInfo::GetStElemInfo(Js::ProfileId stElemId) const
  127. {
  128. AssertOrFailFast(stElemId < m_profileData.profiledStElemCount);
  129. return &(reinterpret_cast<Js::StElemInfo*>(m_profileData.stElemData)[stElemId]);
  130. }
  131. Js::ArrayCallSiteInfo *
  132. JITTimeProfileInfo::GetArrayCallSiteInfo(Js::ProfileId index) const
  133. {
  134. AssertOrFailFast(index < GetProfiledArrayCallSiteCount());
  135. return &(reinterpret_cast<Js::ArrayCallSiteInfo*>(m_profileData.arrayCallSiteData)[index]);
  136. }
  137. intptr_t
  138. JITTimeProfileInfo::GetArrayCallSiteInfoAddr(Js::ProfileId index) const
  139. {
  140. AssertOrFailFast(index < GetProfiledArrayCallSiteCount());
  141. return m_profileData.arrayCallSiteDataAddr + index * sizeof(ArrayCallSiteIDL);
  142. }
  143. Js::FldInfo *
  144. JITTimeProfileInfo::GetFldInfo(uint fieldAccessId) const
  145. {
  146. AssertOrFailFast(fieldAccessId < GetProfiledFldCount());
  147. return &(reinterpret_cast<Js::FldInfo*>(m_profileData.fldData)[fieldAccessId]);
  148. }
  149. intptr_t
  150. JITTimeProfileInfo::GetFldInfoAddr(uint fieldAccessId) const
  151. {
  152. Assert(fieldAccessId < GetProfiledFldCount());
  153. return m_profileData.fldDataAddr + fieldAccessId * sizeof(Js::FldInfo);
  154. }
  155. ValueType
  156. JITTimeProfileInfo::GetSlotLoad(Js::ProfileId slotLoadId) const
  157. {
  158. AssertOrFailFast(slotLoadId < GetProfiledSlotCount());
  159. return reinterpret_cast<ValueType*>(m_profileData.slotData)[slotLoadId];
  160. }
  161. Js::ThisInfo
  162. JITTimeProfileInfo::GetThisInfo() const
  163. {
  164. return *reinterpret_cast<const Js::ThisInfo*>(&m_profileData.thisData);
  165. }
  166. ValueType
  167. JITTimeProfileInfo::GetReturnType(Js::OpCode opcode, Js::ProfileId callSiteId) const
  168. {
  169. if (opcode < Js::OpCode::ProfiledReturnTypeCallI || (opcode > Js::OpCode::ProfiledReturnTypeCallIFlags && opcode < Js::OpCode::ProfiledReturnTypeCallIExtended) || opcode > Js::OpCode::ProfiledReturnTypeCallIExtendedFlags)
  170. {
  171. Assert(Js::DynamicProfileInfo::IsProfiledCallOp(opcode));
  172. AssertOrFailFast(callSiteId < GetProfiledCallSiteCount());
  173. return GetCallSiteInfo()[callSiteId].returnType;
  174. }
  175. Assert(Js::DynamicProfileInfo::IsProfiledReturnTypeOp(opcode));
  176. AssertOrFailFast(callSiteId < GetProfiledReturnTypeCount());
  177. return reinterpret_cast<ValueType*>(m_profileData.returnTypeData)[callSiteId];
  178. }
  179. ValueType
  180. JITTimeProfileInfo::GetDivProfileInfo(Js::ProfileId divideId) const
  181. {
  182. AssertOrFailFast(divideId < GetProfiledDivOrRemCount());
  183. return reinterpret_cast<ValueType*>(m_profileData.divideTypeInfo)[divideId];
  184. }
  185. ValueType
  186. JITTimeProfileInfo::GetSwitchProfileInfo(Js::ProfileId switchId) const
  187. {
  188. AssertOrFailFast(switchId < GetProfiledSwitchCount());
  189. return reinterpret_cast<ValueType*>(m_profileData.switchTypeInfo)[switchId];
  190. }
  191. ValueType
  192. JITTimeProfileInfo::GetParameterInfo(Js::ArgSlot index) const
  193. {
  194. AssertOrFailFast(index < GetProfiledInParamsCount());
  195. return reinterpret_cast<ValueType*>(m_profileData.parameterInfo)[index];
  196. }
  197. Js::ImplicitCallFlags
  198. JITTimeProfileInfo::GetLoopImplicitCallFlags(uint loopNum) const
  199. {
  200. // TODO: michhol OOP JIT, investigate vaibility of reenabling this assert
  201. // Assert(Js::DynamicProfileInfo::EnableImplicitCallFlags(functionBody));
  202. AssertOrFailFast(loopNum < GetLoopCount());
  203. // Mask out the dispose implicit call. We would bailout on reentrant dispose,
  204. // but it shouldn't affect optimization.
  205. return (Js::ImplicitCallFlags)(m_profileData.loopImplicitCallFlags[loopNum] & Js::ImplicitCall_All);
  206. }
  207. Js::ImplicitCallFlags
  208. JITTimeProfileInfo::GetImplicitCallFlags() const
  209. {
  210. return static_cast<Js::ImplicitCallFlags>(m_profileData.implicitCallFlags);
  211. }
  212. Js::LoopFlags
  213. JITTimeProfileInfo::GetLoopFlags(uint loopNum) const
  214. {
  215. Assert(GetLoopFlags() != nullptr);
  216. return GetLoopFlags()->GetRange<Js::LoopFlags>(loopNum * Js::LoopFlags::COUNT, Js::LoopFlags::COUNT);
  217. }
  218. uint16
  219. JITTimeProfileInfo::GetConstantArgInfo(Js::ProfileId callSiteId) const
  220. {
  221. return GetCallSiteInfo()[callSiteId].isArgConstant;
  222. }
  223. bool
  224. JITTimeProfileInfo::IsModulusOpByPowerOf2(Js::ProfileId profileId) const
  225. {
  226. return GetDivProfileInfo(profileId).IsLikelyTaggedInt();
  227. }
  228. bool
  229. JITTimeProfileInfo::IsAggressiveIntTypeSpecDisabled(const bool isJitLoopBody) const
  230. {
  231. if (isJitLoopBody)
  232. {
  233. return TestFlag(Flags_disableAggressiveIntTypeSpec_jitLoopBody);
  234. }
  235. else
  236. {
  237. return TestFlag(Flags_disableAggressiveIntTypeSpec);
  238. }
  239. }
  240. bool
  241. JITTimeProfileInfo::IsSwitchOptDisabled() const
  242. {
  243. return TestFlag(Flags_disableSwitchOpt);
  244. }
  245. bool
  246. JITTimeProfileInfo::IsEquivalentObjTypeSpecDisabled() const
  247. {
  248. return TestFlag(Flags_disableEquivalentObjTypeSpec);
  249. }
  250. bool
  251. JITTimeProfileInfo::IsObjTypeSpecDisabledInJitLoopBody() const
  252. {
  253. return TestFlag(Flags_disableObjTypeSpec_jitLoopBody);
  254. }
  255. bool
  256. JITTimeProfileInfo::IsAggressiveMulIntTypeSpecDisabled(const bool isJitLoopBody) const
  257. {
  258. if (isJitLoopBody)
  259. {
  260. return TestFlag(Flags_disableAggressiveMulIntTypeSpec_jitLoopBody);
  261. }
  262. else
  263. {
  264. return TestFlag(Flags_disableAggressiveMulIntTypeSpec);
  265. }
  266. }
  267. bool
  268. JITTimeProfileInfo::IsDivIntTypeSpecDisabled(const bool isJitLoopBody) const
  269. {
  270. if (isJitLoopBody)
  271. {
  272. return TestFlag(Flags_disableDivIntTypeSpec_jitLoopBody);
  273. }
  274. else
  275. {
  276. return TestFlag(Flags_disableDivIntTypeSpec);
  277. }
  278. }
  279. bool
  280. JITTimeProfileInfo::IsLossyIntTypeSpecDisabled() const
  281. {
  282. return TestFlag(Flags_disableLossyIntTypeSpec);
  283. }
  284. bool
  285. JITTimeProfileInfo::IsMemOpDisabled() const
  286. {
  287. return TestFlag(Flags_disableMemOp);
  288. }
  289. bool
  290. JITTimeProfileInfo::IsTrackCompoundedIntOverflowDisabled() const
  291. {
  292. return TestFlag(Flags_disableTrackCompoundedIntOverflow);
  293. }
  294. bool
  295. JITTimeProfileInfo::IsFloatTypeSpecDisabled() const
  296. {
  297. return TestFlag(Flags_disableFloatTypeSpec);
  298. }
  299. bool
  300. JITTimeProfileInfo::IsCheckThisDisabled() const
  301. {
  302. return TestFlag(Flags_disableCheckThis);
  303. }
  304. bool
  305. JITTimeProfileInfo::IsArrayCheckHoistDisabled(const bool isJitLoopBody) const
  306. {
  307. if (isJitLoopBody)
  308. {
  309. return TestFlag(Flags_disableArrayCheckHoist_jitLoopBody);
  310. }
  311. else
  312. {
  313. return TestFlag(Flags_disableArrayCheckHoist);
  314. }
  315. }
  316. bool
  317. JITTimeProfileInfo::IsArrayMissingValueCheckHoistDisabled(const bool isJitLoopBody) const
  318. {
  319. if (isJitLoopBody)
  320. {
  321. return TestFlag(Flags_disableArrayMissingValueCheckHoist_jitLoopBody);
  322. }
  323. else
  324. {
  325. return TestFlag(Flags_disableArrayMissingValueCheckHoist);
  326. }
  327. }
  328. bool
  329. JITTimeProfileInfo::IsJsArraySegmentHoistDisabled(const bool isJitLoopBody) const
  330. {
  331. if (isJitLoopBody)
  332. {
  333. return TestFlag(Flags_disableJsArraySegmentHoist_jitLoopBody);
  334. }
  335. else
  336. {
  337. return TestFlag(Flags_disableJsArraySegmentHoist);
  338. }
  339. }
  340. bool
  341. JITTimeProfileInfo::IsArrayLengthHoistDisabled(const bool isJitLoopBody) const
  342. {
  343. if (isJitLoopBody)
  344. {
  345. return TestFlag(Flags_disableArrayLengthHoist_jitLoopBody);
  346. }
  347. else
  348. {
  349. return TestFlag(Flags_disableArrayLengthHoist);
  350. }
  351. }
  352. bool
  353. JITTimeProfileInfo::IsTypedArrayTypeSpecDisabled(const bool isJitLoopBody) const
  354. {
  355. if (isJitLoopBody)
  356. {
  357. return TestFlag(Flags_disableTypedArrayTypeSpec_jitLoopBody);
  358. }
  359. else
  360. {
  361. return TestFlag(Flags_disableTypedArrayTypeSpec);
  362. }
  363. }
  364. bool
  365. JITTimeProfileInfo::IsLdLenIntSpecDisabled() const
  366. {
  367. return TestFlag(Flags_disableLdLenIntSpec);
  368. }
  369. bool
  370. JITTimeProfileInfo::IsBoundCheckHoistDisabled(const bool isJitLoopBody) const
  371. {
  372. if (isJitLoopBody)
  373. {
  374. return TestFlag(Flags_disableBoundCheckHoist_jitLoopBody);
  375. }
  376. else
  377. {
  378. return TestFlag(Flags_disableBoundCheckHoist);
  379. }
  380. }
  381. bool
  382. JITTimeProfileInfo::IsLoopCountBasedBoundCheckHoistDisabled(const bool isJitLoopBody) const
  383. {
  384. if (isJitLoopBody)
  385. {
  386. return TestFlag(Flags_disableLoopCountBasedBoundCheckHoist_jitLoopBody);
  387. }
  388. else
  389. {
  390. return TestFlag(Flags_disableLoopCountBasedBoundCheckHoist);
  391. }
  392. }
  393. bool
  394. JITTimeProfileInfo::IsStackArgOptDisabled() const
  395. {
  396. return TestFlag(Flags_disableStackArgOpt);
  397. }
  398. bool
  399. JITTimeProfileInfo::IsLoopImplicitCallInfoDisabled() const
  400. {
  401. return TestFlag(Flags_disableLoopImplicitCallInfo);
  402. }
  403. bool
  404. JITTimeProfileInfo::IsPowIntIntTypeSpecDisabled() const
  405. {
  406. return TestFlag(Flags_disablePowIntIntTypeSpec);
  407. }
  408. bool
  409. JITTimeProfileInfo::IsFloorInliningDisabled() const
  410. {
  411. return TestFlag(Flags_disableFloorInlining);
  412. }
  413. bool
  414. JITTimeProfileInfo::IsNoProfileBailoutsDisabled() const
  415. {
  416. return TestFlag(Flags_disableNoProfileBailouts);
  417. }
  418. bool
  419. JITTimeProfileInfo::IsTagCheckDisabled() const
  420. {
  421. return TestFlag(Flags_disableTagCheck);
  422. }
  423. bool
  424. JITTimeProfileInfo::IsOptimizeTryFinallyDisabled() const
  425. {
  426. return TestFlag(Flags_disableOptimizeTryFinally);
  427. }
  428. bool
  429. JITTimeProfileInfo::HasLdFldCallSiteInfo() const
  430. {
  431. return TestFlag(Flags_hasLdFldCallSiteInfo);
  432. }
  433. Js::ProfileId
  434. JITTimeProfileInfo::GetProfiledArrayCallSiteCount() const
  435. {
  436. return static_cast<Js::ProfileId>(m_profileData.profiledArrayCallSiteCount);
  437. }
  438. Js::ProfileId
  439. JITTimeProfileInfo::GetProfiledCallSiteCount() const
  440. {
  441. return static_cast<Js::ProfileId>(m_profileData.profiledCallSiteCount);
  442. }
  443. Js::ProfileId
  444. JITTimeProfileInfo::GetProfiledReturnTypeCount() const
  445. {
  446. return static_cast<Js::ProfileId>(m_profileData.profiledReturnTypeCount);
  447. }
  448. Js::ProfileId
  449. JITTimeProfileInfo::GetProfiledDivOrRemCount() const
  450. {
  451. return static_cast<Js::ProfileId>(m_profileData.profiledDivOrRemCount);
  452. }
  453. Js::ProfileId
  454. JITTimeProfileInfo::GetProfiledSwitchCount() const
  455. {
  456. return static_cast<Js::ProfileId>(m_profileData.profiledSwitchCount);
  457. }
  458. Js::ProfileId
  459. JITTimeProfileInfo::GetProfiledSlotCount() const
  460. {
  461. return static_cast<Js::ProfileId>(m_profileData.profiledSlotCount);
  462. }
  463. Js::ArgSlot
  464. JITTimeProfileInfo::GetProfiledInParamsCount() const
  465. {
  466. return static_cast<Js::ArgSlot>(m_profileData.profiledInParamsCount);
  467. }
  468. uint
  469. JITTimeProfileInfo::GetProfiledFldCount() const
  470. {
  471. return m_profileData.inlineCacheCount;
  472. }
  473. uint
  474. JITTimeProfileInfo::GetLoopCount() const
  475. {
  476. return m_profileData.loopCount;
  477. }
  478. Js::CallSiteInfo *
  479. JITTimeProfileInfo::GetCallSiteInfo() const
  480. {
  481. return reinterpret_cast<Js::CallSiteInfo*>(m_profileData.callSiteData);
  482. }
  483. bool
  484. JITTimeProfileInfo::TestFlag(ProfileDataFlags flag) const
  485. {
  486. return (m_profileData.flags & flag) != 0;
  487. }
  488. BVFixed *
  489. JITTimeProfileInfo::GetLoopFlags() const
  490. {
  491. return (BVFixed*)m_profileData.loopFlags;
  492. }