Changeset 283096 in webkit
- Timestamp:
- Sep 26, 2021, 9:25:46 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r283095 r283096 1 2021-09-26 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, reverting r283095. 4 https://bugs.webkit.org/show_bug.cgi?id=230815 5 6 We should land the original patch since this does not work 7 with bytecode cache 8 9 Reverted changeset: 10 11 "[JSC] Optimize PutByVal with for-in" 12 https://bugs.webkit.org/show_bug.cgi?id=230801 13 https://commits.webkit.org/r283095 14 1 15 2021-09-26 Yusuke Suzuki <ysuzuki@apple.com> 2 16 -
trunk/Source/JavaScriptCore/ChangeLog
r283095 r283096 1 2021-09-26 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, reverting r283095. 4 https://bugs.webkit.org/show_bug.cgi?id=230815 5 6 We should land the original patch since this does not work 7 with bytecode cache 8 9 Reverted changeset: 10 11 "[JSC] Optimize PutByVal with for-in" 12 https://bugs.webkit.org/show_bug.cgi?id=230801 13 https://commits.webkit.org/r283095 14 1 15 2021-09-26 Yusuke Suzuki <ysuzuki@apple.com> 2 16 -
trunk/Source/JavaScriptCore/builtins/BuiltinNames.h
r283095 r283096 183 183 macro(entries) \ 184 184 macro(outOfLineReactionCounts) \ 185 macro(emptyPropertyNameEnumerator) \185 macro(emptyPropertyNameEnumerator) 186 186 187 187 -
trunk/Source/JavaScriptCore/bytecode/BytecodeList.rb
r283095 r283096 760 760 args: { 761 761 value: VirtualRegister, 762 targetLabel: BoundLabel,763 }764 765 op :jeq_ptr,766 args: {767 value: VirtualRegister,768 specialPointer: VirtualRegister,769 762 targetLabel: BoundLabel, 770 763 } -
trunk/Source/JavaScriptCore/bytecode/BytecodeUseDef.cpp
r283095 r283096 81 81 case op_new_regexp: 82 82 case op_debug: 83 case op_jneq_ptr: 83 84 case op_loop_hint: 84 85 case op_jmp: … … 135 136 USES(OpJbelow, lhs, rhs) 136 137 USES(OpJbeloweq, lhs, rhs) 137 USES(OpJeqPtr, value, specialPointer)138 USES(OpJneqPtr, value, specialPointer)139 140 138 USES(OpSetFunctionName, function, name) 141 139 USES(OpLogShadowChickenTail, thisValue, scope) … … 368 366 case op_jundefined_or_null: 369 367 case op_jnundefined_or_null: 370 case op_jeq_ptr:371 368 case op_jneq_ptr: 372 369 case op_jless: -
trunk/Source/JavaScriptCore/bytecode/Opcode.h
r283095 r283096 200 200 case op_jundefined_or_null: 201 201 case op_jnundefined_or_null: 202 case op_jeq_ptr:203 202 case op_jneq_ptr: 204 203 case op_jless: -
trunk/Source/JavaScriptCore/bytecode/PreciseJumpTargetsInlines.h
r283095 r283096 44 44 CASE_OP(OpJundefinedOrNull) \ 45 45 CASE_OP(OpJnundefinedOrNull) \ 46 CASE_OP(OpJeqPtr) \47 46 CASE_OP(OpJneqPtr) \ 48 47 \ -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r283095 r283096 106 106 CASE(OpJstricteq) 107 107 CASE(OpJneq) 108 CASE(OpJeqPtr)109 108 CASE(OpJneqPtr) 110 109 CASE(OpJnstricteq) … … 1497 1496 { 1498 1497 OpJneqPtr::emit(this, cond, moveLinkTimeConstant(nullptr, LinkTimeConstant::applyFunction), target.bind(this)); 1499 }1500 1501 void BytecodeGenerator::emitJumpIfSentinelString(RegisterID* cond, Label& target)1502 {1503 OpJeqPtr::emit(this, cond, emitLoad(nullptr, JSValue(vm().smallStrings.sentinelString())), target.bind(this));1504 1498 } 1505 1499 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r283095 r283096 859 859 void emitJumpIfNotFunctionCall(RegisterID* cond, Label& target); 860 860 void emitJumpIfNotFunctionApply(RegisterID* cond, Label& target); 861 void emitJumpIfSentinelString(RegisterID* cond, Label& target);862 861 unsigned emitWideJumpIfNotFunctionHasOwnProperty(RegisterID* cond, Label& target); 863 862 void recordHasOwnPropertyInForInLoop(ForInContext&, unsigned branchOffset, Label& genericPath); -
trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
r283095 r283096 4228 4228 // FIXME: We should have a way to see if anyone is actually using the propertyName for something other than a get_by_val. If not, we could eliminate the toString in this opcode. 4229 4229 generator.emitEnumeratorNext(propertyName.get(), mode.get(), index.get(), base.get(), enumerator.get()); 4230 generator.emitJumpIfSentinelString(propertyName.get(), scope->breakTarget()); 4230 4231 // Note, choosing undefined or null helps please DFG's Abstract Interpreter as it doesn't distinguish null and undefined as types (via SpecOther). 4232 generator.emitJumpIfTrue(generator.emitIsUndefinedOrNull(generator.newTemporary(), propertyName.get()), scope->breakTarget()); 4231 4233 4232 4234 this->emitLoopHeader(generator, propertyName.get()); -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r283095 r283096 4324 4324 4325 4325 case EnumeratorNextUpdatePropertyName: { 4326 setTypeForNode(node, SpecString Ident);4326 setTypeForNode(node, SpecString | SpecOther); 4327 4327 break; 4328 4328 } -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r283095 r283096 7631 7631 7632 7632 NEXT_OPCODE(op_iterator_next); 7633 }7634 7635 case op_jeq_ptr: {7636 auto bytecode = currentInstruction->as<OpJeqPtr>();7637 FrozenValue* frozenPointer = m_graph.freezeStrong(m_inlineStackTop->m_codeBlock->getConstant(bytecode.m_specialPointer));7638 unsigned relativeOffset = jumpTarget(bytecode.m_targetLabel);7639 Node* child = get(bytecode.m_value);7640 Node* condition = addToGraph(CompareEqPtr, OpInfo(frozenPointer), child);7641 addToGraph(Branch, OpInfo(branchData(m_currentIndex.offset() + relativeOffset, m_currentIndex.offset() + currentInstruction->size())), condition);7642 LAST_OPCODE(op_jeq_ptr);7643 7633 } 7644 7634 -
trunk/Source/JavaScriptCore/dfg/DFGCapabilities.cpp
r283095 r283096 241 241 case op_put_to_arguments: 242 242 case op_get_argument: 243 case op_jeq_ptr:244 243 case op_jneq_ptr: 245 244 case op_typeof: -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r283095 r283096 87 87 88 88 template<bool strict, bool direct> 89 static ALWAYS_INLINEvoid putByVal(JSGlobalObject* globalObject, VM& vm, JSValue baseValue, uint32_t index, JSValue value)89 static inline void putByVal(JSGlobalObject* globalObject, VM& vm, JSValue baseValue, uint32_t index, JSValue value) 90 90 { 91 91 ASSERT(isIndex(index)); 92 if constexpr(direct) {92 if (direct) { 93 93 RELEASE_ASSERT(baseValue.isObject()); 94 94 asObject(baseValue)->putDirectIndex(globalObject, index, value, 0, strict ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); … … 129 129 130 130 PutPropertySlot slot(baseValue, strict); 131 if constexpr(direct) {131 if (direct) { 132 132 RELEASE_ASSERT(baseValue.isObject()); 133 133 JSObject* baseObject = asObject(baseValue); … … 149 149 { 150 150 PutPropertySlot slot(base, strict); 151 if constexpr(direct) {151 if (direct) { 152 152 RELEASE_ASSERT(base->isObject()); 153 153 JSObject* baseObject = asObject(base); … … 2487 2487 } 2488 2488 2489 JSC_DEFINE_JIT_OPERATION(operationEnumeratorNextUpdatePropertyName, JSString*, (JSGlobalObject* globalObject, uint32_t index, int32_t modeNumber, JSPropertyNameEnumerator* enumerator))2489 JSC_DEFINE_JIT_OPERATION(operationEnumeratorNextUpdatePropertyName, EncodedJSValue, (JSGlobalObject* globalObject, uint32_t index, int32_t modeNumber, JSPropertyNameEnumerator* enumerator)) 2490 2490 { 2491 2491 VM& vm = globalObject->vm(); … … 2495 2495 if (modeNumber == JSPropertyNameEnumerator::IndexedMode) { 2496 2496 if (index < enumerator->indexedLength()) 2497 return jsString(vm, Identifier::from(vm, index).string());2498 return vm.smallStrings.sentinelString();2497 return JSValue::encode(jsString(vm, Identifier::from(vm, index).string())); 2498 return JSValue::encode(jsNull()); 2499 2499 } 2500 2500 2501 2501 JSString* result = enumerator->propertyNameAtIndex(index); 2502 2502 if (!result) 2503 return vm.smallStrings.sentinelString();2504 2505 return result;2503 return JSValue::encode(jsNull()); 2504 2505 return JSValue::encode(result); 2506 2506 } 2507 2507 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.h
r283095 r283096 109 109 JSC_DECLARE_JIT_OPERATION(operationGetPropertyEnumeratorCell, JSCell*, (JSGlobalObject*, JSCell*)); 110 110 JSC_DECLARE_JIT_OPERATION(operationEnumeratorNextUpdateIndexAndMode, EncodedJSValue, (JSGlobalObject*, EncodedJSValue, uint32_t, int32_t, JSPropertyNameEnumerator*)); 111 JSC_DECLARE_JIT_OPERATION(operationEnumeratorNextUpdatePropertyName, JSString*, (JSGlobalObject*, uint32_t, int32_t, JSPropertyNameEnumerator*));111 JSC_DECLARE_JIT_OPERATION(operationEnumeratorNextUpdatePropertyName, EncodedJSValue, (JSGlobalObject*, uint32_t, int32_t, JSPropertyNameEnumerator*)); 112 112 JSC_DECLARE_JIT_OPERATION(operationEnumeratorInByVal, EncodedJSValue, (JSGlobalObject*, EncodedJSValue, EncodedJSValue, uint32_t, int32_t)); 113 113 JSC_DECLARE_JIT_OPERATION(operationEnumeratorHasOwnProperty, EncodedJSValue, (JSGlobalObject*, EncodedJSValue, EncodedJSValue, uint32_t, int32_t)); -
trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
r283095 r283096 1234 1234 1235 1235 case EnumeratorNextUpdatePropertyName: { 1236 setPrediction(SpecString Ident);1236 setPrediction(SpecString | SpecOther); 1237 1237 break; 1238 1238 } -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r283095 r283096 13647 13647 SpeculateStrictInt32Operand modeOperand(this, node->child2()); 13648 13648 SpeculateCellOperand enumeratorOperand(this, node->child3()); 13649 GPRTemporary result(this);13649 JSValueRegsTemporary resultTemp(this); 13650 13650 13651 13651 GPRReg index = indexOperand.gpr(); 13652 13652 GPRReg mode = modeOperand.gpr(); 13653 13653 GPRReg enumerator = enumeratorOperand.gpr(); 13654 GPRReg resultGPR = result.gpr();13654 JSValueRegs resultRegs = resultTemp.regs(); 13655 13655 13656 13656 OptionSet seenModes = node->enumeratorMetadata(); … … 13668 13668 auto outOfBounds = m_jit.branch32(MacroAssembler::AboveOrEqual, index, MacroAssembler::Address(enumerator, JSPropertyNameEnumerator::endGenericPropertyIndexOffset())); 13669 13669 13670 m_jit.loadPtr(MacroAssembler::Address(enumerator, JSPropertyNameEnumerator::cachedPropertyNamesVectorOffset()), resultGPR); 13671 m_jit.loadPtr(MacroAssembler::BaseIndex(resultGPR, index, MacroAssembler::ScalePtr), resultGPR); 13670 m_jit.loadPtr(MacroAssembler::Address(enumerator, JSPropertyNameEnumerator::cachedPropertyNamesVectorOffset()), resultRegs.payloadGPR()); 13671 m_jit.loadPtr(MacroAssembler::BaseIndex(resultRegs.payloadGPR(), index, MacroAssembler::ScalePtr), resultRegs.payloadGPR()); 13672 #if USE(JSVALUE32_64) 13673 m_jit.move(TrustedImm32(JSValue::CellTag), resultRegs.tagGPR()); 13674 #endif 13672 13675 doneCases.append(m_jit.jump()); 13673 13676 13674 13677 outOfBounds.link(&m_jit); 13675 m_jit.move (TrustedImmPtr::weakPointer(m_graph, vm().smallStrings.sentinelString()), resultGPR);13678 m_jit.moveTrustedValue(jsNull(), resultRegs); 13676 13679 doneCases.append(m_jit.jump()); 13677 13680 operationCall.link(&m_jit); 13678 13681 } 13679 13682 13680 callOperation(operationEnumeratorNextUpdatePropertyName, result GPR, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), index, mode, enumerator);13683 callOperation(operationEnumeratorNextUpdatePropertyName, resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), index, mode, enumerator); 13681 13684 m_jit.exceptionCheck(); 13682 13685 13683 13686 doneCases.link(&m_jit); 13684 cellResult(resultGPR, node);13687 jsValueResult(resultRegs, node); 13685 13688 } 13686 13689 -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r283095 r283096 13527 13527 { 13528 13528 m_out.appendTo(outOfBoundsBlock); 13529 results.append(m_out.anchor( weakPointer(vm().smallStrings.sentinelString())));13529 results.append(m_out.anchor(m_out.constInt64(JSValue::encode(jsNull())))); 13530 13530 m_out.jump(continuation); 13531 13531 } … … 13534 13534 m_out.appendTo(loadPropertyNameBlock); 13535 13535 LValue namesVector = m_out.loadPtr(enumerator, m_heaps.JSPropertyNameEnumerator_cachedPropertyNamesVector); 13536 results.append(m_out.anchor(m_out. loadPtr(m_out.baseIndex(m_heaps.WriteBarrierBuffer_bufferContents.atAnyIndex(), namesVector, m_out.zeroExt(index, Int64), ScalePtr))));13536 results.append(m_out.anchor(m_out.zeroExtPtr(m_out.loadPtr(m_out.baseIndex(m_heaps.WriteBarrierBuffer_bufferContents.atAnyIndex(), namesVector, m_out.zeroExt(index, Int64), ScalePtr))))); 13537 13537 m_out.jump(continuation); 13538 13538 } … … 13542 13542 m_out.appendTo(operationBlock); 13543 13543 // Note: We can't omit the operation because we have no guarantee that the mode will match what we profiled. 13544 results.append(m_out.anchor(vmCall( pointerType(), operationEnumeratorNextUpdatePropertyName, weakPointer(globalObject), index, mode, enumerator)));13544 results.append(m_out.anchor(vmCall(Int64, operationEnumeratorNextUpdatePropertyName, weakPointer(globalObject), index, mode, enumerator))); 13545 13545 if (continuation) { 13546 13546 m_out.jump(continuation); … … 13549 13549 13550 13550 ASSERT(results.size()); 13551 LValue result = m_out.phi( pointerType(), results);13551 LValue result = m_out.phi(Int64, results); 13552 13552 setJSValue(result); 13553 13553 } -
trunk/Source/JavaScriptCore/jit/JIT.cpp
r283095 r283096 388 388 DEFINE_OP(op_jundefined_or_null) 389 389 DEFINE_OP(op_jnundefined_or_null) 390 DEFINE_OP(op_jeq_ptr)391 390 DEFINE_OP(op_jneq_ptr) 392 391 DEFINE_OP(op_jless) -
trunk/Source/JavaScriptCore/jit/JIT.h
r283095 r283096 462 462 void emit_op_jundefined_or_null(const Instruction*); 463 463 void emit_op_jnundefined_or_null(const Instruction*); 464 void emit_op_jeq_ptr(const Instruction*);465 464 void emit_op_jneq_ptr(const Instruction*); 466 465 void emit_op_jless(const Instruction*); -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r283095 r283096 580 580 } 581 581 582 void JIT::emit_op_jeq_ptr(const Instruction* currentInstruction)583 {584 auto bytecode = currentInstruction->as<OpJeqPtr>();585 VirtualRegister src = bytecode.m_value;586 JSValue specialPointer = getConstantOperand(bytecode.m_specialPointer);587 ASSERT(specialPointer.isCell());588 unsigned target = jumpTarget(currentInstruction, bytecode.m_targetLabel);589 590 emitGetVirtualRegister(src, regT0);591 addJump(branchPtr(Equal, regT0, TrustedImmPtr(specialPointer.asCell())), target);592 }593 594 582 void JIT::emit_op_jneq_ptr(const Instruction* currentInstruction) 595 583 { -
trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
r283095 r283096 502 502 } 503 503 504 void JIT::emit_op_jeq_ptr(const Instruction* currentInstruction)505 {506 auto bytecode = currentInstruction->as<OpJeqPtr>();507 auto& metadata = bytecode.metadata(m_profiledCodeBlock);508 VirtualRegister src = bytecode.m_value;509 JSValue specialPointer = getConstantOperand(bytecode.m_specialPointer);510 ASSERT(specialPointer.isCell());511 unsigned target = jumpTarget(currentInstruction, bytecode.m_targetLabel);512 513 emitLoad(src, regT1, regT0);514 Jump notCell = branchIfNotCell(regT1);515 addJump(branchPtr(Equal, regT0, TrustedImmPtr(specialPointer.asCell())), target);516 notCell.link(this);517 }518 519 504 void JIT::emit_op_jneq_ptr(const Instruction* currentInstruction) 520 505 { -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r283095 r283096 2867 2867 2868 2868 outOfBounds.link(this); 2869 storeTrustedValue( vm().smallStrings.sentinelString(), addressFor(propertyName));2869 storeTrustedValue(jsNull(), addressFor(propertyName)); 2870 2870 done.append(jump()); 2871 2871 } -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r283095 r283096 1945 1945 macro (value, target) bineq value, NullTag, target end) 1946 1946 1947 llintOpWithReturn(op_jeq_ptr, OpJeqPtr, macro (size, get, dispatch, return)1948 get(m_value, t0)1949 get(m_specialPointer, t1)1950 loadConstant(size, t1, t3, t2)1951 bineq TagOffset[cfr, t0, 8], CellTag, .opJeqPtrFallThrough1952 bpneq PayloadOffset[cfr, t0, 8], t2, .opJeqPtrFallThrough1953 .opJeqPtrBranch:1954 get(m_targetLabel, t0)1955 jumpImpl(dispatchIndirect, t0)1956 .opJeqPtrFallThrough:1957 dispatch()1958 end)1959 1960 1961 1947 llintOpWithMetadata(op_jneq_ptr, OpJneqPtr, macro (size, get, dispatch, metadata, return) 1962 1948 get(m_value, t0) -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r283095 r283096 2072 2072 undefinedOrNullJumpOp(jnundefined_or_null, OpJnundefinedOrNull, 2073 2073 macro (value, target) bqneq value, ValueNull, target end) 2074 2075 llintOpWithReturn(op_jeq_ptr, OpJeqPtr, macro (size, get, dispatch, return)2076 get(m_value, t0)2077 get(m_specialPointer, t1)2078 loadConstant(size, t1, t2)2079 bpeq t2, [cfr, t0, 8], .opJeqPtrTarget2080 dispatch()2081 2082 .opJeqPtrTarget:2083 get(m_targetLabel, t0)2084 jumpImpl(dispatchIndirect, t0)2085 end)2086 2087 2074 2088 2075 llintOpWithMetadata(op_jneq_ptr, OpJneqPtr, macro (size, get, dispatch, metadata, return) -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r283095 r283096 1002 1002 modeRegister = jsNumber(static_cast<uint8_t>(mode)); 1003 1003 indexRegister = jsNumber(index); 1004 nameRegister = name ? name : vm.smallStrings.sentinelString();1004 nameRegister = name ? name : jsNull(); 1005 1005 END(); 1006 1006 } -
trunk/Source/JavaScriptCore/runtime/SmallStrings.cpp
r283095 r283096 63 63 initialize(&vm, m_timedOutString, "timed-out"); 64 64 initialize(&vm, m_okString, "ok"); 65 initialize(&vm, m_sentinelString, "$");66 65 67 66 setIsInitialized(true); … … 85 84 visitor.appendUnbarriered(m_timedOutString); 86 85 visitor.appendUnbarriered(m_okString); 87 visitor.appendUnbarriered(m_sentinelString);88 86 } 89 87 -
trunk/Source/JavaScriptCore/runtime/SmallStrings.h
r283095 r283096 120 120 JSString* timedOutString() const { return m_timedOutString; } 121 121 JSString* okString() const { return m_okString; } 122 JSString* sentinelString() const { return m_sentinelString; }123 122 124 123 bool needsToBeVisited(CollectionScope scope) const … … 145 144 JSString* m_timedOutString { nullptr }; 146 145 JSString* m_okString { nullptr }; 147 JSString* m_sentinelString { nullptr };148 146 JSString* m_singleCharacterStrings[singleCharacterStringCount] { nullptr }; 149 147 bool m_needsToBeVisited { true };
Note:
See TracChangeset
for help on using the changeset viewer.