Changeset 249577 in webkit for trunk/Source/JavaScriptCore/interpreter/ShadowChicken.cpp
- Timestamp:
- Sep 6, 2019, 10:03:28 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/ShadowChicken.cpp
r249566 r249577 46 46 47 47 if (isPrologue()) { 48 String name = "?"_s;49 if (auto* function = jsDynamicCast<JSFunction*>(callee->vm(), callee)) {50 name = function->name(callee->vm());51 if (name.isEmpty())52 name = "?"_s;53 }54 55 48 out.print( 56 49 "{callee = ", RawPointer(callee), ", frame = ", RawPointer(frame), ", callerFrame = ", 57 RawPointer(callerFrame), " , name = ", name, "}");50 RawPointer(callerFrame), "}"); 58 51 return; 59 52 } … … 70 63 void ShadowChicken::Frame::dump(PrintStream& out) const 71 64 { 72 String name = "?"_s;73 if (auto* function = jsDynamicCast<JSFunction*>(callee->vm(), callee)) {74 name = function->name(callee->vm());75 if (name.isEmpty())76 name = "?"_s;77 }78 79 65 out.print( 80 "{callee = ", *callee, ", frame = ", RawPointer(frame), ", isTailDeleted = ",81 isTailDeleted, " , name = ", name, "}");66 "{callee = ", RawPointer(callee), ", frame = ", RawPointer(frame), ", isTailDeleted = ", 67 isTailDeleted, "}"); 82 68 } 83 69 … … 85 71 : m_logSize(Options::shadowChickenLogSize()) 86 72 { 87 // Allow one additional packet beyond m_logEnd. This is useful for the moment we 88 // log a packet when the log is full and force an update. At that moment the packet 89 // that is being logged should be included in the update because it may be 90 // a critical prologue needed to rationalize the current machine stack with the 91 // shadow stack. 92 m_log = static_cast<Packet*>(fastZeroedMalloc(sizeof(Packet) * m_logSize + 1)); 73 m_log = static_cast<Packet*>(fastZeroedMalloc(sizeof(Packet) * m_logSize)); 93 74 m_logCursor = m_log; 94 75 m_logEnd = m_log + m_logSize; … … 102 83 void ShadowChicken::log(VM& vm, ExecState* exec, const Packet& packet) 103 84 { 104 // This write is allowed because we construct the log with space for 1 additional packet.85 update(vm, exec); 105 86 *m_logCursor++ = packet; 106 update(vm, exec);107 87 } 108 88 … … 163 143 } 164 144 145 165 146 if (ShadowChickenInternal::verbose) 166 147 dataLog(" Revised stack: ", listDump(m_stack), "\n"); … … 308 289 309 290 CallFrame* callFrame = visitor->callFrame(); 310 if (ShadowChickenInternal::verbose) { 311 dataLog(" Examining callFrame:", RawPointer(callFrame), ", callee:", RawPointer(callFrame->jsCallee()), ", callerFrame:", RawPointer(callFrame->callerFrame()), "\n"); 312 JSObject* callee = callFrame->jsCallee(); 313 if (auto* function = jsDynamicCast<JSFunction*>(callee->vm(), callee)) 314 dataLog(" Function = ", function->name(callee->vm()), "\n"); 315 } 316 291 if (ShadowChickenInternal::verbose) 292 dataLog(" Examining ", RawPointer(callFrame), "\n"); 317 293 if (callFrame == highestPointSinceLastTime) { 318 294 if (ShadowChickenInternal::verbose) 319 dataLog(" Bailing at ", RawPointer(callFrame), " because it's the highest point since last time\n"); 320 321 // FIXME: At this point the shadow stack may still have tail deleted frames 322 // that do not run into the current call frame but are left in the shadow stack. 323 // Those tail deleted frames should be validated somehow. 324 295 dataLog(" Bailing at ", RawPointer(callFrame), " because it's the highest point since last time.\n"); 325 296 return StackVisitor::Done; 326 297 } … … 348 319 && m_log[indexInLog].frame == toPush.last().frame) { 349 320 if (ShadowChickenInternal::verbose) 350 dataLog(" Going to loop through to find tail deleted frames using ", RawPointer(callFrame), "with indexInLog = ", indexInLog, " and push-stack top = ", toPush.last(), "\n");321 dataLog(" Going to loop through to find tail deleted frames with indexInLog = ", indexInLog, " and push-stack top = ", toPush.last(), "\n"); 351 322 for (;;) { 352 323 ASSERT(m_log[indexInLog].frame == toPush.last().frame); … … 370 341 } 371 342 indexInLog--; // Skip over the tail packet. 372 373 // FIXME: After a few iterations the tail packet referenced frame may not be the374 // same as the original callFrame for the real stack frame we started with.375 // It is unclear when we should break.376 343 377 344 if (!advanceIndexInLogTo(tailPacket.frame, nullptr, nullptr)) { … … 413 380 414 381 if (ShadowChickenInternal::verbose) 415 dataLog(" After pushing: ", listDump(m_stack), "\n");382 dataLog(" After pushing: ", *this, "\n"); 416 383 417 384 // Remove tail frames until the number of tail deleted frames is small enough. … … 481 448 out.print("\n"); 482 449 for (unsigned i = 0; i < limit; ++i) 483 out.print("\t", comma, "[", i, "] ",m_log[i], "\n");450 out.print("\t", comma, m_log[i], "\n"); 484 451 out.print("]}"); 485 452 }
Note:
See TracChangeset
for help on using the changeset viewer.