source: webkit/trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

Last change on this file was 290768, checked in by Justin Michaud, 3 years ago

Refactor OpcodeTraits to support the possibility of having 2-byte WASM opcode ids in bytecode streams
https://bugs.webkit.org/show_bug.cgi?id=237347

The number of WASM opcodes will increase beyond 255 when WASM SIMD is implemented, and so this patch
changes OpcodeTraits to allow for the possibility of having two-byte WASM opcodes without regressing
JS. We have to thread these OpcodeTraits everywhere that they are used so that code can read the
correct value when decoding an instruction stream. This patch does not change the size of WASM opcodes
yet, although I have tested that the test suite still passes if we do increase the opcode size.

Reviewed by Keith Miller.

  • bytecode/BytecodeBasicBlock.cpp:

(JSC::BytecodeBasicBlock<OpcodeTraits>::BytecodeBasicBlock):
(JSC::BytecodeBasicBlock<OpcodeTraits>::addLength):
(JSC::BytecodeBasicBlock<OpcodeTraits>::shrinkToFit):
(JSC::isJumpTarget):
(JSC::BytecodeBasicBlock<OpcodeTraits>::computeImpl):
(JSC::BytecodeBasicBlock<JSOpcodeTraits>::compute):
(JSC::BytecodeBasicBlock::BytecodeBasicBlock): Deleted.
(JSC::BytecodeBasicBlock::addLength): Deleted.
(JSC::BytecodeBasicBlock::shrinkToFit): Deleted.
(JSC::BytecodeBasicBlock::computeImpl): Deleted.
(JSC::BytecodeBasicBlock::compute): Deleted.

  • bytecode/BytecodeBasicBlock.h:

(JSC::BytecodeBasicBlock::addSuccessor):

  • bytecode/BytecodeDumper.cpp:

(JSC::BytecodeDumperBase<InstructionStreamType>::printLocationAndOp):
(JSC::BytecodeDumperBase<InstructionStreamType>::dumpValue):
(JSC::BytecodeDumper<Block>::outOfLineJumpOffset const):
(JSC::BytecodeDumper<Block>::dumpBytecode):
(JSC::dumpHeader):
(JSC::CodeBlockBytecodeDumper<Block>::dumpBlock):
(JSC::CodeBlockBytecodeDumper<Block>::dumpGraph):
(JSC::Wasm::BytecodeDumper::dumpBlock):
(JSC::Wasm::BytecodeDumper::registerName const):
(JSC::Wasm::BytecodeDumper::outOfLineJumpOffset const):
(JSC::BytecodeDumperBase::printLocationAndOp): Deleted.
(JSC::BytecodeDumperBase::dumpValue): Deleted.

  • bytecode/BytecodeDumper.h:
  • bytecode/BytecodeGeneratorification.cpp:

(JSC::BytecodeGeneratorification::BytecodeGeneratorification):
(JSC::BytecodeGeneratorification::enterPoint const):
(JSC::BytecodeGeneratorification::instructions const):
(JSC::GeneratorLivenessAnalysis::run):
(JSC::performGeneratorification):

  • bytecode/BytecodeGeneratorification.h:
  • bytecode/BytecodeGraph.h:

(JSC::BytecodeGraph::blockContainsBytecodeOffset):
(JSC::BytecodeGraph::findBasicBlockForBytecodeOffset):
(JSC::BytecodeGraph::findBasicBlockWithLeaderOffset):
(JSC::BytecodeGraph::at const):
(JSC::BytecodeGraph::operator[] const):
(JSC::BytecodeGraph::first):
(JSC::BytecodeGraph::last):
(JSC::BytecodeGraph::dump):
(JSC::BytecodeGraph::BytecodeGraph):

  • bytecode/BytecodeLivenessAnalysis.cpp:

(JSC::BytecodeLivenessAnalysis::computeFullLiveness):
(JSC::BytecodeLivenessAnalysis::dumpResults):

  • bytecode/BytecodeLivenessAnalysis.h:
  • bytecode/BytecodeLivenessAnalysisInlines.h:

(JSC::BytecodeLivenessPropagation::stepOverBytecodeIndexDef):
(JSC::BytecodeLivenessPropagation::stepOverBytecodeIndexUse):
(JSC::BytecodeLivenessPropagation::stepOverBytecodeIndexUseInExceptionHandler):
(JSC::BytecodeLivenessPropagation::stepOverBytecodeIndex):
(JSC::BytecodeLivenessPropagation::stepOverInstruction):
(JSC::BytecodeLivenessPropagation::computeLocalLivenessForInstruction):
(JSC::BytecodeLivenessPropagation::computeLocalLivenessForBlock):
(JSC::BytecodeLivenessPropagation::getLivenessInfoAtInstruction):
(JSC::BytecodeLivenessPropagation::runLivenessFixpoint):

  • bytecode/BytecodeRewriter.cpp:

(JSC::BytecodeRewriter::insertImpl):
(JSC::BytecodeRewriter::adjustJumpTargets):

  • bytecode/BytecodeRewriter.h:

(JSC::BytecodeRewriter::InsertionPoint::InsertionPoint):
(JSC::BytecodeRewriter::Fragment::Fragment):
(JSC::BytecodeRewriter::BytecodeRewriter):
(JSC::BytecodeRewriter::insertFragmentBefore):
(JSC::BytecodeRewriter::insertFragmentAfter):
(JSC::BytecodeRewriter::replaceBytecodeWithFragment):
(JSC::BytecodeRewriter::adjustAbsoluteOffset):
(JSC::BytecodeRewriter::adjustJumpTarget):

  • bytecode/BytecodeUseDef.cpp:

(JSC::computeUsesForBytecodeIndexImpl):
(JSC::computeDefsForBytecodeIndexImpl):

  • bytecode/BytecodeUseDef.h:

(JSC::computeUsesForBytecodeIndex):
(JSC::computeDefsForBytecodeIndex):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::hasOpDebugForLineAndColumn):
(JSC::CodeBlock::notifyLexicalBindingUpdate):
(JSC::CodeBlock::validate):
(JSC::CodeBlock::outOfLineJumpOffset):
(JSC::CodeBlock::outOfLineJumpTarget):
(JSC::CodeBlock::binaryArithProfileForPC):
(JSC::CodeBlock::unaryArithProfileForPC):
(JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::outOfLineJumpOffset):
(JSC::CodeBlock::bytecodeOffset):
(JSC::CodeBlock::bytecodeIndex):
(JSC::CodeBlock::instructions const):
(JSC::CodeBlock::instructionAt const):

  • bytecode/Instruction.h:

(JSC::BaseInstruction::opcodeID const):
(JSC::BaseInstruction::name const):
(JSC::BaseInstruction::isWide16 const):
(JSC::BaseInstruction::isWide32 const):
(JSC::BaseInstruction::width const):
(JSC::BaseInstruction::hasMetadata const):
(JSC::BaseInstruction::hasCheckpoints const):
(JSC::BaseInstruction::numberOfCheckpoints const):
(JSC::BaseInstruction::sizeShiftAmount const):
(JSC::BaseInstruction::opcodeIDWidth const):
(JSC::BaseInstruction::opcodeIDBytes const):
(JSC::BaseInstruction::size const):
(JSC::BaseInstruction::is const):
(JSC::BaseInstruction::as const):
(JSC::BaseInstruction::asKnownWidth const):
(JSC::BaseInstruction::cast):
(JSC::BaseInstruction::cast const):
(JSC::BaseInstruction::wide16 const):
(JSC::BaseInstruction::wide32 const):

  • bytecode/InstructionStream.cpp:

(JSC::InstructionStream::InstructionStream): Deleted.
(JSC::InstructionStream::sizeInBytes const): Deleted.
(JSC::InstructionStream::contains const): Deleted.

  • bytecode/InstructionStream.h:

(JSC::InstructionStream::sizeInBytes const):
(JSC::InstructionStream::BaseRef::operator-> const):
(JSC::InstructionStream::BaseRef::ptr const):
(JSC::InstructionStream::BaseRef::unwrap const):
(JSC::InstructionStream::MutableRef::operator->):
(JSC::InstructionStream::MutableRef::operator-> const):
(JSC::InstructionStream::MutableRef::ptr):
(JSC::InstructionStream::MutableRef::ptr const):
(JSC::InstructionStream::MutableRef::unwrap):
(JSC::InstructionStream::MutableRef::unwrap const):
(JSC::InstructionStream::iterator::operator++):
(JSC::InstructionStream::contains const):
(JSC::InstructionStream::InstructionStream):
(JSC::InstructionStreamWriter::InstructionStreamWriter):
(JSC::InstructionStreamWriter::finalize):
(JSC::InstructionStreamWriter::swap):
(JSC::InstructionStreamWriter::iterator::operator++):

  • bytecode/Opcode.h:
  • bytecode/OpcodeInlines.h:

(JSC::isOpcodeShape):

  • bytecode/OpcodeSize.h:
  • bytecode/PreciseJumpTargets.cpp:

(JSC::getJumpTargetsForInstruction):
(JSC::computePreciseJumpTargetsInternal):
(JSC::computePreciseJumpTargets):
(JSC::recomputePreciseJumpTargets):
(JSC::findJumpTargetsForInstruction):

  • bytecode/PreciseJumpTargets.h:
  • bytecode/PreciseJumpTargetsInlines.h:

(JSC::jumpTargetForInstruction):
(JSC::extractStoredJumpTargetsForInstruction):
(JSC::updateStoredJumpTargetsForInstruction):

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::dumpLineColumnEntry):
(JSC::UnlinkedCodeBlock::instructions const):
(JSC::UnlinkedCodeBlock::outOfLineJumpOffset):

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::instructionAt const):
(JSC::UnlinkedCodeBlock::bytecodeOffset):
(JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets const):
(JSC::UnlinkedCodeBlock::outOfLineJumpOffset):

  • bytecode/UnlinkedCodeBlockGenerator.cpp:

(JSC::UnlinkedCodeBlockGenerator::finalize):
(JSC::UnlinkedCodeBlockGenerator::applyModification):
(JSC::UnlinkedCodeBlockGenerator::addOutOfLineJumpTarget):
(JSC::UnlinkedCodeBlockGenerator::outOfLineJumpOffset):

  • bytecode/UnlinkedCodeBlockGenerator.h:

(JSC::UnlinkedCodeBlockGenerator::addOpProfileControlFlowBytecodeOffset):
(JSC::UnlinkedCodeBlockGenerator::outOfLineJumpOffset):

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::instructions const):
(JSC::BytecodeGenerator::withWriter):

  • bytecompiler/BytecodeGeneratorBase.h:
  • bytecompiler/BytecodeGeneratorBaseInlines.h:

(JSC::BytecodeGeneratorBase<Traits>::recordOpcode):
(JSC::BytecodeGeneratorBase<Traits>::alignWideOpcode16):
(JSC::BytecodeGeneratorBase<Traits>::alignWideOpcode32):

  • bytecompiler/StaticPropertyAnalysis.h:

(JSC::StaticPropertyAnalysis::create):
(JSC::StaticPropertyAnalysis::StaticPropertyAnalysis):

  • bytecompiler/StaticPropertyAnalyzer.h:

(JSC::StaticPropertyAnalyzer::createThis):
(JSC::StaticPropertyAnalyzer::newObject):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleCall):
(JSC::DFG::ByteCodeParser::handleVarargsCall):
(JSC::DFG::ByteCodeParser::handleRecursiveTailCall):
(JSC::DFG::ByteCodeParser::inlineCall):
(JSC::DFG::ByteCodeParser::parseGetById):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::parseCodeBlock):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::capabilityLevel):

  • dfg/DFGCapabilities.h:

(JSC::DFG::capabilityLevel):

  • dfg/DFGOSRExit.cpp:

(JSC::DFG::OSRExit::compileExit):

  • dfg/DFGOSRExitCompilerCommon.cpp:

(JSC::DFG::callerReturnPC):
(JSC::DFG::adjustAndJumpToTarget):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileLoopHint):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):

  • ftl/FTLOSRExitCompiler.cpp:

(JSC::FTL::compileStub):

  • ftl/FTLOperations.cpp:

(JSC::FTL::JSC_DEFINE_JIT_OPERATION):

  • generator/Argument.rb:
  • generator/DSL.rb:
  • generator/Opcode.rb:
  • interpreter/AbstractPC.h:
  • interpreter/CallFrame.cpp:

(JSC::CallFrame::currentVPC const):
(JSC::CallFrame::setCurrentVPC):

  • interpreter/CallFrame.h:
  • interpreter/Interpreter.cpp:

(JSC::CatchInfo::CatchInfo):

  • interpreter/Interpreter.h:
  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):

  • jit/JIT.h:
  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_jless):
(JSC::JIT::emit_op_jlesseq):
(JSC::JIT::emit_op_jgreater):
(JSC::JIT::emit_op_jgreatereq):
(JSC::JIT::emit_op_jnless):
(JSC::JIT::emit_op_jnlesseq):
(JSC::JIT::emit_op_jngreater):
(JSC::JIT::emit_op_jngreatereq):
(JSC::JIT::emitSlow_op_jless):
(JSC::JIT::emitSlow_op_jlesseq):
(JSC::JIT::emitSlow_op_jgreater):
(JSC::JIT::emitSlow_op_jgreatereq):
(JSC::JIT::emitSlow_op_jnless):
(JSC::JIT::emitSlow_op_jnlesseq):
(JSC::JIT::emitSlow_op_jngreater):
(JSC::JIT::emitSlow_op_jngreatereq):
(JSC::JIT::emit_op_below):
(JSC::JIT::emit_op_beloweq):
(JSC::JIT::emit_op_jbelow):
(JSC::JIT::emit_op_jbeloweq):
(JSC::JIT::emit_op_unsigned):
(JSC::JIT::emit_compareAndJump):
(JSC::JIT::emit_compareUnsignedAndJump):
(JSC::JIT::emit_compareUnsigned):
(JSC::JIT::emit_compareAndJumpSlow):
(JSC::JIT::emit_op_inc):
(JSC::JIT::emit_op_dec):
(JSC::JIT::emit_op_mod):
(JSC::JIT::emitSlow_op_mod):
(JSC::JIT::emit_op_pow):
(JSC::JIT::emitSlow_op_pow):
(JSC::JIT::emit_op_negate):
(JSC::JIT::emitSlow_op_negate):
(JSC::JIT::emitBitBinaryOpFastPath):
(JSC::JIT::emit_op_bitnot):
(JSC::JIT::emit_op_bitand):
(JSC::JIT::emit_op_bitor):
(JSC::JIT::emit_op_bitxor):
(JSC::JIT::emit_op_lshift):
(JSC::JIT::emitRightShiftFastPath):
(JSC::JIT::emit_op_rshift):
(JSC::JIT::emit_op_urshift):
(JSC::JIT::emit_op_add):
(JSC::JIT::emitSlow_op_add):
(JSC::JIT::emitMathICFast):
(JSC::JIT::emitMathICSlow):
(JSC::JIT::emit_op_div):
(JSC::JIT::emit_op_mul):
(JSC::JIT::emitSlow_op_mul):
(JSC::JIT::emit_op_sub):
(JSC::JIT::emitSlow_op_sub):

  • jit/JITCall.cpp:

(JSC::JIT::emit_op_ret):
(JSC::JIT::compileCallEvalSlowCase):
(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):
(JSC::JIT::emit_op_call):
(JSC::JIT::emit_op_tail_call):
(JSC::JIT::emit_op_call_eval):
(JSC::JIT::emit_op_call_varargs):
(JSC::JIT::emit_op_tail_call_varargs):
(JSC::JIT::emit_op_tail_call_forward_arguments):
(JSC::JIT::emit_op_construct_varargs):
(JSC::JIT::emit_op_construct):
(JSC::JIT::emitSlow_op_call):
(JSC::JIT::emitSlow_op_tail_call):
(JSC::JIT::emitSlow_op_call_eval):
(JSC::JIT::emitSlow_op_call_varargs):
(JSC::JIT::emitSlow_op_tail_call_varargs):
(JSC::JIT::emitSlow_op_tail_call_forward_arguments):
(JSC::JIT::emitSlow_op_construct_varargs):
(JSC::JIT::emitSlow_op_construct):
(JSC::JIT::emit_op_iterator_open):
(JSC::JIT::emitSlow_op_iterator_open):
(JSC::JIT::emit_op_iterator_next):
(JSC::JIT::emitSlow_op_iterator_next):

  • jit/JITExceptions.cpp:

(JSC::genericUnwind):

  • jit/JITInlines.h:

(JSC::JIT::fastPathResumePoint const):
(JSC::JIT::jumpTarget):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_mov):
(JSC::JIT::emit_op_end):
(JSC::JIT::emit_op_jmp):
(JSC::JIT::emit_op_new_object):
(JSC::JIT::emitSlow_op_new_object):
(JSC::JIT::emit_op_overrides_has_instance):
(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emitSlow_op_instanceof):
(JSC::JIT::emit_op_is_empty):
(JSC::JIT::emit_op_typeof_is_undefined):
(JSC::JIT::emit_op_is_undefined_or_null):
(JSC::JIT::emit_op_is_boolean):
(JSC::JIT::emit_op_is_number):
(JSC::JIT::emit_op_is_big_int):
(JSC::JIT::emit_op_is_cell_with_type):
(JSC::JIT::emit_op_is_object):
(JSC::JIT::emit_op_to_primitive):
(JSC::JIT::emit_op_to_property_key):
(JSC::JIT::emit_op_set_function_name):
(JSC::JIT::emit_op_not):
(JSC::JIT::emit_op_jfalse):
(JSC::JIT::emit_op_jeq_null):
(JSC::JIT::emit_op_jneq_null):
(JSC::JIT::emit_op_jundefined_or_null):
(JSC::JIT::emit_op_jnundefined_or_null):
(JSC::JIT::emit_op_jeq_ptr):
(JSC::JIT::emit_op_jneq_ptr):
(JSC::JIT::emit_op_eq):
(JSC::JIT::emit_op_jeq):
(JSC::JIT::emit_op_jtrue):
(JSC::JIT::emit_op_neq):
(JSC::JIT::emit_op_jneq):
(JSC::JIT::emit_op_throw):
(JSC::JIT::compileOpStrictEq):
(JSC::JIT::emit_op_stricteq):
(JSC::JIT::emit_op_nstricteq):
(JSC::JIT::compileOpStrictEqJump):
(JSC::JIT::emit_op_jstricteq):
(JSC::JIT::emit_op_jnstricteq):
(JSC::JIT::emitSlow_op_jstricteq):
(JSC::JIT::emitSlow_op_jnstricteq):
(JSC::JIT::emit_op_to_number):
(JSC::JIT::emit_op_to_numeric):
(JSC::JIT::emit_op_to_string):
(JSC::JIT::emit_op_to_object):
(JSC::JIT::emit_op_catch):
(JSC::JIT::emit_op_identity_with_profile):
(JSC::JIT::emit_op_get_parent_scope):
(JSC::JIT::emit_op_switch_imm):
(JSC::JIT::emit_op_switch_char):
(JSC::JIT::emit_op_switch_string):
(JSC::JIT::emit_op_eq_null):
(JSC::JIT::emit_op_neq_null):
(JSC::JIT::emit_op_enter):
(JSC::JIT::emit_op_get_scope):
(JSC::JIT::emit_op_to_this):
(JSC::JIT::emit_op_create_this):
(JSC::JIT::emit_op_check_tdz):
(JSC::JIT::emitSlow_op_eq):
(JSC::JIT::emitSlow_op_neq):
(JSC::JIT::emitSlow_op_jeq):
(JSC::JIT::emitSlow_op_jneq):
(JSC::JIT::emit_op_debug):
(JSC::JIT::emit_op_loop_hint):
(JSC::JIT::emitSlow_op_loop_hint):
(JSC::JIT::emit_op_check_traps):
(JSC::JIT::emit_op_nop):
(JSC::JIT::emit_op_super_sampler_begin):
(JSC::JIT::emit_op_super_sampler_end):
(JSC::JIT::emitSlow_op_check_traps):
(JSC::JIT::emit_op_new_regexp):
(JSC::JIT::emitNewFuncCommon):
(JSC::JIT::emit_op_new_func):
(JSC::JIT::emit_op_new_generator_func):
(JSC::JIT::emit_op_new_async_generator_func):
(JSC::JIT::emit_op_new_async_func):
(JSC::JIT::emitNewFuncExprCommon):
(JSC::JIT::emit_op_new_func_exp):
(JSC::JIT::emit_op_new_generator_func_exp):
(JSC::JIT::emit_op_new_async_func_exp):
(JSC::JIT::emit_op_new_async_generator_func_exp):
(JSC::JIT::emit_op_new_array):
(JSC::JIT::emit_op_new_array_with_size):
(JSC::JIT::emit_op_profile_type):
(JSC::JIT::emit_op_log_shadow_chicken_prologue):
(JSC::JIT::emit_op_log_shadow_chicken_tail):
(JSC::JIT::emit_op_profile_control_flow):
(JSC::JIT::emit_op_argument_count):
(JSC::JIT::emit_op_get_rest_length):
(JSC::JIT::emit_op_get_argument):
(JSC::JIT::emit_op_get_prototype_of):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_eq):
(JSC::JIT::emit_op_neq):
(JSC::JIT::emit_op_jeq):
(JSC::JIT::emit_op_jneq):
(JSC::JIT::emitSlow_op_eq):
(JSC::JIT::emitSlow_op_neq):
(JSC::JIT::emitSlow_op_jeq):
(JSC::JIT::emitSlow_op_jneq):
(JSC::JIT::emit_op_stricteq):
(JSC::JIT::emit_op_nstricteq):
(JSC::JIT::emit_op_jstricteq):
(JSC::JIT::emit_op_jnstricteq):
(JSC::JIT::emitSlow_op_jstricteq):
(JSC::JIT::emitSlow_op_jnstricteq):

  • jit/JITOperations.cpp:

(JSC::JSC_DEFINE_JIT_OPERATION):

  • jit/JITOperations.h:
  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emit_op_get_by_val):
(JSC::JIT::emitSlow_op_get_by_val):
(JSC::JIT::emit_op_get_private_name):
(JSC::JIT::emitSlow_op_get_private_name):
(JSC::JIT::emit_op_set_private_brand):
(JSC::JIT::emitSlow_op_set_private_brand):
(JSC::JIT::emit_op_check_private_brand):
(JSC::JIT::emitSlow_op_check_private_brand):
(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emit_op_put_by_val_direct):
(JSC::JIT::emitSlow_op_put_by_val):
(JSC::JIT::emit_op_put_private_name):
(JSC::JIT::emitSlow_op_put_private_name):
(JSC::JIT::emit_op_put_getter_by_id):
(JSC::JIT::emit_op_put_setter_by_id):
(JSC::JIT::emit_op_put_getter_setter_by_id):
(JSC::JIT::emit_op_put_getter_by_val):
(JSC::JIT::emit_op_put_setter_by_val):
(JSC::JIT::emit_op_del_by_id):
(JSC::JIT::emitSlow_op_del_by_id):
(JSC::JIT::emit_op_del_by_val):
(JSC::JIT::emitSlow_op_del_by_val):
(JSC::JIT::emit_op_try_get_by_id):
(JSC::JIT::emitSlow_op_try_get_by_id):
(JSC::JIT::emit_op_get_by_id_direct):
(JSC::JIT::emitSlow_op_get_by_id_direct):
(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::emitSlow_op_get_by_id):
(JSC::JIT::emit_op_get_by_id_with_this):
(JSC::JIT::emitSlow_op_get_by_id_with_this):
(JSC::JIT::emit_op_put_by_id):
(JSC::JIT::emitSlow_op_put_by_id):
(JSC::JIT::emit_op_in_by_id):
(JSC::JIT::emitSlow_op_in_by_id):
(JSC::JIT::emit_op_in_by_val):
(JSC::JIT::emitSlow_op_in_by_val):
(JSC::JIT::emit_op_has_private_name):
(JSC::JIT::emitSlow_op_has_private_name):
(JSC::JIT::emit_op_has_private_brand):
(JSC::JIT::emitSlow_op_has_private_brand):
(JSC::JIT::emit_op_resolve_scope):
(JSC::JIT::emit_op_get_from_scope):
(JSC::JIT::emit_op_put_to_scope):
(JSC::JIT::emitSlow_op_put_to_scope):
(JSC::JIT::emit_op_get_from_arguments):
(JSC::JIT::emit_op_put_to_arguments):
(JSC::JIT::emit_op_get_internal_field):
(JSC::JIT::emit_op_put_internal_field):
(JSC::JIT::emit_op_get_property_enumerator):
(JSC::JIT::emit_op_enumerator_next):
(JSC::JIT::emit_op_enumerator_get_by_val):
(JSC::JIT::emitSlow_op_enumerator_get_by_val):
(JSC::JIT::emit_op_enumerator_in_by_val):
(JSC::JIT::emit_op_enumerator_has_own_property):

  • llint/LLIntData.cpp:

(JSC::LLInt::initialize):

  • llint/LLIntData.h:

(JSC::LLInt::exceptionInstructions):
(JSC::LLInt::wasmExceptionInstructions):

  • llint/LLIntExceptions.cpp:

(JSC::LLInt::returnToThrow):
(JSC::LLInt::wasmReturnToThrow):

  • llint/LLIntExceptions.h:
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::llint_trace_operand):
(JSC::LLInt::llint_trace_value):
(JSC::LLInt::setupGetByIdPrototypeCache):
(JSC::LLInt::performLLIntGetByID):
(JSC::LLInt::varargsSetup):
(JSC::LLInt::commonCallEval):
(JSC::LLInt::dispatchToNextInstructionDuringExit):

  • llint/LLIntSlowPaths.h:
  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter.cpp:

(JSC::CLoopRegister::operator const JSInstruction*):
(JSC::CLoop::execute):
(JSC::CLoopRegister::operator const Instruction*): Deleted.

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • llint/WebAssembly.asm:
  • runtime/CachedTypes.cpp:

(JSC::CachedInstructionStream::encode):
(JSC::CachedInstructionStream::decode const):
(JSC::CachedCodeBlock::instructions const):

  • runtime/CommonSlowPaths.cpp:

(JSC::updateArithProfileForBinaryArithOp):
(JSC::iteratorOpenTryFastImpl):
(JSC::iteratorNextTryFastImpl):

  • runtime/CommonSlowPaths.h:
  • runtime/JSCConfig.h:
  • runtime/JSCJSValue.h:
  • runtime/SlowPathFunction.h:
  • runtime/VM.cpp:

(JSC::VM::addLoopHintExecutionCounter):
(JSC::VM::getLoopHintExecutionCounter):
(JSC::VM::removeLoopHintExecutionCounter):

  • runtime/VM.h:
  • wasm/WasmCallee.cpp:

(JSC::Wasm::LLIntCallee::LLIntCallee):
(JSC::Wasm::LLIntCallee::outOfLineJumpOffset):
(JSC::Wasm::LLIntCallee::outOfLineJumpTarget):

  • wasm/WasmCallee.h:
  • wasm/WasmFunctionCodeBlockGenerator.cpp:

(JSC::Wasm::FunctionCodeBlockGenerator::setInstructions):
(JSC::Wasm::FunctionCodeBlockGenerator::addOutOfLineJumpTarget):
(JSC::Wasm::FunctionCodeBlockGenerator::outOfLineJumpOffset):

  • wasm/WasmFunctionCodeBlockGenerator.h:

(JSC::Wasm::FunctionCodeBlockGenerator::constantRegisters const):
(JSC::Wasm::FunctionCodeBlockGenerator::instructions const):
(JSC::Wasm::FunctionCodeBlockGenerator::addJumpTarget):
(JSC::Wasm::FunctionCodeBlockGenerator::numberOfJumpTargets):
(JSC::Wasm::FunctionCodeBlockGenerator::lastJumpTarget):
(JSC::Wasm::FunctionCodeBlockGenerator::outOfLineJumpOffset):
(JSC::Wasm::FunctionCodeBlockGenerator::bytecodeOffset):
(JSC::Wasm::FunctionCodeBlockGenerator::tierUpCounter):

  • wasm/WasmGeneratorTraits.h:
  • wasm/WasmLLIntGenerator.cpp:

(JSC::Wasm::LLIntGenerator::addSwitch):
(JSC::GenericLabel<Wasm::GeneratorTraits>::setLocation):

  • wasm/WasmLLIntTierUpCounter.cpp:

(JSC::Wasm::LLIntTierUpCounter::addOSREntryDataForLoop):
(JSC::Wasm::LLIntTierUpCounter::osrEntryDataForLoop const const):

  • wasm/WasmLLIntTierUpCounter.h:

(JSC::Wasm::LLIntTierUpCounter::LLIntTierUpCounter):

  • wasm/WasmSlowPaths.cpp:

(JSC::LLInt::WASM_SLOW_PATH_DECL):
(JSC::LLInt::slow_path_wasm_throw_exception):
(JSC::LLInt::slow_path_wasm_popcount):
(JSC::LLInt::slow_path_wasm_popcountll):

  • wasm/WasmSlowPaths.h:
  • Property svn:eol-style set to native
File size: 8.5 KB
Line 
1/*
2 * Copyright (C) 2009-2021 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Patrick Gansterer <[email protected]>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include "config.h"
28
29#if ENABLE(JIT)
30#if USE(JSVALUE32_64)
31#include "JIT.h"
32
33#include "BasicBlockLocation.h"
34#include "BytecodeGenerator.h"
35#include "BytecodeStructs.h"
36#include "InterpreterInlines.h"
37#include "JITInlines.h"
38#include "JSFunction.h"
39#include "SlowPathCall.h"
40#include "TypeProfilerLog.h"
41#include "VirtualRegister.h"
42
43namespace JSC {
44
45void JIT::compileOpEqCommon(VirtualRegister src1, VirtualRegister src2)
46{
47 emitGetVirtualRegister(src1, jsRegT10);
48 emitGetVirtualRegister(src2, jsRegT32);
49 addSlowCase(branch32(NotEqual, jsRegT10.tagGPR(), jsRegT32.tagGPR()));
50 addSlowCase(branchIfCell(jsRegT10));
51 addSlowCase(branch32(Below, jsRegT10.tagGPR(), TrustedImm32(JSValue::LowestTag)));
52}
53
54void JIT::compileOpEqSlowCommon(Vector<SlowCaseEntry>::iterator& iter)
55{
56 JumpList genericCase;
57
58 genericCase.append(getSlowCase(iter)); // tags not equal
59
60 linkSlowCase(iter); // tags equal and JSCell
61 genericCase.append(branchIfNotString(jsRegT10.payloadGPR()));
62 genericCase.append(branchIfNotString(jsRegT32.payloadGPR()));
63
64 // String case.
65 loadGlobalObject(regT4);
66 callOperation(operationCompareStringEq, regT4, jsRegT10.payloadGPR(), jsRegT32.payloadGPR());
67 Jump done = jump();
68
69 // Generic case.
70 genericCase.append(getSlowCase(iter)); // doubles
71 genericCase.link(this);
72 loadGlobalObject(regT4);
73 callOperation(operationCompareEq, regT4, jsRegT10, jsRegT32);
74
75 done.link(this);
76}
77
78void JIT::emit_op_eq(const JSInstruction* currentInstruction)
79{
80 auto bytecode = currentInstruction->as<OpEq>();
81
82 compileOpEqCommon(bytecode.m_lhs, bytecode.m_rhs);
83
84 compare32(Equal, jsRegT10.payloadGPR(), jsRegT32.payloadGPR(), regT0);
85 boxBoolean(regT0, jsRegT10);
86 emitPutVirtualRegister(bytecode.m_dst, jsRegT10);
87}
88
89void JIT::emit_op_neq(const JSInstruction* currentInstruction)
90{
91 auto bytecode = currentInstruction->as<OpNeq>();
92
93 compileOpEqCommon(bytecode.m_lhs, bytecode.m_rhs);
94
95 compare32(NotEqual, jsRegT10.payloadGPR(), jsRegT32.payloadGPR(), regT0);
96 boxBoolean(regT0, jsRegT10);
97 emitPutVirtualRegister(bytecode.m_dst, jsRegT10);
98}
99
100void JIT::emit_op_jeq(const JSInstruction* currentInstruction)
101{
102 auto bytecode = currentInstruction->as<OpJeq>();
103 unsigned target = jumpTarget(currentInstruction, bytecode.m_targetLabel);
104
105 compileOpEqCommon(bytecode.m_lhs, bytecode.m_rhs);
106
107 addJump(branch32(Equal, jsRegT10.payloadGPR(), jsRegT32.payloadGPR()), target);
108}
109
110void JIT::emit_op_jneq(const JSInstruction* currentInstruction)
111{
112 auto bytecode = currentInstruction->as<OpJneq>();
113 unsigned target = jumpTarget(currentInstruction, bytecode.m_targetLabel);
114
115 compileOpEqCommon(bytecode.m_lhs, bytecode.m_rhs);
116
117 addJump(branch32(NotEqual, jsRegT10.payloadGPR(), jsRegT32.payloadGPR()), target);
118}
119
120void JIT::emitSlow_op_eq(const JSInstruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
121{
122 auto bytecode = currentInstruction->as<OpEq>();
123
124 compileOpEqSlowCommon(iter);
125
126 boxBoolean(returnValueGPR, returnValueJSR);
127 emitPutVirtualRegister(bytecode.m_dst, returnValueJSR);
128}
129
130void JIT::emitSlow_op_neq(const JSInstruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
131{
132 auto bytecode = currentInstruction->as<OpNeq>();
133
134 compileOpEqSlowCommon(iter);
135
136 xor32(TrustedImm32(1), returnValueGPR);
137 boxBoolean(returnValueGPR, returnValueJSR);
138 emitPutVirtualRegister(bytecode.m_dst, returnValueJSR);
139}
140
141void JIT::emitSlow_op_jeq(const JSInstruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
142{
143 auto bytecode = currentInstruction->as<OpJeq>();
144 unsigned target = jumpTarget(currentInstruction, bytecode.m_targetLabel);
145
146 compileOpEqSlowCommon(iter);
147
148 emitJumpSlowToHot(branchTest32(NonZero, returnValueGPR), target);
149}
150
151void JIT::emitSlow_op_jneq(const JSInstruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
152{
153 auto bytecode = currentInstruction->as<OpJneq>();
154 unsigned target = jumpTarget(currentInstruction, bytecode.m_targetLabel);
155
156 compileOpEqSlowCommon(iter);
157
158 emitJumpSlowToHot(branchTest32(Zero, returnValueGPR), target);
159}
160
161void JIT::compileOpStrictEqCommon(VirtualRegister src1, VirtualRegister src2)
162{
163 emitGetVirtualRegister(src1, jsRegT10);
164 emitGetVirtualRegister(src2, jsRegT32);
165
166 // Bail if the tags differ, or are double.
167 addSlowCase(branch32(NotEqual, jsRegT10.tagGPR(), jsRegT32.tagGPR()));
168 addSlowCase(branch32(Below, jsRegT10.tagGPR(), TrustedImm32(JSValue::LowestTag)));
169
170 // Jump to a slow case if both are strings or symbols (non object).
171 Jump notCell = branchIfNotCell(jsRegT10);
172 Jump firstIsObject = branchIfObject(jsRegT10.payloadGPR());
173 addSlowCase(branchIfNotObject(jsRegT32.payloadGPR()));
174 notCell.link(this);
175 firstIsObject.link(this);
176}
177
178void JIT::emit_op_stricteq(const JSInstruction* currentInstruction)
179{
180 auto bytecode = currentInstruction->as<OpStricteq>();
181 compileOpStrictEqCommon(bytecode.m_lhs, bytecode.m_rhs);
182
183 compare32(Equal, jsRegT10.payloadGPR(), jsRegT32.payloadGPR(), regT0);
184
185 boxBoolean(regT0, jsRegT10);
186 emitPutVirtualRegister(bytecode.m_dst, jsRegT10);
187}
188
189void JIT::emit_op_nstricteq(const JSInstruction* currentInstruction)
190{
191 auto bytecode = currentInstruction->as<OpNstricteq>();
192 compileOpStrictEqCommon(bytecode.m_lhs, bytecode.m_rhs);
193
194 compare32(NotEqual, jsRegT10.payloadGPR(), jsRegT32.payloadGPR(), regT0);
195
196 boxBoolean(regT0, jsRegT10);
197 emitPutVirtualRegister(bytecode.m_dst, jsRegT10);
198}
199
200void JIT::emit_op_jstricteq(const JSInstruction* currentInstruction)
201{
202 auto bytecode = currentInstruction->as<OpJstricteq>();
203 int target = jumpTarget(currentInstruction, bytecode.m_targetLabel);
204
205 compileOpStrictEqCommon(bytecode.m_lhs, bytecode.m_rhs);
206
207 addJump(branch32(Equal, jsRegT10.payloadGPR(), jsRegT32.payloadGPR()), target);
208}
209
210void JIT::emit_op_jnstricteq(const JSInstruction* currentInstruction)
211{
212 auto bytecode = currentInstruction->as<OpJnstricteq>();
213 int target = jumpTarget(currentInstruction, bytecode.m_targetLabel);
214
215 compileOpStrictEqCommon(bytecode.m_lhs, bytecode.m_rhs);
216
217 addJump(branch32(NotEqual, jsRegT10.payloadGPR(), jsRegT32.payloadGPR()), target);
218}
219
220void JIT::emitSlow_op_jstricteq(const JSInstruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
221{
222 linkAllSlowCases(iter);
223
224 auto bytecode = currentInstruction->as<OpJstricteq>();
225 unsigned target = jumpTarget(currentInstruction, bytecode.m_targetLabel);
226 loadGlobalObject(regT4);
227 callOperation(operationCompareStrictEq, regT4, jsRegT10, jsRegT32);
228 emitJumpSlowToHot(branchTest32(NonZero, returnValueGPR), target);
229}
230
231void JIT::emitSlow_op_jnstricteq(const JSInstruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter)
232{
233 linkAllSlowCases(iter);
234
235 auto bytecode = currentInstruction->as<OpJnstricteq>();
236 unsigned target = jumpTarget(currentInstruction, bytecode.m_targetLabel);
237 loadGlobalObject(regT4);
238 callOperation(operationCompareStrictEq, regT4, jsRegT10, jsRegT32);
239 emitJumpSlowToHot(branchTest32(Zero, returnValueGPR), target);
240}
241
242} // namespace JSC
243
244#endif // USE(JSVALUE32_64)
245#endif // ENABLE(JIT)
Note: See TracBrowser for help on using the repository browser.