Changeset 229481 in webkit
- Timestamp:
- Mar 9, 2018 1:35:17 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r229447 r229481 839 839 runtime/Options.h 840 840 runtime/ParseInt.h 841 runtime/PtrTag.h 841 842 runtime/PrivateName.h 842 843 runtime/ProgramExecutable.h -
trunk/Source/JavaScriptCore/ChangeLog
r229478 r229481 1 2018-03-09 Mark Lam <mark.lam@apple.com> 2 3 [Re-landing] Prepare LLInt code to support pointer profiling. 4 https://bugs.webkit.org/show_bug.cgi?id=183387 5 <rdar://problem/38199678> 6 7 Reviewed by JF Bastien. 8 9 1. Introduced PtrTag enums for supporting pointer profiling later. 10 11 2. Also introduced tagging, untagging, retagging, and tag removal placeholder 12 template functions for the same purpose. 13 14 3. Prepare the offlineasm for supporting pointer profiling later. 15 16 4. Tagged some pointers in LLInt asm code. Currently, these should have no 17 effect on behavior. 18 19 5. Removed returnToThrowForThrownException() because it is not used anywhere. 20 21 6. Added the offlineasm folder to JavaScriptCore Xcode project so that it's 22 easier to view and edit these files in Xcode. 23 24 * CMakeLists.txt: 25 * JavaScriptCore.xcodeproj/project.pbxproj: 26 * bytecode/LLIntCallLinkInfo.h: 27 (JSC::LLIntCallLinkInfo::unlink): 28 * llint/LLIntData.cpp: 29 (JSC::LLInt::initialize): 30 * llint/LLIntData.h: 31 * llint/LLIntExceptions.cpp: 32 (JSC::LLInt::returnToThrowForThrownException): Deleted. 33 * llint/LLIntExceptions.h: 34 * llint/LLIntOfflineAsmConfig.h: 35 * llint/LLIntOffsetsExtractor.cpp: 36 * llint/LLIntPCRanges.h: 37 (JSC::LLInt::isLLIntPC): 38 * llint/LLIntSlowPaths.cpp: 39 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 40 (JSC::LLInt::handleHostCall): 41 (JSC::LLInt::setUpCall): 42 * llint/LowLevelInterpreter.asm: 43 * llint/LowLevelInterpreter32_64.asm: 44 * llint/LowLevelInterpreter64.asm: 45 * offlineasm/ast.rb: 46 * offlineasm/instructions.rb: 47 * offlineasm/risc.rb: 48 * runtime/PtrTag.h: Added. 49 (JSC::uniquePtrTagID): 50 (JSC::ptrTag): 51 (JSC::tagCodePtr): 52 (JSC::untagCodePtr): 53 (JSC::retagCodePtr): 54 (JSC::removeCodePtrTag): 55 1 56 2018-03-09 Mark Lam <mark.lam@apple.com> 2 57 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r229447 r229481 1768 1768 FE6491371D78F01D00A694D4 /* ExceptionScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6491361D78F01300A694D4 /* ExceptionScope.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1769 1769 FE68C6371B90DE040042BCB3 /* MacroAssemblerPrinter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1770 FE6C1E4A20366F0100BDC2B7 /* PtrTag.h in Headers */ = {isa = PBXBuildFile; fileRef = FE9AE1C82032C887002B6934 /* PtrTag.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1770 1771 FE6F56DE1E64EAD600D17801 /* VMTraps.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6F56DD1E64E92000D17801 /* VMTraps.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1771 1772 FE7C41961B97FC4B00F4D598 /* PingPongStackOverflowTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDA50D41B97F442009A3B4F /* PingPongStackOverflowTest.cpp */; }; … … 4706 4707 FE99B2471C24B6D300C82159 /* JITNegGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITNegGenerator.cpp; sourceTree = "<group>"; }; 4707 4708 FE99B2481C24B6D300C82159 /* JITNegGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITNegGenerator.h; sourceTree = "<group>"; }; 4709 FE9AE1C82032C887002B6934 /* PtrTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PtrTag.h; sourceTree = "<group>"; }; 4708 4710 FEA0861E182B7A0400F6D851 /* Breakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Breakpoint.h; sourceTree = "<group>"; }; 4709 4711 FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerPrimitives.h; sourceTree = "<group>"; }; … … 4726 4728 FEF040501AAE662D00BD28B0 /* CompareAndSwapTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CompareAndSwapTest.cpp; path = API/tests/CompareAndSwapTest.cpp; sourceTree = "<group>"; }; 4727 4729 FEF040521AAEC4ED00BD28B0 /* CompareAndSwapTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CompareAndSwapTest.h; path = API/tests/CompareAndSwapTest.h; sourceTree = "<group>"; }; 4730 FEF3475220362B1B00B7C0EF /* parser.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = parser.rb; sourceTree = "<group>"; }; 4731 FEF3475320362B1B00B7C0EF /* risc.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = risc.rb; sourceTree = "<group>"; }; 4732 FEF3475420362B1B00B7C0EF /* self_hash.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = self_hash.rb; sourceTree = "<group>"; }; 4733 FEF3475520362B1C00B7C0EF /* arm.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = arm.rb; sourceTree = "<group>"; }; 4734 FEF3475620362B1C00B7C0EF /* backends.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = backends.rb; sourceTree = "<group>"; }; 4735 FEF3475720362B1D00B7C0EF /* registers.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = registers.rb; sourceTree = "<group>"; }; 4736 FEF3475820362B1D00B7C0EF /* ast.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = ast.rb; sourceTree = "<group>"; }; 4737 FEF3475920362B1D00B7C0EF /* asm.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = asm.rb; sourceTree = "<group>"; }; 4738 FEF3475A20362B1E00B7C0EF /* cloop.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = cloop.rb; sourceTree = "<group>"; }; 4739 FEF3475B20362B1E00B7C0EF /* x86.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = x86.rb; sourceTree = "<group>"; }; 4740 FEF3475C20362B1E00B7C0EF /* mips.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = mips.rb; sourceTree = "<group>"; }; 4741 FEF3475D20362B1F00B7C0EF /* config.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = config.rb; sourceTree = "<group>"; }; 4742 FEF3475E20362B1F00B7C0EF /* instructions.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = instructions.rb; sourceTree = "<group>"; }; 4743 FEF3475F20362B2000B7C0EF /* opt.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = opt.rb; sourceTree = "<group>"; }; 4744 FEF3476020362B2100B7C0EF /* transform.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = transform.rb; sourceTree = "<group>"; }; 4745 FEF3476120362B2100B7C0EF /* offsets.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = offsets.rb; sourceTree = "<group>"; }; 4746 FEF3476220362B2200B7C0EF /* arm64.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = arm64.rb; sourceTree = "<group>"; }; 4747 FEF3476320362B2300B7C0EF /* settings.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = settings.rb; sourceTree = "<group>"; }; 4748 FEF3476420362B2300B7C0EF /* generate_offset_extractor.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = generate_offset_extractor.rb; sourceTree = "<group>"; }; 4728 4749 FEF49AA91EB947FE00653BDB /* MultithreadedMultiVMExecutionTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MultithreadedMultiVMExecutionTest.cpp; path = API/tests/MultithreadedMultiVMExecutionTest.cpp; sourceTree = "<group>"; }; 4729 4750 FEF49AAA1EB947FE00653BDB /* MultithreadedMultiVMExecutionTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MultithreadedMultiVMExecutionTest.h; path = API/tests/MultithreadedMultiVMExecutionTest.h; sourceTree = "<group>"; }; … … 4881 4902 1429D92C0ED22D7000B89619 /* jit */, 4882 4903 0F46809C14BA7F4D00BFE272 /* llint */, 4904 FEF347512036291300B7C0EF /* offlineasm */, 4883 4905 7E39D8370EC3A388003AF11A /* parser */, 4884 4906 034768DFFF38A50411DB9C8B /* Products */, … … 6852 6874 79160DBB1C8E3EC8008C085A /* ProxyRevoke.cpp */, 6853 6875 79160DBC1C8E3EC8008C085A /* ProxyRevoke.h */, 6876 FE9AE1C82032C887002B6934 /* PtrTag.h */, 6854 6877 0F5780A118FE1E98001E72D9 /* PureNaN.h */, 6855 6878 0F0CD4C015F1A6040032F1C0 /* PutDirectIndexMode.h */, … … 8032 8055 sourceTree = "<group>"; 8033 8056 }; 8057 FEF347512036291300B7C0EF /* offlineasm */ = { 8058 isa = PBXGroup; 8059 children = ( 8060 FEF3475520362B1C00B7C0EF /* arm.rb */, 8061 FEF3476220362B2200B7C0EF /* arm64.rb */, 8062 FEF3475920362B1D00B7C0EF /* asm.rb */, 8063 FEF3475820362B1D00B7C0EF /* ast.rb */, 8064 FEF3475620362B1C00B7C0EF /* backends.rb */, 8065 FEF3475A20362B1E00B7C0EF /* cloop.rb */, 8066 FEF3475D20362B1F00B7C0EF /* config.rb */, 8067 FEF3476420362B2300B7C0EF /* generate_offset_extractor.rb */, 8068 FEF3475E20362B1F00B7C0EF /* instructions.rb */, 8069 FEF3475C20362B1E00B7C0EF /* mips.rb */, 8070 FEF3476120362B2100B7C0EF /* offsets.rb */, 8071 FEF3475F20362B2000B7C0EF /* opt.rb */, 8072 FEF3475220362B1B00B7C0EF /* parser.rb */, 8073 FEF3475720362B1D00B7C0EF /* registers.rb */, 8074 FEF3475320362B1B00B7C0EF /* risc.rb */, 8075 FEF3475420362B1B00B7C0EF /* self_hash.rb */, 8076 FEF3476320362B2300B7C0EF /* settings.rb */, 8077 FEF3476020362B2100B7C0EF /* transform.rb */, 8078 FEF3475B20362B1E00B7C0EF /* x86.rb */, 8079 ); 8080 path = offlineasm; 8081 sourceTree = "<group>"; 8082 }; 8034 8083 /* End PBXGroup section */ 8035 8084 … … 8068 8117 0F2C63BC1E63440C00C13839 /* AirBlockInsertionSet.h in Headers */, 8069 8118 0FB3878E1BFBC44D00E3AB1E /* AirBlockWorklist.h in Headers */, 8119 FE6C1E4A20366F0100BDC2B7 /* PtrTag.h in Headers */, 8070 8120 0F79C7CA1E74C93B00EB34D1 /* AirBreakCriticalEdges.h in Headers */, 8071 8121 0F61832A1C45BF070072450B /* AirCCallingConvention.h in Headers */, -
trunk/Source/JavaScriptCore/bytecode/LLIntCallLinkInfo.h
r229447 r229481 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #include "JSFunction.h" 29 29 #include "MacroAssemblerCodeRef.h" 30 #include "PtrTag.h" 30 31 #include <wtf/SentinelLinkedList.h> 31 32 … … 51 52 callee.clear(); 52 53 machineCodeTarget = MacroAssemblerCodePtr(); 54 callPtrTag = NoPtrTag; 53 55 if (isOnList()) 54 56 remove(); … … 58 60 WriteBarrier<JSObject> lastSeenCallee; 59 61 MacroAssemblerCodePtr machineCodeTarget; 62 PtrTag callPtrTag { NoPtrTag }; 60 63 }; 61 64 -
trunk/Source/JavaScriptCore/llint/LLIntData.cpp
r229478 r229481 59 59 llint_entry(&Data::s_opcodeMap); 60 60 61 for (int i = 0; i < NUMBER_OF_BYTECODE_IDS; ++i) { 62 PtrTag tag = (i == op_catch) ? ExceptionHandlerPtrTag : BytecodePtrTag; 63 Data::s_opcodeMap[i] = tagCodePtr(Data::s_opcodeMap[i], tag); 64 } 65 66 if (VM::canUseJIT()) { 67 for (int i = NUMBER_OF_BYTECODE_IDS; i < NUMBER_OF_BYTECODE_IDS + NUMBER_OF_BYTECODE_HELPER_IDS; ++i) 68 Data::s_opcodeMap[i] = tagCodePtr(Data::s_opcodeMap[i], ptrTag(BytecodeHelperPtrTag, i)); 69 } else { 70 static const PtrTag tagsForOpcode[] = { 71 CodeEntryPtrTag, // llint_program_prologue 72 CodeEntryPtrTag, // llint_eval_prologue 73 CodeEntryPtrTag, // llint_module_program_prologue 74 CodeEntryPtrTag, // llint_function_for_call_prologue 75 CodeEntryPtrTag, // llint_function_for_construct_prologue 76 CodeEntryWithArityCheckPtrTag, // llint_function_for_call_arity_check 77 CodeEntryWithArityCheckPtrTag, // llint_function_for_construct_arity_check 78 CodeEntryPtrTag, // llint_generic_return_point 79 BytecodePtrTag, // llint_throw_from_slow_path_trampoline 80 CodeEntryPtrTag, // llint_throw_during_call_trampoline 81 NativeCodePtrTag, // llint_native_call_trampoline 82 NativeCodePtrTag, // llint_native_construct_trampoline 83 InternalFunctionPtrTag, // llint_internal_function_call_trampoline 84 InternalFunctionPtrTag, // llint_internal_function_construct_trampoline 85 ExceptionHandlerPtrTag, // handleUncaughtException 86 }; 87 88 static_assert(sizeof(tagsForOpcode) / sizeof(tagsForOpcode[0]) == NUMBER_OF_BYTECODE_HELPER_IDS, ""); 89 static_assert(static_cast<uintptr_t>(llint_program_prologue) == NUMBER_OF_BYTECODE_IDS, ""); 90 91 for (int i = 0; i < NUMBER_OF_BYTECODE_HELPER_IDS; ++i) { 92 int opcodeID = i + NUMBER_OF_BYTECODE_IDS; 93 Data::s_opcodeMap[opcodeID] = tagCodePtr(Data::s_opcodeMap[opcodeID], tagsForOpcode[i]); 94 } 95 } 96 97 void* handler = LLInt::getCodePtr(llint_throw_from_slow_path_trampoline); 61 98 for (int i = 0; i < maxOpcodeLength + 1; ++i) 62 Data::s_exceptionInstructions[i].u.pointer = 63 LLInt::getCodePtr(llint_throw_from_slow_path_trampoline); 99 Data::s_exceptionInstructions[i].u.pointer = handler; 100 64 101 #endif // ENABLE(JIT) 65 102 } -
trunk/Source/JavaScriptCore/llint/LLIntData.h
r229478 r229481 28 28 #include "JSCJSValue.h" 29 29 #include "Opcode.h" 30 #include <wtf/PointerPreparations.h>30 #include "PtrTag.h" 31 31 32 32 namespace JSC { -
trunk/Source/JavaScriptCore/llint/LLIntExceptions.cpp
r229447 r229481 1 1 /* 2 * Copyright (C) 2011 , 2016Apple Inc. All rights reserved.2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 40 40 namespace JSC { namespace LLInt { 41 41 42 Instruction* returnToThrowForThrownException(ExecState* exec)43 {44 UNUSED_PARAM(exec);45 return LLInt::exceptionInstructions();46 }47 48 42 Instruction* returnToThrow(ExecState* exec) 49 43 { -
trunk/Source/JavaScriptCore/llint/LLIntExceptions.h
r229447 r229481 1 1 /* 2 * Copyright (C) 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 35 35 namespace LLInt { 36 36 37 // Tells you where to jump to if you want to return-to-throw, after you've already38 // set up all information needed to throw the exception.39 Instruction* returnToThrowForThrownException(ExecState*);40 41 37 // Gives you a PC that you can tell the interpreter to go to, which when advanced 42 38 // between 1 and 9 slots will give you an "instruction" that threads to the -
trunk/Source/JavaScriptCore/llint/LLIntOfflineAsmConfig.h
r229478 r229481 168 168 #endif 169 169 170 #if USE(POINTER_PROFILING) 171 #define OFFLINE_ASM_POINTER_PROFILING 1 172 #else 173 #define OFFLINE_ASM_POINTER_PROFILING 0 174 #endif 175 170 176 #define OFFLINE_ASM_GIGACAGE_ENABLED GIGACAGE_ENABLED -
trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp
r229447 r229481 1 1 /* 2 * Copyright (C) 2012 , 2015-2016Apple Inc. All rights reserved.2 * Copyright (C) 2012-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 52 52 #include "NativeExecutable.h" 53 53 #include "ProtoCallFrame.h" 54 #include "PtrTag.h" 54 55 #include "ShadowChicken.h" 55 56 #include "Structure.h" -
trunk/Source/JavaScriptCore/llint/LLIntPCRanges.h
r229447 r229481 26 26 #pragma once 27 27 28 #include <wtf/PointerPreparations.h>28 #include "PtrTag.h" 29 29 30 30 namespace JSC { … … 41 41 { 42 42 uintptr_t pcAsInt = bitwise_cast<uintptr_t>(pc); 43 uintptr_t llintStart = bitwise_cast<uintptr_t>(WTF_PREPARE_FUNCTION_POINTER_FOR_EXECUTION(llintPCRangeStart));44 uintptr_t llintEnd = bitwise_cast<uintptr_t>(WTF_PREPARE_FUNCTION_POINTER_FOR_EXECUTION(llintPCRangeEnd));43 uintptr_t llintStart = untagCodePtr<uintptr_t>(llintPCRangeStart, CFunctionPtrTag); 44 uintptr_t llintEnd = untagCodePtr<uintptr_t>(llintPCRangeEnd, CFunctionPtrTag); 45 45 RELEASE_ASSERT(llintStart < llintEnd); 46 46 return llintStart <= pcAsInt && pcAsInt <= llintEnd; -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r229478 r229481 1 1 /* 2 * Copyright (C) 2011-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 160 160 } while (false) 161 161 162 #define LLINT_CALL_END_IMPL(exec, callTarget) LLINT_RETURN_TWO((callTarget), (exec)) 162 #define LLINT_CALL_END_IMPL(exec, callTarget, callTargetTag) \ 163 LLINT_RETURN_TWO(retagCodePtr((callTarget), callTargetTag, SlowPathPtrTag), (exec)) 163 164 164 165 #define LLINT_CALL_THROW(exec, exceptionToThrow) do { \ 165 166 ExecState* __ct_exec = (exec); \ 166 167 throwException(__ct_exec, throwScope, exceptionToThrow); \ 167 LLINT_CALL_END_IMPL(0, callToThrow(__ct_exec) ); \168 LLINT_CALL_END_IMPL(0, callToThrow(__ct_exec), ExceptionHandlerPtrTag); \ 168 169 } while (false) 169 170 … … 173 174 doExceptionFuzzingIfEnabled(__cce_exec, throwScope, "LLIntSlowPaths/call", nullptr); \ 174 175 if (UNLIKELY(throwScope.exception())) \ 175 LLINT_CALL_END_IMPL(0, callToThrow(__cce_execCallee) );\176 LLINT_CALL_END_IMPL(0, callToThrow(__cce_execCallee), ExceptionHandlerPtrTag); \ 176 177 } while (false) 177 178 178 #define LLINT_CALL_RETURN(exec, execCallee, callTarget ) do {\179 #define LLINT_CALL_RETURN(exec, execCallee, callTarget, callTargetTag) do { \ 179 180 ExecState* __cr_exec = (exec); \ 180 181 ExecState* __cr_execCallee = (execCallee); \ 181 182 void* __cr_callTarget = (callTarget); \ 182 183 LLINT_CALL_CHECK_EXCEPTION(__cr_exec, __cr_execCallee); \ 183 LLINT_CALL_END_IMPL(__cr_execCallee, __cr_callTarget );\184 LLINT_CALL_END_IMPL(__cr_execCallee, __cr_callTarget, callTargetTag); \ 184 185 } while (false) 185 186 … … 284 285 if (opcodeID == op_enter) { 285 286 dataLogF("Frame will eventually return to %p\n", exec->returnPC().value()); 286 * bitwise_cast<volatile char*>(exec->returnPC().value());287 *removeCodePtrTag<volatile char*>(exec->returnPC().value()); 287 288 } 288 289 if (opcodeID == op_ret) { … … 1326 1327 1327 1328 PoisonedMasmPtr::assertIsNotPoisoned(LLInt::getCodePtr(getHostCallReturnValue)); 1328 LLINT_CALL_RETURN(execCallee, execCallee, LLInt::getCodePtr(getHostCallReturnValue) );1329 LLINT_CALL_RETURN(execCallee, execCallee, LLInt::getCodePtr(getHostCallReturnValue), CFunctionPtrTag); 1329 1330 } 1330 1331 … … 1350 1351 1351 1352 PoisonedMasmPtr::assertIsNotPoisoned(LLInt::getCodePtr(getHostCallReturnValue)); 1352 LLINT_CALL_RETURN(execCallee, execCallee, LLInt::getCodePtr(getHostCallReturnValue) );1353 LLINT_CALL_RETURN(execCallee, execCallee, LLInt::getCodePtr(getHostCallReturnValue), CFunctionPtrTag); 1353 1354 } 1354 1355 … … 1387 1388 callLinkInfo->lastSeenCallee.set(vm, callerCodeBlock, internalFunction); 1388 1389 callLinkInfo->machineCodeTarget = codePtr; 1390 callLinkInfo->callPtrTag = InternalFunctionPtrTag; 1389 1391 } 1390 1392 1391 1393 PoisonedMasmPtr::assertIsNotPoisoned(codePtr.executableAddress()); 1392 LLINT_CALL_RETURN(exec, execCallee, codePtr.executableAddress() );1394 LLINT_CALL_RETURN(exec, execCallee, codePtr.executableAddress(), InternalFunctionPtrTag); 1393 1395 } 1394 1396 throwScope.release(); … … 1399 1401 ExecutableBase* executable = callee->executable(); 1400 1402 1403 PtrTag callPtrTag = NoPtrTag; 1401 1404 MacroAssemblerCodePtr codePtr; 1402 1405 CodeBlock* codeBlock = 0; 1403 1406 if (executable->isHostFunction()) { 1404 1407 codePtr = executable->entrypointFor(kind, MustCheckArity); 1408 callPtrTag = NativeCodePtrTag; 1405 1409 } else { 1406 1410 FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable); … … 1417 1421 ASSERT(codeBlock); 1418 1422 ArityCheckMode arity; 1419 if (execCallee->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters())) 1423 if (execCallee->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters())) { 1420 1424 arity = MustCheckArity; 1421 else 1425 callPtrTag = CodeEntryWithArityCheckPtrTag; 1426 } else { 1422 1427 arity = ArityCheckNotRequired; 1428 callPtrTag = CodeEntryPtrTag; 1429 } 1423 1430 codePtr = functionExecutable->entrypointFor(kind, arity); 1424 1431 } … … 1436 1443 callLinkInfo->lastSeenCallee.set(vm, callerCodeBlock, callee); 1437 1444 callLinkInfo->machineCodeTarget = codePtr; 1445 RELEASE_ASSERT(callPtrTag != NoPtrTag); 1446 callLinkInfo->callPtrTag = callPtrTag; 1438 1447 if (codeBlock) 1439 1448 codeBlock->linkIncomingCall(exec, callLinkInfo); … … 1441 1450 1442 1451 PoisonedMasmPtr::assertIsNotPoisoned(codePtr.executableAddress()); 1443 LLINT_CALL_RETURN(exec, execCallee, codePtr.executableAddress() );1452 LLINT_CALL_RETURN(exec, execCallee, codePtr.executableAddress(), callPtrTag); 1444 1453 } 1445 1454 … … 1581 1590 1582 1591 vm.hostCallReturnValue = eval(execCallee); 1583 LLINT_CALL_RETURN(exec, execCallee, LLInt::getCodePtr(getHostCallReturnValue) );1592 LLINT_CALL_RETURN(exec, execCallee, LLInt::getCodePtr(getHostCallReturnValue), CFunctionPtrTag); 1584 1593 } 1585 1594 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r229478 r229481 260 260 const ArithProfileNumberNumber = 0x900000 261 261 const ArithProfileIntNumber = 0x500000 262 263 # Pointer Tags 264 const BytecodePtrTag = constexpr BytecodePtrTag 265 const CodeEntryPtrTag = constexpr CodeEntryPtrTag 266 const CodeEntryWithArityCheckPtrTag = constexpr CodeEntryWithArityCheckPtrTag 267 const ExceptionHandlerPtrTag = constexpr ExceptionHandlerPtrTag 268 const InternalFunctionPtrTag = constexpr InternalFunctionPtrTag 269 const NativeCodePtrTag = constexpr NativeCodePtrTag 270 const NoPtrTag = constexpr NoPtrTag 271 const SlowPathPtrTag = constexpr SlowPathPtrTag 262 272 263 273 # Some register conventions. … … 786 796 787 797 macro functionPrologue() 798 tagReturnAddress sp 788 799 if X86 or X86_WIN or X86_64 or X86_64_WIN 789 800 push cfr … … 835 846 end 836 847 837 macro callTargetFunction(callee )848 macro callTargetFunction(callee, callPtrTag) 838 849 if C_LOOP 839 850 cloopCallJSFunction callee 840 851 else 841 call callee 852 call callee, callPtrTag 842 853 end 843 854 restoreStackPointerAfterCall() … … 845 856 end 846 857 847 macro prepareForRegularCall(callee, temp1, temp2, temp3 )858 macro prepareForRegularCall(callee, temp1, temp2, temp3, prepareCallPtrTag) 848 859 addp CallerFrameAndPCSize, sp 849 860 end 850 861 851 862 # sp points to the new frame 852 macro prepareForTailCall(callee, temp1, temp2, temp3 )863 macro prepareForTailCall(callee, temp1, temp2, temp3, prepareCallPtrTag) 853 864 restoreCalleeSavesUsedByLLInt() 854 865 … … 885 896 end 886 897 898 if POINTER_PROFILING 899 addp 16, cfr, temp3 900 untagReturnAddress temp3 901 end 902 887 903 subp temp2, temp1 888 904 loadp [cfr], cfr … … 894 910 btinz temp2, .copyLoop 895 911 912 prepareCallPtrTag(temp2) 896 913 move temp1, sp 897 jmp callee 914 jmp callee, temp2 898 915 end 899 916 … … 905 922 btpz calleeFramePtr, .dontUpdateSP 906 923 move calleeFramePtr, sp 907 prepareCall(callee, t2, t3, t4) 924 prepareCall(callee, t2, t3, t4, macro (callPtrTagReg) 925 if POINTER_PROFILING 926 move SlowPathPtrTag, callPtrTagReg 927 end 928 end) 908 929 .dontUpdateSP: 909 callTargetFunction(callee )930 callTargetFunction(callee, SlowPathPtrTag) 910 931 end) 911 932 end … … 989 1010 macro prologue(codeBlockGetter, codeBlockSetter, osrSlowPath, traceSlowPath) 990 1011 # Set up the call frame and check if we should OSR. 1012 tagReturnAddress sp 991 1013 preserveCallerPCAndCFR() 992 1014 … … 1023 1045 pop cfr 1024 1046 end 1025 jmp r0 1047 jmp r0, CodeEntryPtrTag 1026 1048 .recover: 1027 1049 codeBlockGetter(t1, t2) … … 1141 1163 _vmEntryToJavaScript: 1142 1164 end 1143 doVMEntry(makeJavaScriptCall )1165 doVMEntry(makeJavaScriptCall, CodeEntryPtrTag, CodeEntryWithArityCheckPtrTag) 1144 1166 1145 1167 … … 1150 1172 _vmEntryToNative: 1151 1173 end 1152 doVMEntry(makeHostFunctionCall )1174 doVMEntry(makeHostFunctionCall, NativeCodePtrTag, NativeCodePtrTag) 1153 1175 1154 1176 … … 1157 1179 global _sanitizeStackForVMImpl 1158 1180 _sanitizeStackForVMImpl: 1181 tagReturnAddress sp 1159 1182 # We need three non-aliased caller-save registers. We are guaranteed 1160 1183 # this for a0, a1 and a2 on all architectures. … … 1174 1197 addp PtrSize, address 1175 1198 bpa sp, address, .zeroFillLoop 1176 1199 1177 1200 .zeroFillDone: 1178 1201 move sp, address … … 1183 1206 global _vmEntryRecord 1184 1207 _vmEntryRecord: 1208 tagReturnAddress sp 1185 1209 if X86 or X86_WIN 1186 1210 loadp 4[sp], a0 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r229478 r229481 97 97 end 98 98 99 macro doVMEntry(makeCall )99 macro doVMEntry(makeCall, unused1, unused2) 100 100 functionPrologue() 101 101 pushCalleeSaves() … … 1958 1958 storei CellTag, Callee + TagOffset[t3] 1959 1959 move t3, sp 1960 prepareCall(LLIntCallLinkInfo::machineCodeTarget[t1], t2, t3, t4 )1961 callTargetFunction(LLIntCallLinkInfo::machineCodeTarget[t1] )1960 prepareCall(LLIntCallLinkInfo::machineCodeTarget[t1], t2, t3, t4, macro (callPtrTag) end) 1961 callTargetFunction(LLIntCallLinkInfo::machineCodeTarget[t1], NoPtrTag) 1962 1962 1963 1963 .opCallSlow: -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r229478 r229481 25 25 # Utilities. 26 26 macro jumpToInstruction() 27 jmp [PB, PC, 8] 27 jmp [PB, PC, 8], BytecodePtrTag 28 28 end 29 29 … … 93 93 subp 32, sp 94 94 call function 95 addp 32, sp 95 addp 32, sp 96 96 else 97 97 cCall2(function) … … 116 116 end 117 117 118 macro doVMEntry(makeCall )118 macro doVMEntry(makeCall, callTag, callWithArityCheckTag) 119 119 functionPrologue() 120 120 pushCalleeSaves() … … 226 226 checkStackPointerAlignment(extraTempReg, 0xbad0dc02) 227 227 228 makeCall(entry, t3) 228 if POINTER_PROFILING 229 btbnz ProtoCallFrame::hasArityMismatch[protoCallFrame], .doCallWithArityCheck 230 move callTag, t2 231 jmp .readyToCall 232 .doCallWithArityCheck: 233 move callWithArityCheckTag, t2 234 .readyToCall: 235 end 236 237 makeCall(entry, t3, t2) 229 238 230 239 # We may have just made a call into a JS function, so we can't rely on sp … … 250 259 251 260 252 macro makeJavaScriptCall(entry, temp )261 macro makeJavaScriptCall(entry, temp, callTag) 253 262 addp 16, sp 254 263 if C_LOOP 255 264 cloopCallJSFunction entry 256 265 else 257 call entry 266 call entry, callTag 258 267 end 259 268 subp 16, sp … … 261 270 262 271 263 macro makeHostFunctionCall(entry, temp )272 macro makeHostFunctionCall(entry, temp, callTag) 264 273 move entry, temp 265 274 storep cfr, [sp] … … 271 280 # We need to allocate 32 bytes on the stack for the shadow space. 272 281 subp 32, sp 273 call temp 282 call temp, callTag 274 283 addp 32, sp 275 284 else 276 call temp 285 call temp, callTag 277 286 end 278 287 end … … 371 380 btpz r0, .recover 372 381 move r1, sp 373 jmp r0 382 jmp r0, CodeEntryPtrTag 374 383 .recover: 375 384 loadi ArgumentCount + TagOffset[cfr], PC … … 544 553 545 554 .noExtraSlot: 555 if POINTER_PROFILING 556 if ARM64 557 loadp 8[cfr], lr 558 end 559 560 addp 16, cfr, t3 561 untagReturnAddress t3 562 end 563 546 564 // Move frame up t1 slots 547 565 negq t1 … … 566 584 addp 8, t3 567 585 baddinz 1, t2, .fillLoop 586 587 if POINTER_PROFILING 588 addp 16, cfr, t1 589 tagReturnAddress t1 590 591 if ARM64 592 storep lr, 8[cfr] 593 end 594 end 568 595 569 596 .continue: … … 1957 1984 loadisFromInstruction(2, t0) 1958 1985 loadpFromInstruction(5, t1) 1986 if POINTER_PROFILING 1987 move t1, t5 1988 end 1959 1989 loadp LLIntCallLinkInfo::callee[t1], t2 1960 1990 loadConstantOrVariable(t0, t3) … … 1972 2002 loadp _g_JITCodePoison, t2 1973 2003 xorp LLIntCallLinkInfo::machineCodeTarget[t1], t2 1974 prepareCall(t2, t1, t3, t4) 1975 callTargetFunction(t2) 2004 prepareCall(t2, t1, t3, t4, macro (callPtrTag) 2005 if POINTER_PROFILING 2006 loadp LLIntCallLinkInfo::callPtrTag[t5], callPtrTag 2007 end 2008 end) 2009 if POINTER_PROFILING 2010 loadp LLIntCallLinkInfo::callPtrTag[t5], t3 2011 end 2012 callTargetFunction(t2, t3) 1976 2013 else 1977 prepareCall(LLIntCallLinkInfo::machineCodeTarget[t1], t2, t3, t4) 1978 callTargetFunction(LLIntCallLinkInfo::machineCodeTarget[t1]) 2014 prepareCall(LLIntCallLinkInfo::machineCodeTarget[t1], t2, t3, t4, macro (callPtrTag) 2015 if POINTER_PROFILING 2016 loadp LLIntCallLinkInfo::callPtrTag[t5], callPtrTag 2017 end 2018 end) 2019 if POINTER_PROFILING 2020 loadp LLIntCallLinkInfo::callPtrTag[t5], t3 2021 end 2022 callTargetFunction(LLIntCallLinkInfo::machineCodeTarget[t1], t3) 1979 2023 end 1980 2024 … … 2076 2120 andp MarkedBlockMask, t1 2077 2121 loadp MarkedBlockFooterOffset + MarkedBlock::Footer::m_vm[t1], t1 2078 jmp VM::targetMachinePCForThrow[t1] 2122 jmp VM::targetMachinePCForThrow[t1], ExceptionHandlerPtrTag 2079 2123 2080 2124 … … 2107 2151 if X86_64_WIN 2108 2152 subp 32, sp 2109 call executableOffsetToFunction[t1] 2153 call executableOffsetToFunction[t1], NativeCodePtrTag 2110 2154 addp 32, sp 2111 2155 else 2112 2156 loadp _g_NativeCodePoison, t2 2113 2157 xorp executableOffsetToFunction[t1], t2 2114 call t2 2158 call t2, NativeCodePtrTag 2115 2159 end 2116 2160 end … … 2150 2194 if X86_64_WIN 2151 2195 subp 32, sp 2152 call offsetOfFunction[t1] 2196 call offsetOfFunction[t1], InternalFunctionPtrTag 2153 2197 addp 32, sp 2154 2198 else 2155 2199 loadp _g_NativeCodePoison, t2 2156 2200 xorp offsetOfFunction[t1], t2 2157 call t2 2201 call t2, InternalFunctionPtrTag 2158 2202 end 2159 2203 end -
trunk/Source/JavaScriptCore/offlineasm/ast.rb
r229447 r229481 930 930 when "emit" 931 931 $asm.puts "#{operands[0].dump}" 932 when "tagReturnAddress", "untagReturnAddress" 932 933 else 933 934 raise "Unhandled opcode #{opcode} at #{codeOriginString}" -
trunk/Source/JavaScriptCore/offlineasm/instructions.rb
r229447 r229481 1 # Copyright (C) 2011 Apple Inc. All rights reserved.1 # Copyright (C) 2011-2018 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 250 250 "leai", 251 251 "leap", 252 "memfence" 252 "memfence", 253 "tagReturnAddress", 254 "untagReturnAddress", 255 "removeCodePtrTag" 253 256 ] 254 257 -
trunk/Source/JavaScriptCore/offlineasm/risc.rb
r229447 r229481 449 449 def riscLowerMisplacedAddresses(list) 450 450 newList = [] 451 list.each { 452 | node | 453 if node.is_a? Instruction 451 hasBackendSpecificLowering = Instruction.respond_to? "lowerMisplacedAddresses#{$activeBackend}" 452 list.each { 453 | node | 454 if node.is_a? Instruction 455 if hasBackendSpecificLowering 456 wasHandled, newList = Instruction.send("lowerMisplacedAddresses#{$activeBackend}", node, newList) 457 next if wasHandled 458 end 459 454 460 postInstructions = [] 455 461 annotation = node.annotation -
trunk/Source/WTF/ChangeLog
r229447 r229481 1 2018-03-09 Mark Lam <mark.lam@apple.com> 2 3 [Re-landing] Prepare LLInt code to support pointer profiling. 4 https://bugs.webkit.org/show_bug.cgi?id=183387 5 <rdar://problem/38199678> 6 7 Reviewed by JF Bastien. 8 9 * wtf/Platform.h: 10 1 11 2018-03-08 Commit Queue <commit-queue@webkit.org> 2 12 -
trunk/Source/WTF/wtf/Platform.h
r229447 r229481 1013 1013 #endif 1014 1014 1015 #if !defined(USE_POINTER_PROFILING) || USE(JSVALUE32_64) || !ENABLE(JIT) 1016 #undef USE_POINTER_PROFILING 1017 #define USE_POINTER_PROFILING 0 1018 #endif 1019 1015 1020 /* CSS Selector JIT Compiler */ 1016 1021 #if !defined(ENABLE_CSS_SELECTOR_JIT)
Note: See TracChangeset
for help on using the changeset viewer.