Changeset 294017 in webkit for trunk/Source/JavaScriptCore/tools/IntegrityInlines.h
- Timestamp:
- May 10, 2022, 2:55:45 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/tools/IntegrityInlines.h
r293746 r294017 1 1 /* 2 * Copyright (C) 2019-202 0Apple Inc. All rights reserved.2 * Copyright (C) 2019-2022 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 28 28 #include "Integrity.h" 29 #include "JSCJSValue.h" 30 #include "StructureID.h" 29 31 #include "VM.h" 32 #include "VMInspector.h" 33 #include <wtf/Atomics.h> 34 #include <wtf/Gigacage.h> 30 35 31 36 namespace JSC { … … 62 67 } 63 68 69 template<AuditLevel auditLevel> 70 ALWAYS_INLINE void auditCell(VM& vm, JSValue value) 71 { 72 if constexpr (auditLevel == AuditLevel::None) 73 return; 74 75 if (value.isCell()) 76 auditCell<auditLevel>(vm, value.asCell()); 77 } 78 64 79 ALWAYS_INLINE void auditCellMinimally(VM& vm, JSCell* cell) 65 80 { … … 74 89 } 75 90 91 ALWAYS_INLINE void auditCellFully(VM& vm, JSCell* cell) 92 { 93 #if USE(JSVALUE64) 94 doAudit(vm, cell); 95 #else 96 auditCellMinimally(vm, cell); 97 #endif 98 } 76 99 77 100 ALWAYS_INLINE void auditStructureID(StructureID structureID) … … 81 104 ASSERT(static_cast<uintptr_t>(structureID.bits()) <= structureHeapAddressSize + StructureID::nukedStructureIDBit); 82 105 #endif 106 #if ENABLE(EXTRA_INTEGRITY_CHECKS) || ASSERT_ENABLED 107 Structure* structure = structureID.tryDecode(); 108 IA_ASSERT(structure, "structureID.bits 0x%x", structureID.bits()); 109 // structure should be pointing to readable memory. Force a read. 110 WTF::opaque(*bitwise_cast<uintptr_t*>(structure)); 111 #endif 83 112 } 113 114 #if USE(JSVALUE64) 115 116 JS_EXPORT_PRIVATE VM* doAuditSlow(VM*); 117 118 ALWAYS_INLINE VM* doAudit(VM* vm) 119 { 120 if (UNLIKELY(!VMInspector::isValidVM(vm))) 121 return doAuditSlow(vm); 122 return vm; 123 } 124 125 #endif // USE(JSVALUE64) 84 126 85 127 } // namespace Integrity
Note:
See TracChangeset
for help on using the changeset viewer.