Changeset 240832 in webkit
- Timestamp:
- Jan 31, 2019, 5:37:36 PM (6 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r240823 r240832 1 2019-01-31 Mark Lam <mark.lam@apple.com> 2 3 Remove poisoning from CodeBlock and LLInt code. 4 https://bugs.webkit.org/show_bug.cgi?id=194113 5 6 Reviewed by Yusuke Suzuki. 7 8 * bytecode/CodeBlock.cpp: 9 (JSC::CodeBlock::CodeBlock): 10 (JSC::CodeBlock::~CodeBlock): 11 (JSC::CodeBlock::setConstantRegisters): 12 (JSC::CodeBlock::propagateTransitions): 13 (JSC::CodeBlock::finalizeLLIntInlineCaches): 14 (JSC::CodeBlock::jettison): 15 (JSC::CodeBlock::predictedMachineCodeSize): 16 * bytecode/CodeBlock.h: 17 (JSC::CodeBlock::vm const): 18 (JSC::CodeBlock::addConstant): 19 (JSC::CodeBlock::heap const): 20 (JSC::CodeBlock::replaceConstant): 21 * llint/LLIntOfflineAsmConfig.h: 22 * llint/LLIntSlowPaths.cpp: 23 (JSC::LLInt::handleHostCall): 24 (JSC::LLInt::setUpCall): 25 * llint/LowLevelInterpreter.asm: 26 * llint/LowLevelInterpreter32_64.asm: 27 * llint/LowLevelInterpreter64.asm: 28 1 29 2019-01-31 Yusuke Suzuki <ysuzuki@apple.com> 2 30 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r240329 r240832 306 306 , m_unlinkedCode(*other.vm(), this, other.m_unlinkedCode.get()) 307 307 , m_ownerExecutable(*other.vm(), this, other.m_ownerExecutable.get()) 308 , m_ poisonedVM(other.m_poisonedVM)308 , m_vm(other.m_vm) 309 309 , m_instructions(other.m_instructions) 310 310 , m_instructionsRawPointer(other.m_instructionsRawPointer) … … 372 372 , m_unlinkedCode(*vm, this, unlinkedCodeBlock) 373 373 , m_ownerExecutable(*vm, this, ownerExecutable) 374 , m_ poisonedVM(vm)374 , m_vm(vm) 375 375 , m_instructions(&unlinkedCodeBlock->instructions()) 376 376 , m_instructionsRawPointer(m_instructions->rawPointer()) … … 835 835 CodeBlock::~CodeBlock() 836 836 { 837 VM& vm = *m_ poisonedVM;837 VM& vm = *m_vm; 838 838 839 839 vm.heap.codeBlockSet().remove(this); … … 895 895 void CodeBlock::setConstantRegisters(const Vector<WriteBarrier<Unknown>>& constants, const Vector<SourceCodeRepresentation>& constantsSourceCodeRepresentation) 896 896 { 897 VM& vm = *m_ poisonedVM;897 VM& vm = *m_vm; 898 898 auto scope = DECLARE_THROW_SCOPE(vm); 899 899 JSGlobalObject* globalObject = m_globalObject.get(); … … 1088 1088 UNUSED_PARAM(visitor); 1089 1089 1090 VM& vm = *m_ poisonedVM;1090 VM& vm = *m_vm; 1091 1091 1092 1092 if (jitType() == JITCode::InterpreterThunk) { … … 1204 1204 void CodeBlock::finalizeLLIntInlineCaches() 1205 1205 { 1206 VM& vm = *m_ poisonedVM;1206 VM& vm = *m_vm; 1207 1207 const Vector<InstructionStream::Offset>& propertyAccessInstructions = m_unlinkedCode->propertyAccessInstructions(); 1208 1208 … … 1922 1922 #endif // ENABLE(DFG_JIT) 1923 1923 1924 VM& vm = *m_ poisonedVM;1924 VM& vm = *m_vm; 1925 1925 DeferGCForAWhile deferGC(*heap()); 1926 1926 … … 2763 2763 size_t CodeBlock::predictedMachineCodeSize() 2764 2764 { 2765 VM* vm = m_ poisonedVM.unpoisoned();2766 // This will be called from CodeBlock::CodeBlock before either m_ poisonedVMor the2765 VM* vm = m_vm; 2766 // This will be called from CodeBlock::CodeBlock before either m_vm or the 2767 2767 // instructions have been initialized. It's OK to return 0 because what will really 2768 2768 // matter is the recomputation of this value when the slow path is triggered. -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r240255 r240832 1 1 /* 2 * Copyright (C) 2008-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca> 4 4 * … … 52 52 #include "JITCodeMap.h" 53 53 #include "JITMathICForwards.h" 54 #include "JSCPoison.h"55 54 #include "JSCast.h" 56 55 #include "JSGlobalObject.h" … … 380 379 ExecutableToCodeBlockEdge* ownerEdge() const { return m_ownerEdge.get(); } 381 380 382 VM* vm() const { return m_ poisonedVM.unpoisoned(); }381 VM* vm() const { return m_vm; } 383 382 384 383 void setThisRegister(VirtualRegister thisRegister) { m_thisRegister = thisRegister; } … … 522 521 unsigned result = m_constantRegisters.size(); 523 522 m_constantRegisters.append(WriteBarrier<Unknown>()); 524 m_constantRegisters.last().set(*m_ poisonedVM, this, v);523 m_constantRegisters.last().set(*m_vm, this, v); 525 524 m_constantsSourceCodeRepresentation.append(SourceCodeRepresentation::Other); 526 525 return result; … … 548 547 const BitVector& bitVector(size_t i) { return m_unlinkedCode->bitVector(i); } 549 548 550 Heap* heap() const { return &m_ poisonedVM->heap; }549 Heap* heap() const { return &m_vm->heap; } 551 550 JSGlobalObject* globalObject() { return m_globalObject.get(); } 552 551 … … 898 897 { 899 898 ASSERT(isConstantRegisterIndex(index) && static_cast<size_t>(index - FirstConstantRegisterIndex) < m_constantRegisters.size()); 900 m_constantRegisters[index - FirstConstantRegisterIndex].set(*m_ poisonedVM, this, value);899 m_constantRegisters[index - FirstConstantRegisterIndex].set(*m_vm, this, value); 901 900 } 902 901 … … 946 945 WriteBarrier<ExecutableBase> m_ownerExecutable; 947 946 WriteBarrier<ExecutableToCodeBlockEdge> m_ownerEdge; 948 Poisoned<CodeBlockPoison, VM*> m_poisonedVM;947 VM* m_vm; 949 948 950 949 const InstructionStream* m_instructions; … … 955 954 mutable CodeBlockHash m_hash; 956 955 957 PoisonedRefPtr<CodeBlockPoison,SourceProvider> m_source;956 RefPtr<SourceProvider> m_source; 958 957 unsigned m_sourceOffset; 959 958 unsigned m_firstLineColumnOffset; … … 961 960 SentinelLinkedList<LLIntCallLinkInfo, BasicRawSentinelNode<LLIntCallLinkInfo>> m_incomingLLIntCalls; 962 961 StructureWatchpointMap m_llintGetByIdWatchpointMap; 963 PoisonedRefPtr<CodeBlockPoison,JITCode> m_jitCode;962 RefPtr<JITCode> m_jitCode; 964 963 #if !ENABLE(C_LOOP) 965 964 std::unique_ptr<RegisterAtOffsetList> m_calleeSaveRegisters; 966 965 #endif 967 966 #if ENABLE(JIT) 968 PoisonedBag<CodeBlockPoison,StructureStubInfo> m_stubInfos;969 PoisonedBag<CodeBlockPoison,JITAddIC> m_addICs;970 PoisonedBag<CodeBlockPoison,JITMulIC> m_mulICs;971 PoisonedBag<CodeBlockPoison,JITNegIC> m_negICs;972 PoisonedBag<CodeBlockPoison,JITSubIC> m_subICs;973 PoisonedBag<CodeBlockPoison,ByValInfo> m_byValInfos;974 PoisonedBag<CodeBlockPoison,CallLinkInfo> m_callLinkInfos;967 Bag<StructureStubInfo> m_stubInfos; 968 Bag<JITAddIC> m_addICs; 969 Bag<JITMulIC> m_mulICs; 970 Bag<JITNegIC> m_negICs; 971 Bag<JITSubIC> m_subICs; 972 Bag<ByValInfo> m_byValInfos; 973 Bag<CallLinkInfo> m_callLinkInfos; 975 974 SentinelLinkedList<CallLinkInfo, BasicRawSentinelNode<CallLinkInfo>> m_incomingCalls; 976 975 SentinelLinkedList<PolymorphicCallNode, BasicRawSentinelNode<PolymorphicCallNode>> m_incomingPolymorphicCalls; -
trunk/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
r240684 r240832 1 1 /* 2 * Copyright (C) 2012-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2012-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #include <wtf/Assertions.h> 30 30 #include <wtf/Gigacage.h> 31 #include <wtf/Poisoned.h>32 31 33 32 #if ENABLE(C_LOOP) … … 137 136 #endif 138 137 139 #if ENABLE(POISON)140 #define OFFLINE_ASM_POISON 1141 #else142 #define OFFLINE_ASM_POISON 0143 #endif144 145 138 #if !ASSERT_DISABLED 146 139 #define OFFLINE_ASM_ASSERT_ENABLED 1 -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r240637 r240832 1449 1449 execCallee->setCallee(asObject(callee)); 1450 1450 vm.hostCallReturnValue = JSValue::decode(callData.native.function(execCallee)); 1451 1452 PoisonedMasmPtr::assertIsNotPoisoned(LLInt::getCodePtr(getHostCallReturnValue));1453 1451 LLINT_CALL_RETURN(execCallee, execCallee, LLInt::getCodePtr(getHostCallReturnValue), CFunctionPtrTag); 1454 1452 } … … 1471 1469 execCallee->setCallee(asObject(callee)); 1472 1470 vm.hostCallReturnValue = JSValue::decode(constructData.native.function(execCallee)); 1473 1474 PoisonedMasmPtr::assertIsNotPoisoned(LLInt::getCodePtr(getHostCallReturnValue));1475 1471 LLINT_CALL_RETURN(execCallee, execCallee, LLInt::getCodePtr(getHostCallReturnValue), CFunctionPtrTag); 1476 1472 } … … 1509 1505 1510 1506 assertIsTaggedWith(codePtr.executableAddress(), JSEntryPtrTag); 1511 PoisonedMasmPtr::assertIsNotPoisoned(codePtr.executableAddress());1512 1507 LLINT_CALL_RETURN(exec, execCallee, codePtr.executableAddress(), JSEntryPtrTag); 1513 1508 } … … 1560 1555 1561 1556 assertIsTaggedWith(codePtr.executableAddress(), JSEntryPtrTag); 1562 PoisonedMasmPtr::assertIsNotPoisoned(codePtr.executableAddress());1563 1557 LLINT_CALL_RETURN(exec, execCallee, codePtr.executableAddress(), JSEntryPtrTag); 1564 1558 } -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r240432 r240832 842 842 end 843 843 844 macro unpoison(poison, fieldReg, scratch)845 if POISON846 loadp poison, scratch847 xorp scratch, fieldReg848 end849 end850 851 844 macro functionPrologue() 852 845 tagReturnAddress sp … … 1028 1021 end 1029 1022 1030 macro functionForCallCodeBlockGetter(targetRegister , scratch)1023 macro functionForCallCodeBlockGetter(targetRegister) 1031 1024 if JSVALUE64 1032 1025 loadp Callee[cfr], targetRegister … … 1035 1028 end 1036 1029 loadp JSFunction::m_executable[targetRegister], targetRegister 1037 unpoison(_g_JSFunctionPoison, targetRegister, scratch)1038 1030 loadp FunctionExecutable::m_codeBlockForCall[targetRegister], targetRegister 1039 1031 loadp ExecutableToCodeBlockEdge::m_codeBlock[targetRegister], targetRegister 1040 1032 end 1041 1033 1042 macro functionForConstructCodeBlockGetter(targetRegister , scratch)1034 macro functionForConstructCodeBlockGetter(targetRegister) 1043 1035 if JSVALUE64 1044 1036 loadp Callee[cfr], targetRegister … … 1047 1039 end 1048 1040 loadp JSFunction::m_executable[targetRegister], targetRegister 1049 unpoison(_g_JSFunctionPoison, targetRegister, scratch)1050 1041 loadp FunctionExecutable::m_codeBlockForConstruct[targetRegister], targetRegister 1051 1042 loadp ExecutableToCodeBlockEdge::m_codeBlock[targetRegister], targetRegister 1052 1043 end 1053 1044 1054 macro notFunctionCodeBlockGetter(targetRegister , ignored)1045 macro notFunctionCodeBlockGetter(targetRegister) 1055 1046 loadp CodeBlock[cfr], targetRegister 1056 1047 end … … 1076 1067 addp maxFrameExtentForSlowPathCall, sp 1077 1068 end 1078 codeBlockGetter(t1 , t2)1069 codeBlockGetter(t1) 1079 1070 if not C_LOOP 1080 1071 baddis 5, CodeBlock::m_llintExecuteCounter + BaselineExecutionCounter::m_counter[t1], .continue … … 1106 1097 jmp r0, JSEntryPtrTag 1107 1098 .recover: 1108 codeBlockGetter(t1 , t2)1099 codeBlockGetter(t1) 1109 1100 .continue: 1110 1101 end … … 1117 1108 if JSVALUE64 1118 1109 loadp CodeBlock::m_instructionsRawPointer[t1], PB 1119 unpoison(_g_CodeBlockPoison, PB, t3)1120 1110 move 0, PC 1121 1111 else … … 1127 1117 subp cfr, t0, t0 1128 1118 bpa t0, cfr, .needStackCheck 1129 loadp CodeBlock::m_poisonedVM[t1], t2 1130 unpoison(_g_CodeBlockPoison, t2, t3) 1119 loadp CodeBlock::m_vm[t1], t2 1131 1120 if C_LOOP 1132 1121 bpbeq VM::m_cloopStackLimit[t2], t0, .stackHeightOK … … 1153 1142 # Stack check slow path returned that the stack was ok. 1154 1143 # Since they were clobbered, need to get CodeBlock and new sp 1155 codeBlockGetter(t1 , t2)1144 codeBlockGetter(t1) 1156 1145 getFrameRegisterSizeForCodeBlock(t1, t0) 1157 1146 subp cfr, t0, t0 … … 1641 1630 llintOp(op_check_traps, OpCheckTraps, macro (unused, unused, dispatch) 1642 1631 loadp CodeBlock[cfr], t1 1643 loadp CodeBlock::m_poisonedVM[t1], t1 1644 unpoison(_g_CodeBlockPoison, t1, t2) 1632 loadp CodeBlock::m_vm[t1], t1 1645 1633 loadb VM::m_traps+VMTraps::m_needTrapHandling[t1], t0 1646 1634 btpnz t0, .handleTraps … … 1658 1646 macro acquireShadowChickenPacket(slow) 1659 1647 loadp CodeBlock[cfr], t1 1660 loadp CodeBlock::m_poisonedVM[t1], t1 1661 unpoison(_g_CodeBlockPoison, t1, t2) 1648 loadp CodeBlock::m_vm[t1], t1 1662 1649 loadp VM::m_shadowChicken[t1], t2 1663 1650 loadp ShadowChicken::m_logCursor[t2], t0 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r240254 r240832 2412 2412 llintOpWithMetadata(op_profile_type, OpProfileType, macro (size, get, dispatch, metadata, return) 2413 2413 loadp CodeBlock[cfr], t1 2414 loadp CodeBlock::m_poisonedVM[t1], t1 2415 unpoison(_g_CodeBlockPoison, t1, t2) 2414 loadp CodeBlock::m_vm[t1], t1 2416 2415 # t1 is holding the pointer to the typeProfilerLog. 2417 2416 loadp VM::m_typeProfilerLog[t1], t1 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r240254 r240832 81 81 loadp CodeBlock[cfr], PB 82 82 loadp CodeBlock::m_instructionsRawPointer[PB], PB 83 unpoison(_g_CodeBlockPoison, PB, t1)84 83 get(size, opcodeStruct, m_dst, t1) 85 84 storeq r0, [cfr, t1, 8] … … 532 531 end 533 532 534 macro structureIDToStructureWithScratch(structureIDThenStructure, scratch , scratch2)533 macro structureIDToStructureWithScratch(structureIDThenStructure, scratch) 535 534 loadp CodeBlock[cfr], scratch 536 loadp CodeBlock::m_poisonedVM[scratch], scratch 537 unpoison(_g_CodeBlockPoison, scratch, scratch2) 535 loadp CodeBlock::m_vm[scratch], scratch 538 536 loadp VM::heap + Heap::m_structureIDTable + StructureIDTable::m_table[scratch], scratch 539 537 loadp [scratch, structureIDThenStructure, PtrSize], structureIDThenStructure 540 538 end 541 539 542 macro loadStructureWithScratch(cell, structure, scratch , scratch2)540 macro loadStructureWithScratch(cell, structure, scratch) 543 541 loadi JSCell::m_structureID[cell], structure 544 structureIDToStructureWithScratch(structure, scratch , scratch2)542 structureIDToStructureWithScratch(structure, scratch) 545 543 end 546 544 … … 630 628 loadp CodeBlock[cfr], t1 631 629 loadp CodeBlock::m_instructionsRawPointer[t1], PB 632 unpoison(_g_CodeBlockPoison, PB, t2)633 630 move 0, PC 634 631 jmp doneLabel … … 698 695 btqnz t0, tagMask, .opToThisSlow 699 696 bbneq JSCell::m_type[t0], FinalObjectType, .opToThisSlow 700 loadStructureWithScratch(t0, t1, t2 , t3)697 loadStructureWithScratch(t0, t1, t2) 701 698 metadata(t2, t3) 702 699 loadp OpToThis::Metadata::m_cachedStructure[t2], t2 … … 768 765 jmp .done 769 766 .masqueradesAsUndefined: 770 loadStructureWithScratch(t0, t2, t1 , t3)767 loadStructureWithScratch(t0, t2, t1) 771 768 loadp CodeBlock[cfr], t0 772 769 loadp CodeBlock::m_globalObject[t0], t0 … … 1186 1183 return(t1) 1187 1184 .masqueradesAsUndefined: 1188 loadStructureWithScratch(t0, t3, t1 , t5)1185 loadStructureWithScratch(t0, t3, t1) 1189 1186 loadp CodeBlock[cfr], t1 1190 1187 loadp CodeBlock::m_globalObject[t1], t1 … … 1357 1354 btpz t3, .opPutByIdTransitionDirect 1358 1355 1359 structureIDToStructureWithScratch(t2, t1 , t3)1356 structureIDToStructureWithScratch(t2, t1) 1360 1357 1361 1358 # reload the StructureChain since we used t3 as a scratch above … … 1695 1692 loadq [cfr, t0, 8], t0 1696 1693 btqnz t0, tagMask, .immediate 1697 loadStructureWithScratch(t0, t2, t1 , t3)1694 loadStructureWithScratch(t0, t2, t1) 1698 1695 cellHandler(t2, JSCell::m_flags[t0], .target) 1699 1696 dispatch() … … 1935 1932 storei t2, ArgumentCount + PayloadOffset[t3] 1936 1933 move t3, sp 1937 if POISON 1938 loadp _g_JITCodePoison, t2 1939 xorp %opcodeStruct%::Metadata::m_callLinkInfo.machineCodeTarget[t5], t2 1940 prepareCall(t2, t1, t3, t4, JSEntryPtrTag) 1941 callTargetFunction(size, opcodeStruct, dispatch, t2, JSEntryPtrTag) 1942 else 1943 prepareCall(%opcodeStruct%::Metadata::m_callLinkInfo.machineCodeTarget[t5], t2, t3, t4, JSEntryPtrTag) 1944 callTargetFunction(size, opcodeStruct, dispatch, %opcodeStruct%::Metadata::m_callLinkInfo.machineCodeTarget[t5], JSEntryPtrTag) 1945 end 1934 prepareCall(%opcodeStruct%::Metadata::m_callLinkInfo.machineCodeTarget[t5], t2, t3, t4, JSEntryPtrTag) 1935 callTargetFunction(size, opcodeStruct, dispatch, %opcodeStruct%::Metadata::m_callLinkInfo.machineCodeTarget[t5], JSEntryPtrTag) 1946 1936 1947 1937 .opCallSlow: … … 1989 1979 loadp CodeBlock::m_metadata[PB], metadataTable 1990 1980 loadp CodeBlock::m_instructionsRawPointer[PB], PB 1991 unpoison(_g_CodeBlockPoison, PB, t2)1992 1981 loadp VM::targetInterpreterPCForThrow[t3], PC 1993 1982 subp PB, PC … … 2066 2055 loadp Callee[cfr], t1 2067 2056 loadp JSFunction::m_executable[t1], t1 2068 unpoison(_g_JSFunctionPoison, t1, t2)2069 2057 checkStackPointerAlignment(t3, 0xdead0001) 2070 2058 if C_LOOP 2071 loadp _g_NativeCodePoison, t2 2072 xorp executableOffsetToFunction[t1], t2 2073 cloopCallNative t2 2059 cloopCallNative executableOffsetToFunction[t1] 2074 2060 else 2075 2061 if X86_64_WIN … … 2078 2064 addp 32, sp 2079 2065 else 2080 loadp _g_NativeCodePoison, t2 2081 xorp executableOffsetToFunction[t1], t2 2082 call t2, JSEntryPtrTag 2066 call executableOffsetToFunction[t1], JSEntryPtrTag 2083 2067 end 2084 2068 end … … 2112 2096 checkStackPointerAlignment(t3, 0xdead0001) 2113 2097 if C_LOOP 2114 loadp _g_NativeCodePoison, t2 2115 xorp offsetOfFunction[t1], t2 2116 cloopCallNative t2 2098 cloopCallNative offsetOfFunction[t1] 2117 2099 else 2118 2100 if X86_64_WIN … … 2121 2103 addp 32, sp 2122 2104 else 2123 loadp _g_NativeCodePoison, t2 2124 xorp offsetOfFunction[t1], t2 2125 call t2, JSEntryPtrTag 2105 call offsetOfFunction[t1], JSEntryPtrTag 2126 2106 end 2127 2107 end … … 2235 2215 get(m_scope, t0) 2236 2216 loadq [cfr, t0, 8], t0 2237 loadStructureWithScratch(t0, t2, t1 , t3)2217 loadStructureWithScratch(t0, t2, t1) 2238 2218 loadp %opcodeStruct%::Metadata::m_structure[t5], t1 2239 2219 bpneq t2, t1, slowPath … … 2472 2452 llintOpWithMetadata(op_profile_type, OpProfileType, macro (size, get, dispatch, metadata, return) 2473 2453 loadp CodeBlock[cfr], t1 2474 loadp CodeBlock::m_poisonedVM[t1], t1 2475 unpoison(_g_CodeBlockPoison, t1, t3) 2454 loadp CodeBlock::m_vm[t1], t1 2476 2455 # t1 is holding the pointer to the typeProfilerLog. 2477 2456 loadp VM::m_typeProfilerLog[t1], t1
Note:
See TracChangeset
for help on using the changeset viewer.