Changeset 270981 in webkit
- Timestamp:
- Dec 18, 2020, 11:25:34 AM (4 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r270967 r270981 1 2020-12-17 Mark Lam <mark.lam@apple.com> 2 3 Add tagging to JIT probe's return address. 4 https://bugs.webkit.org/show_bug.cgi?id=220008 5 rdar://71279530 6 7 Reviewed by Keith Miller and Robin Morisset. 8 9 * assembler/MacroAssemblerARM64.cpp: 10 * assembler/testmasm.cpp: 11 (JSC::testProbeModifiesProgramCounter): 12 * runtime/JSCPtrTag.h: 13 1 14 2020-12-18 Yusuke Suzuki <ysuzuki@apple.com> 2 15 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM64.cpp
r268247 r270981 1 1 /* 2 * Copyright (C) 2013-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2013-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 301 301 302 302 #if CPU(ARM64E) 303 #define JIT_PROBE_PC_PTR_TAG 0xeeac 303 304 #define JIT_PROBE_EXECUTOR_PTR_TAG 0x28de 304 305 #define JIT_PROBE_STACK_INITIALIZATION_FUNCTION_PTR_TAG 0x315c 306 static_assert(JIT_PROBE_PC_PTR_TAG == JITProbePCPtrTag); 305 307 static_assert(JIT_PROBE_EXECUTOR_PTR_TAG == JITProbeExecutorPtrTag); 306 308 static_assert(JIT_PROBE_STACK_INITIALIZATION_FUNCTION_PTR_TAG == JITProbeStackInitializationFunctionPtrTag); … … 361 363 "stp x7, x26, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_LR_OFFSET) "]" "\n" // Save values lr and sp (original sp value computed into x26 above). 362 364 365 "add x30, x30, #" STRINGIZE_VALUE_OF(2 * GPREG_SIZE) "\n" // The PC after the probe is at 2 instructions past the return point. 366 #if CPU(ARM64E) 367 "movz x27, #" STRINGIZE_VALUE_OF(JIT_PROBE_PC_PTR_TAG) "\n" 368 "pacib x30, x27" "\n" 369 #endif 363 370 "str x30, [sp, #" STRINGIZE_VALUE_OF(SAVED_PROBE_RETURN_PC_OFFSET) "]" "\n" // Save a duplicate copy of return pc (in lr). 364 365 "add x30, x30, #" STRINGIZE_VALUE_OF(2 * GPREG_SIZE) "\n" // The PC after the probe is at 2 instructions past the return point.366 371 "str x30, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_PC_OFFSET) "]" "\n" 367 372 … … 497 502 "ldr x27, [sp, #" STRINGIZE_VALUE_OF(SAVED_PROBE_RETURN_PC_OFFSET) "]" "\n" 498 503 "ldr x28, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_PC_OFFSET) "]" "\n" 499 "add x27, x27, #" STRINGIZE_VALUE_OF(2 * GPREG_SIZE) "\n"500 504 "cmp x27, x28" "\n" 501 505 "bne " LOCAL_LABEL_STRING(ctiMasmProbeTrampolineEnd) "\n" … … 510 514 // 3. Force the return ramp to return to the probe return site. 511 515 "ldr x27, [sp, #" STRINGIZE_VALUE_OF(SAVED_PROBE_RETURN_PC_OFFSET) "]" "\n" 516 #if CPU(ARM64E) 517 "movz x28, #" STRINGIZE_VALUE_OF(JIT_PROBE_PC_PTR_TAG) "\n" 518 "autib x27, x28" "\n" 519 "lsr x28, x27, #8" "\n" 520 "and x28, x28, #0xff000000000000" "\n" 521 "orr x28, x28, x27" "\n" 522 "ldrb w28, [x28]" "\n" 523 #endif 524 "sub x27, x27, #" STRINGIZE_VALUE_OF(2 * GPREG_SIZE) "\n" // The return point PC is at 2 instructions before the end of the probe. 525 #if CPU(ARM64E) 526 "movz x28, #" STRINGIZE_VALUE_OF(JIT_PROBE_PC_PTR_TAG) "\n" 527 "pacib x27, x28" "\n" 528 #endif 512 529 "str x27, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_PC_OFFSET) "]" "\n" 513 530 … … 521 538 "ldp x27, x28, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_X27_OFFSET) "]" "\n" 522 539 "stp x27, x28, [x30, #" STRINGIZE_VALUE_OF(OUT_X27_OFFSET) "]" "\n" 540 "ldr x28, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_PC_OFFSET) "]" "\n" // Set up the outgoing record so that we'll jump to the new PC. 541 #if CPU(ARM64E) 542 "movz x27, #" STRINGIZE_VALUE_OF(JIT_PROBE_PC_PTR_TAG) "\n" 543 "autib x28, x27" "\n" 544 "lsr x27, x28, #8" "\n" 545 "and x27, x27, #0xff000000000000" "\n" 546 "orr x27, x27, x28" "\n" 547 "ldrb w27, [x27]" "\n" 548 "add x27, x30, #48" "\n" // Compute sp at return point. 549 "pacib x28, x27" "\n" 550 #endif 523 551 "ldr x27, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_FP_OFFSET) "]" "\n" 524 "ldr x28, [sp, #" STRINGIZE_VALUE_OF(PROBE_CPU_PC_OFFSET) "]" "\n" // Set up the outgoing record so that we'll jump to the new PC.525 552 "stp x27, x28, [x30, #" STRINGIZE_VALUE_OF(OUT_FP_OFFSET) "]" "\n" 526 553 "mov sp, x30" "\n" … … 532 559 "ldp x27, x28, [sp], #" STRINGIZE_VALUE_OF(2 * GPREG_SIZE) "\n" 533 560 "ldp x29, x30, [sp], #" STRINGIZE_VALUE_OF(2 * GPREG_SIZE) "\n" 561 #if CPU(ARM64E) 562 "retab" "\n" 563 #else 534 564 "ret" "\n" 565 #endif 535 566 ); 536 567 #endif // COMPILER(GCC_COMPATIBLE) -
trunk/Source/JavaScriptCore/assembler/testmasm.cpp
r268247 r270981 2124 2124 jit.probe([&] (Probe::Context& context) { 2125 2125 probeCallCount++; 2126 context.cpu.pc() = untagCodePtr<JSEntryPtrTag>(continuation.code().executableAddress());2126 context.cpu.pc() = retagCodePtr<JSEntryPtrTag, JITProbePCPtrTag>(continuation.code().executableAddress()); 2127 2127 }); 2128 2128 -
trunk/Source/JavaScriptCore/runtime/JSCPtrTag.h
r270764 r270981 1 1 /* 2 * Copyright (C) 2018-20 19Apple Inc. All rights reserved.2 * Copyright (C) 2018-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 58 58 v(JITProbePtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \ 59 59 v(JITProbeExecutorPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \ 60 v(JITProbePCPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \ 60 61 v(JITProbeStackInitializationFunctionPtrTag, PtrTagCalleeType::Native, PtrTagCallerType::Native) \ 61 62 /* Callee:JIT Caller:Native */ \
Note:
See TracChangeset
for help on using the changeset viewer.