Changeset 264049 in webkit for trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.cpp
- Timestamp:
- Jul 7, 2020, 5:32:35 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.cpp
r263035 r264049 34 34 #define USES_OR_DEFS(__opcode, ...) \ 35 35 case __opcode::opcodeID: { \ 36 static_assert(__opcode::opcodeID >= NUMBER_OF_BYTECODE_WITH_CHECKPOINTS, "Don't use this macro for bytecodes that have checkpoints."); \ 36 37 auto __bytecode = instruction->as<__opcode>(); \ 37 38 WTF_LAZY_FOR_EACH_TERM(CALL_FUNCTOR, __VA_ARGS__) \ … … 42 43 #define DEFS USES_OR_DEFS 43 44 44 void computeUsesForBytecodeIndexImpl(VirtualRegister scopeRegister, const Instruction* instruction, const Function<void(VirtualRegister)>& functor)45 void computeUsesForBytecodeIndexImpl(VirtualRegister scopeRegister, const Instruction* instruction, Checkpoint checkpoint, const ScopedLambda<void(VirtualRegister)>& functor) 45 46 { 46 47 OpcodeID opcodeID = instruction->opcodeID(); 47 48 48 auto handleNewArrayLike = [&](auto op) { 49 50 auto handleNewArrayLike = [&] (auto op) { 49 51 int base = op.m_argv.offset(); 50 52 for (int i = 0; i < static_cast<int>(op.m_argc); i++) … … 52 54 }; 53 55 54 auto handleOpCallLike = [&] (auto op) {56 auto handleOpCallLike = [&] (auto op) { 55 57 functor(op.m_callee); 56 58 int lastArg = -static_cast<int>(op.m_argv) + CallFrame::thisArgumentOffset(); … … 60 62 functor(scopeRegister); 61 63 return; 64 }; 65 66 auto useAtEachCheckpoint = [&] (auto... virtualRegisters) { 67 (functor(virtualRegisters), ...); 68 }; 69 70 auto useAtEachCheckpointStartingWith = [&] (Checkpoint firstUse, auto... virtualRegisters) { 71 if (checkpoint >= firstUse) 72 (functor(virtualRegisters), ...); 62 73 }; 63 74 … … 251 262 USES(OpHasOwnStructureProperty, base, property, enumerator) 252 263 USES(OpInStructureProperty, base, property, enumerator) 253 USES(OpConstructVarargs, callee, thisValue, arguments) 254 USES(OpCallVarargs, callee, thisValue, arguments) 255 USES(OpTailCallVarargs, callee, thisValue, arguments) 264 265 case op_call_varargs: { 266 auto bytecode = instruction->as<OpCallVarargs>(); 267 useAtEachCheckpoint(bytecode.m_callee, bytecode.m_thisValue, bytecode.m_arguments); 268 return; 269 } 270 case op_tail_call_varargs: { 271 auto bytecode = instruction->as<OpTailCallVarargs>(); 272 useAtEachCheckpoint(bytecode.m_callee, bytecode.m_thisValue, bytecode.m_arguments); 273 return; 274 } 275 case op_construct_varargs: { 276 auto bytecode = instruction->as<OpConstructVarargs>(); 277 useAtEachCheckpoint(bytecode.m_callee, bytecode.m_thisValue, bytecode.m_arguments); 278 return; 279 } 256 280 257 281 USES(OpGetDirectPname, base, property, index, enumerator) … … 266 290 USES(OpYield, generator, argument) 267 291 268 USES(OpIteratorOpen, symbolIterator, iterable) 269 USES(OpIteratorNext, iterator, next, iterable) 292 case op_iterator_open: { 293 auto bytecode = instruction->as<OpIteratorOpen>(); 294 useAtEachCheckpointStartingWith(OpIteratorOpen::symbolCall, bytecode.m_symbolIterator, bytecode.m_iterable); 295 useAtEachCheckpointStartingWith(OpIteratorOpen::getNext, bytecode.m_iterator); 296 return; 297 } 298 299 case op_iterator_next: { 300 auto bytecode = instruction->as<OpIteratorNext>(); 301 useAtEachCheckpoint(bytecode.m_iterator); 302 useAtEachCheckpointStartingWith(OpIteratorNext::computeNext, bytecode.m_next, bytecode.m_iterable); 303 return; 304 } 270 305 271 306 case op_new_array_with_spread: … … 303 338 } 304 339 305 void computeDefsForBytecodeIndexImpl(unsigned numVars, const Instruction* instruction, const Function<void(VirtualRegister)>& functor)340 void computeDefsForBytecodeIndexImpl(unsigned numVars, const Instruction* instruction, Checkpoint checkpoint, const ScopedLambda<void(VirtualRegister)>& functor) 306 341 { 342 343 auto defAt = [&] (Checkpoint target, VirtualRegister operand) { 344 if (target == checkpoint) 345 functor(operand); 346 }; 347 307 348 switch (instruction->opcodeID()) { 308 349 case op_wide16: … … 413 454 DEFS(OpNewAsyncFunc, dst) 414 455 DEFS(OpNewAsyncFuncExp, dst) 415 DEFS(OpCallVarargs, dst) 416 DEFS(OpTailCallVarargs, dst) 456 case op_call_varargs: { 457 auto bytecode = instruction->as<OpCallVarargs>(); 458 defAt(OpCallVarargs::makeCall, bytecode.m_dst); 459 return; 460 } 461 case op_tail_call_varargs: { 462 auto bytecode = instruction->as<OpTailCallVarargs>(); 463 defAt(OpTailCallVarargs::makeCall, bytecode.m_dst); 464 return; 465 } 466 case op_construct_varargs: { 467 auto bytecode = instruction->as<OpConstructVarargs>(); 468 defAt(OpConstructVarargs::makeCall, bytecode.m_dst); 469 return; 470 } 471 417 472 DEFS(OpTailCallForwardArguments, dst) 418 DEFS(OpConstructVarargs, dst)419 473 DEFS(OpGetFromScope, dst) 420 474 DEFS(OpCall, dst) … … 502 556 DEFS(OpCatch, exception, thrownValue) 503 557 504 DEFS(OpIteratorOpen, iterator, next) 505 DEFS(OpIteratorNext, done, value) 558 case op_iterator_open: { 559 auto bytecode = instruction->as<OpIteratorOpen>(); 560 561 defAt(OpIteratorOpen::symbolCall, bytecode.m_iterator); 562 defAt(OpIteratorOpen::getNext, bytecode.m_next); 563 return; 564 } 565 566 case op_iterator_next: { 567 auto bytecode = instruction->as<OpIteratorNext>(); 568 569 defAt(OpIteratorNext::getDone, bytecode.m_done); 570 // We need to claim we set m_value here because we could early exit from the bytecode if we are done. 571 defAt(OpIteratorNext::getDone, bytecode.m_value); 572 573 defAt(OpIteratorNext::getValue, bytecode.m_value); 574 return; 575 } 506 576 507 577 case op_enter: {
Note:
See TracChangeset
for help on using the changeset viewer.