Changeset 248710 in webkit
- Timestamp:
- Aug 14, 2019 11:39:28 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r248709 r248710 1 2019-08-14 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Air does not appropriately propagate ConstFloatValue to stackmap 4 https://bugs.webkit.org/show_bug.cgi?id=200759 5 6 Reviewed by Saam Barati. 7 8 In B3MoveConstant phase, we convert ConstFloatValue and ConstDoubleValue to memory access to the table 9 to avoid large immediates *except for* stackmap argument case. This is because materializing constant doubles 10 and floats as memory-access before passing it to stackmap is wasteful: the stackmap may not use it actually, or 11 stackmap can do better job if it knows the parameter is constant. 12 13 Based on the above operation, B3LowerToAir phase strongly assumes that all ConstFloatValue and ConstDoubleValue 14 are removed except for the case used for parameter of stackmap. With r192377, B3LowerToAir catch this case, and 15 propagate constant double value as ValueRep in stackmap. While B3LowerToAir does this correctly for ConstDoubleValue, 16 we missed adding this support for ConstFloatValue. 17 18 This patch adds r192377's support for ConstFloatValue to propagate ConstFloatValue correctly to the stackmap. 19 This issue starts appearing since Wasm BBQ-B3 OSR starts putting ConstFloatValue to OSR-tier-up patchpoint. 20 21 * b3/B3LowerToAir.cpp: 22 * b3/B3ValueKey.h: 23 (JSC::B3::ValueKey::ValueKey): 24 (JSC::B3::ValueKey::floatValue const): 25 * b3/B3ValueRep.h: 26 (JSC::B3::ValueRep::constantFloat): 27 (JSC::B3::ValueRep::floatValue const): 28 * b3/testb3.h: 29 * b3/testb3_1.cpp: 30 (run): 31 * b3/testb3_5.cpp: 32 (testPatchpointManyWarmAnyImms): 33 (testPatchpointManyColdAnyImms): 34 (testPatchpointManyImms): Deleted. 35 1 36 2019-08-14 Keith Rollin <krollin@apple.com> 2 37 -
trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp
r248178 r248710 1339 1339 commitInternal(value.value()); 1340 1340 arg = Arg::bigImm(bitwise_cast<int64_t>(value.value()->asDouble())); 1341 } else if (value.value()->hasFloat() && canBeInternal(value.value())) { 1342 commitInternal(value.value()); 1343 arg = Arg::bigImm(static_cast<uint64_t>(bitwise_cast<uint32_t>(value.value()->asFloat()))); 1341 1344 } else 1342 1345 arg = tmp(value.value()); -
trunk/Source/JavaScriptCore/b3/B3ValueKey.h
r248178 r248710 81 81 , m_type(type) 82 82 { 83 // This means that upper 32bit of u.value is 0. 83 84 u.floatValue = value; 84 85 } … … 93 94 int64_t value() const { return u.value; } 94 95 double doubleValue() const { return u.doubleValue; } 95 doublefloatValue() const { return u.floatValue; }96 float floatValue() const { return u.floatValue; } 96 97 97 98 bool operator==(const ValueKey& other) const -
trunk/Source/JavaScriptCore/b3/B3ValueRep.h
r248178 r248710 160 160 } 161 161 162 static ValueRep constantFloat(float value) 163 { 164 return ValueRep::constant(static_cast<uint64_t>(bitwise_cast<uint32_t>(value))); 165 } 166 162 167 Kind kind() const { return m_kind; } 163 168 … … 233 238 } 234 239 240 float floatValue() const 241 { 242 return bitwise_cast<float>(static_cast<uint32_t>(static_cast<uint64_t>(value()))); 243 } 244 235 245 ValueRep withOffset(intptr_t offset) const 236 246 { -
trunk/Source/JavaScriptCore/b3/testb3.h
r248178 r248710 702 702 void testPatchpointLotsOfLateAnys(); 703 703 void testPatchpointAnyImm(ValueRep rep); 704 void testPatchpointManyImms(); 704 void testPatchpointManyWarmAnyImms(); 705 void testPatchpointManyColdAnyImms(); 705 706 void testPatchpointWithRegisterResult(); 706 707 void testPatchpointWithStackArgumentResult(); -
trunk/Source/JavaScriptCore/b3/testb3_1.cpp
r248533 r248710 476 476 RUN(testPatchpointAnyImm(ValueRep::ColdAny)); 477 477 RUN(testPatchpointAnyImm(ValueRep::LateColdAny)); 478 RUN(testPatchpointManyImms()); 478 RUN(testPatchpointManyWarmAnyImms()); 479 RUN(testPatchpointManyColdAnyImms()); 479 480 RUN(testPatchpointWithRegisterResult()); 480 481 RUN(testPatchpointWithStackArgumentResult()); -
trunk/Source/JavaScriptCore/b3/testb3_5.cpp
r248178 r248710 29 29 #if ENABLE(B3_JIT) 30 30 31 void testPatchpointMany Imms()31 void testPatchpointManyWarmAnyImms() 32 32 { 33 33 Procedure proc; … … 37 37 Value* arg3 = root->appendNew<Const64Value>(proc, Origin(), 43000000000000ll); 38 38 Value* arg4 = root->appendNew<ConstDoubleValue>(proc, Origin(), 42.5); 39 Value* arg5 = root->appendNew<ConstFloatValue>(proc, Origin(), -42.5f); 39 40 PatchpointValue* patchpoint = root->appendNew<PatchpointValue>(proc, Void, Origin()); 40 41 patchpoint->append(ConstrainedValue(arg1, ValueRep::WarmAny)); … … 42 43 patchpoint->append(ConstrainedValue(arg3, ValueRep::WarmAny)); 43 44 patchpoint->append(ConstrainedValue(arg4, ValueRep::WarmAny)); 45 patchpoint->append(ConstrainedValue(arg5, ValueRep::WarmAny)); 44 46 patchpoint->setGenerator( 45 47 [&] (CCallHelpers&, const StackmapGenerationParams& params) { 46 CHECK(params.size() == 4);48 CHECK(params.size() == 5); 47 49 CHECK(params[0] == ValueRep::constant(42)); 48 50 CHECK(params[1] == ValueRep::constant(43)); 49 51 CHECK(params[2] == ValueRep::constant(43000000000000ll)); 50 CHECK(params[3] == ValueRep::constant(bitwise_cast<int64_t>(42.5))); 52 CHECK(params[3] == ValueRep::constantDouble(42.5)); 53 CHECK(params[4] == ValueRep::constantFloat(-42.5f)); 54 CHECK(params[4].floatValue() == -42.5f); 55 }); 56 root->appendNewControlValue( 57 proc, Return, Origin(), 58 root->appendNew<Const32Value>(proc, Origin(), 0)); 59 60 CHECK(!compileAndRun<int>(proc)); 61 } 62 63 void testPatchpointManyColdAnyImms() 64 { 65 Procedure proc; 66 BasicBlock* root = proc.addBlock(); 67 Value* arg1 = root->appendNew<Const32Value>(proc, Origin(), 42); 68 Value* arg2 = root->appendNew<Const64Value>(proc, Origin(), 43); 69 Value* arg3 = root->appendNew<Const64Value>(proc, Origin(), 43000000000000ll); 70 Value* arg4 = root->appendNew<ConstDoubleValue>(proc, Origin(), 42.5); 71 Value* arg5 = root->appendNew<ConstFloatValue>(proc, Origin(), -42.5f); 72 PatchpointValue* patchpoint = root->appendNew<PatchpointValue>(proc, Void, Origin()); 73 patchpoint->append(ConstrainedValue(arg1, ValueRep::ColdAny)); 74 patchpoint->append(ConstrainedValue(arg2, ValueRep::ColdAny)); 75 patchpoint->append(ConstrainedValue(arg3, ValueRep::ColdAny)); 76 patchpoint->append(ConstrainedValue(arg4, ValueRep::ColdAny)); 77 patchpoint->append(ConstrainedValue(arg5, ValueRep::ColdAny)); 78 patchpoint->setGenerator( 79 [&] (CCallHelpers&, const StackmapGenerationParams& params) { 80 CHECK(params.size() == 5); 81 CHECK(params[0] == ValueRep::constant(42)); 82 CHECK(params[1] == ValueRep::constant(43)); 83 CHECK(params[2] == ValueRep::constant(43000000000000ll)); 84 CHECK(params[3] == ValueRep::constantDouble(42.5)); 85 CHECK(params[4] == ValueRep::constantFloat(-42.5f)); 86 CHECK(params[4].floatValue() == -42.5f); 51 87 }); 52 88 root->appendNewControlValue(
Note: See TracChangeset
for help on using the changeset viewer.