Changeset 205321 in webkit
- Timestamp:
- Sep 1, 2016 3:08:22 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r205317 r205321 1 2016-09-01 JF Bastien <jfbastien@apple.com> 2 3 GetByIdWithThis/GetByValWithThis should have ValueProfiles so that they can predict their result types 4 https://bugs.webkit.org/show_bug.cgi?id=160922 5 6 Reviewed by Keith Miller. 7 8 Benchmark GetBy{Id,Val}WithThis in monomorphic and polymorphic uses. 9 The value profile is used by the calc functions, which do some mild math with the result. 10 These benchmarks get ~4% faster with value profiling. 11 12 * microbenchmarks/super-get-by-id-with-this-monomorphic.js: Added. 13 (A): 14 (A.prototype.set value): 15 (A.prototype.get value): 16 (B.prototype.set value): 17 (B.prototype.get value): 18 (B): 19 (const.bench): 20 * microbenchmarks/super-get-by-id-with-this-polymorphic.js: Added. 21 (A): 22 (A.prototype.set value): 23 (A.prototype.get value): 24 (B.prototype.set value): 25 (B.prototype.get value): 26 (B): 27 (const.bench): 28 * microbenchmarks/super-get-by-val-with-this-monomorphic.js: Added. 29 (value): 30 (A): 31 (A.prototype.set v): 32 (A.prototype.get v): 33 (B.prototype.set v): 34 (B.prototype.get v): 35 (B): 36 (const.bench): 37 * microbenchmarks/super-get-by-val-with-this-polymorphic.js: Added. 38 (value): 39 (A): 40 (A.prototype.set v): 41 (A.prototype.get v): 42 (B.prototype.set v): 43 (B.prototype.get v): 44 (B): 45 (const.bench): 46 1 47 2016-09-01 Benjamin Poulain <bpoulain@apple.com> 2 48 -
trunk/Source/JavaScriptCore/ChangeLog
r205309 r205321 1 2016-09-01 JF Bastien <jfbastien@apple.com> 2 3 GetByIdWithThis/GetByValWithThis should have ValueProfiles so that they can predict their result types 4 https://bugs.webkit.org/show_bug.cgi?id=160922 5 6 Reviewed by Keith Miller. 7 8 Add value profiling to GetBy{Id,Val}WithThis. 9 10 * bytecode/BytecodeList.json: 11 * bytecode/CodeBlock.cpp: 12 (JSC::CodeBlock::dumpBytecode): 13 (JSC::CodeBlock::finishCreation): 14 * bytecompiler/BytecodeGenerator.cpp: 15 (JSC::BytecodeGenerator::emitGetById): 16 (JSC::BytecodeGenerator::emitGetByVal): 17 * dfg/DFGByteCodeParser.cpp: 18 (JSC::DFG::ByteCodeParser::parseBlock): 19 * dfg/DFGNode.h: 20 (JSC::DFG::Node::hasHeapPrediction): 21 * dfg/DFGPredictionPropagationPhase.cpp: 22 * llint/LowLevelInterpreter.asm: 23 * runtime/CommonSlowPaths.cpp: 24 (JSC::SLOW_PATH_DECL): 25 1 26 2016-09-01 Keith Miller <keith_miller@apple.com> 2 27 -
trunk/Source/JavaScriptCore/bytecode/BytecodeList.json
r204994 r205321 66 66 { "name" : "op_get_by_id_proto_load", "length" : 9 }, 67 67 { "name" : "op_get_by_id_unset", "length" : 9 }, 68 { "name" : "op_get_by_id_with_this", "length" : 5},69 { "name" : "op_get_by_val_with_this", "length" : 5},68 { "name" : "op_get_by_id_with_this", "length" : 6 }, 69 { "name" : "op_get_by_val_with_this", "length" : 6 }, 70 70 { "name" : "op_try_get_by_id", "length" : 5 }, 71 71 { "name" : "op_put_by_id", "length" : 9 }, -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r204994 r205321 1150 1150 int id0 = (++it)->u.operand; 1151 1151 out.printf("%s, %s, %s, %s", registerName(r0).data(), registerName(r1).data(), registerName(r2).data(), idName(id0, identifier(id0)).data()); 1152 dumpValueProfiling(out, it, hasPrintedProfiling); 1152 1153 break; 1153 1154 } … … 1159 1160 printLocationAndOp(out, exec, location, it, "get_by_val_with_this"); 1160 1161 out.printf("%s, %s, %s, %s", registerName(r0).data(), registerName(r1).data(), registerName(r2).data(), registerName(r3).data()); 1162 dumpValueProfiling(out, it, hasPrintedProfiling); 1161 1163 break; 1162 1164 } … … 2077 2079 case op_get_direct_pname: 2078 2080 case op_get_by_id: 2081 case op_get_by_id_with_this: 2079 2082 case op_try_get_by_id: 2083 case op_get_by_val_with_this: 2080 2084 case op_get_from_arguments: 2081 2085 case op_to_number: { -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r204994 r205321 2493 2493 ASSERT_WITH_MESSAGE(!parseIndex(property), "Indexed properties should be handled with get_by_val."); 2494 2494 2495 emitOpcode(op_get_by_id_with_this);2495 UnlinkedValueProfile profile = emitProfiledOpcode(op_get_by_id_with_this); 2496 2496 instructions().append(kill(dst)); 2497 2497 instructions().append(base->index()); 2498 2498 instructions().append(thisVal->index()); 2499 2499 instructions().append(addConstant(property)); 2500 instructions().append(profile); 2500 2501 return dst; 2501 2502 } … … 2665 2666 RegisterID* BytecodeGenerator::emitGetByVal(RegisterID* dst, RegisterID* base, RegisterID* thisValue, RegisterID* property) 2666 2667 { 2667 emitOpcode(op_get_by_val_with_this);2668 UnlinkedValueProfile profile = emitProfiledOpcode(op_get_by_val_with_this); 2668 2669 instructions().append(kill(dst)); 2669 2670 instructions().append(base->index()); 2670 2671 instructions().append(thisValue->index()); 2671 2672 instructions().append(property->index()); 2673 instructions().append(profile); 2672 2674 return dst; 2673 2675 } -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r204992 r205321 4130 4130 4131 4131 case op_get_by_val_with_this: { 4132 SpeculatedType prediction = getPrediction(); 4133 4132 4134 Node* base = get(VirtualRegister(currentInstruction[2].u.operand)); 4133 4135 Node* thisValue = get(VirtualRegister(currentInstruction[3].u.operand)); 4134 4136 Node* property = get(VirtualRegister(currentInstruction[4].u.operand)); 4135 Node* getByValWithThis = addToGraph(GetByValWithThis, base, thisValue, property);4137 Node* getByValWithThis = addToGraph(GetByValWithThis, OpInfo(prediction), base, thisValue, property); 4136 4138 set(VirtualRegister(currentInstruction[1].u.operand), getByValWithThis); 4137 4139 … … 4227 4229 } 4228 4230 case op_get_by_id_with_this: { 4231 SpeculatedType prediction = getPrediction(); 4232 4229 4233 Node* base = get(VirtualRegister(currentInstruction[2].u.operand)); 4230 4234 Node* thisValue = get(VirtualRegister(currentInstruction[3].u.operand)); … … 4232 4236 4233 4237 set(VirtualRegister(currentInstruction[1].u.operand), 4234 addToGraph(GetByIdWithThis, OpInfo(identifierNumber), base, thisValue));4238 addToGraph(GetByIdWithThis, OpInfo(identifierNumber), OpInfo(prediction), base, thisValue)); 4235 4239 4236 4240 NEXT_OPCODE(op_get_by_id_with_this); -
trunk/Source/JavaScriptCore/dfg/DFGNode.h
r205112 r205321 1396 1396 case GetById: 1397 1397 case GetByIdFlush: 1398 case GetByIdWithThis: 1398 1399 case TryGetById: 1399 1400 case GetByVal: 1401 case GetByValWithThis: 1400 1402 case Call: 1401 1403 case TailCallInlinedCaller: -
trunk/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
r205112 r205321 681 681 } 682 682 683 case GetByValWithThis:684 case GetByIdWithThis: {685 setPrediction(SpecBytecodeTop);686 break;687 }688 683 case ArrayPop: 689 684 case ArrayPush: … … 694 689 case GetById: 695 690 case GetByIdFlush: 691 case GetByIdWithThis: 696 692 case TryGetById: 693 case GetByValWithThis: 697 694 case GetByOffset: 698 695 case MultiGetByOffset: -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r204994 r205321 1807 1807 traceExecution() 1808 1808 callOpcodeSlowPath(_slow_path_get_by_id_with_this) 1809 dispatch( 5)1809 dispatch(6) 1810 1810 1811 1811 _llint_op_get_by_val_with_this: 1812 1812 traceExecution() 1813 1813 callOpcodeSlowPath(_slow_path_get_by_val_with_this) 1814 dispatch( 5)1814 dispatch(6) 1815 1815 1816 1816 _llint_op_put_by_id_with_this: -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r205198 r205321 829 829 PropertySlot slot(thisVal, PropertySlot::PropertySlot::InternalMethodType::Get); 830 830 JSValue result = baseValue.get(exec, ident, slot); 831 RETURN (result);831 RETURN_PROFILED(op_get_by_id_with_this, result); 832 832 } 833 833 … … 846 846 if (RefPtr<AtomicStringImpl> existingAtomicString = asString(subscript)->toExistingAtomicString(exec)) { 847 847 if (JSValue result = baseValue.asCell()->fastGetOwnProperty(vm, structure, existingAtomicString.get())) 848 RETURN (result);848 RETURN_PROFILED(op_get_by_val_with_this, result); 849 849 } 850 850 } … … 855 855 uint32_t i = subscript.asUInt32(); 856 856 if (isJSString(baseValue) && asString(baseValue)->canGetIndex(i)) 857 RETURN (asString(baseValue)->getIndex(exec, i));857 RETURN_PROFILED(op_get_by_val_with_this, asString(baseValue)->getIndex(exec, i)); 858 858 859 RETURN (baseValue.get(exec, i, slot));859 RETURN_PROFILED(op_get_by_val_with_this, baseValue.get(exec, i, slot)); 860 860 } 861 861 … … 864 864 auto property = subscript.toPropertyKey(exec); 865 865 CHECK_EXCEPTION(); 866 RETURN (baseValue.get(exec, property, slot));866 RETURN_PROFILED(op_get_by_val_with_this, baseValue.get(exec, property, slot)); 867 867 } 868 868
Note: See TracChangeset
for help on using the changeset viewer.