Changeset 194294 in webkit
- Timestamp:
- Dec 18, 2015, 2:03:30 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 added
- 14 edited
-
CMakeLists.txt (modified) (1 diff)
-
ChangeLog (modified) (1 diff)
-
JavaScriptCore.vcxproj/JavaScriptCore.vcxproj (modified) (1 diff)
-
JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters (modified) (1 diff)
-
JavaScriptCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
bytecode/CodeBlock.cpp (modified) (5 diffs)
-
bytecode/CodeBlock.h (modified) (3 diffs)
-
bytecode/ValueProfile.cpp (added)
-
bytecode/ValueProfile.h (modified) (1 diff)
-
jit/JITArithmetic.cpp (modified) (4 diffs)
-
jit/JITDivGenerator.cpp (modified) (1 diff)
-
jit/JITDivGenerator.h (modified) (3 diffs)
-
jit/JITMulGenerator.cpp (modified) (2 diffs)
-
jit/JITMulGenerator.h (modified) (3 diffs)
-
runtime/CommonSlowPaths.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/CMakeLists.txt
r194242 r194294 204 204 bytecode/UnlinkedFunctionExecutable.cpp 205 205 bytecode/UnlinkedInstructionStream.cpp 206 bytecode/ValueProfile.cpp 206 207 bytecode/ValueRecovery.cpp 207 208 bytecode/VariableWriteFireDetail.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r194293 r194294 1 2015-12-18 Mark Lam <mark.lam@apple.com> 2 3 Replace SpecialFastCase profiles with ResultProfiles. 4 https://bugs.webkit.org/show_bug.cgi?id=152433 5 6 Reviewed by Saam Barati. 7 8 This is in preparation for upcoming work to enhance the DFG predictions to deal 9 with untyped operands. 10 11 This patch also enhances some of the arithmetic slow paths (for the LLINT and 12 baseline JIT) to collect result profiling info. This profiling info is not put 13 to use yet. 14 15 * CMakeLists.txt: 16 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 17 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 18 * JavaScriptCore.xcodeproj/project.pbxproj: 19 * bytecode/CodeBlock.cpp: 20 (JSC::CodeBlock::dumpRareCaseProfile): 21 (JSC::CodeBlock::dumpResultProfile): 22 (JSC::CodeBlock::printLocationAndOp): 23 (JSC::CodeBlock::dumpBytecode): 24 (JSC::CodeBlock::shrinkToFit): 25 (JSC::CodeBlock::dumpValueProfiles): 26 (JSC::CodeBlock::rareCaseProfileCountForBytecodeOffset): 27 (JSC::CodeBlock::resultProfileForBytecodeOffset): 28 (JSC::CodeBlock::updateResultProfileForBytecodeOffset): 29 (JSC::CodeBlock::capabilityLevel): 30 * bytecode/CodeBlock.h: 31 (JSC::CodeBlock::couldTakeSlowCase): 32 (JSC::CodeBlock::addResultProfile): 33 (JSC::CodeBlock::numberOfResultProfiles): 34 (JSC::CodeBlock::specialFastCaseProfileCountForBytecodeOffset): 35 (JSC::CodeBlock::couldTakeSpecialFastCase): 36 (JSC::CodeBlock::addSpecialFastCaseProfile): Deleted. 37 (JSC::CodeBlock::numberOfSpecialFastCaseProfiles): Deleted. 38 (JSC::CodeBlock::specialFastCaseProfile): Deleted. 39 (JSC::CodeBlock::specialFastCaseProfileForBytecodeOffset): Deleted. 40 * bytecode/ValueProfile.cpp: Added. 41 (WTF::printInternal): 42 * bytecode/ValueProfile.h: 43 (JSC::getRareCaseProfileBytecodeOffset): 44 (JSC::ResultProfile::ResultProfile): 45 (JSC::ResultProfile::bytecodeOffset): 46 (JSC::ResultProfile::specialFastPathCount): 47 (JSC::ResultProfile::didObserveNonInt32): 48 (JSC::ResultProfile::didObserveDouble): 49 (JSC::ResultProfile::didObserveNonNegZeroDouble): 50 (JSC::ResultProfile::didObserveNegZeroDouble): 51 (JSC::ResultProfile::didObserveNonNumber): 52 (JSC::ResultProfile::didObserveInt32Overflow): 53 (JSC::ResultProfile::setObservedNonNegZeroDouble): 54 (JSC::ResultProfile::setObservedNegZeroDouble): 55 (JSC::ResultProfile::setObservedNonNumber): 56 (JSC::ResultProfile::setObservedInt32Overflow): 57 (JSC::ResultProfile::addressOfFlags): 58 (JSC::ResultProfile::addressOfSpecialFastPathCount): 59 (JSC::ResultProfile::hasBits): 60 (JSC::ResultProfile::setBit): 61 (JSC::getResultProfileBytecodeOffset): 62 * jit/JITArithmetic.cpp: 63 (JSC::JIT::emit_op_div): 64 (JSC::JIT::emit_op_mul): 65 * jit/JITDivGenerator.cpp: 66 (JSC::JITDivGenerator::generateFastPath): 67 * jit/JITDivGenerator.h: 68 (JSC::JITDivGenerator::JITDivGenerator): 69 * jit/JITMulGenerator.cpp: 70 (JSC::JITMulGenerator::generateFastPath): 71 * jit/JITMulGenerator.h: 72 (JSC::JITMulGenerator::JITMulGenerator): 73 * runtime/CommonSlowPaths.cpp: 74 (JSC::SLOW_PATH_DECL): 75 1 76 2015-12-18 Keith Miller <keith_miller@apple.com> 2 77 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r193985 r194294 363 363 <ClCompile Include="..\bytecode\UnlinkedFunctionExecutable.cpp" /> 364 364 <ClCompile Include="..\bytecode\UnlinkedInstructionStream.cpp" /> 365 <ClCompile Include="..\bytecode\ValueProfile.cpp" /> 365 366 <ClCompile Include="..\bytecode\ValueRecovery.cpp" /> 366 367 <ClCompile Include="..\bytecode\VariableWriteFireDetail.cpp" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
r193985 r194294 1525 1525 <Filter>runtime</Filter> 1526 1526 </ClCompile> 1527 <ClCompile Include="..\bytecode\ValueProfile.cpp"> 1528 <Filter>bytecode</Filter> 1529 </ClCompile> 1527 1530 <ClCompile Include="..\bytecode\ValueRecovery.cpp"> 1528 1531 <Filter>bytecode</Filter> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r194242 r194294 2055 2055 FEA08620182B7A0400F6D851 /* Breakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861E182B7A0400F6D851 /* Breakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2056 2056 FEA08621182B7A0400F6D851 /* DebuggerPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2057 FEA1E4391C213A2B00277A16 /* ValueProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEA1E4381C213A2600277A16 /* ValueProfile.cpp */; settings = {ASSET_TAGS = (); }; }; 2057 2058 FEB137571BB11EF900CD5100 /* MacroAssemblerARM64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEB137561BB11EEE00CD5100 /* MacroAssemblerARM64.cpp */; }; 2058 2059 FEB51F6C1A97B688001F921C /* Regress141809.mm in Sources */ = {isa = PBXBuildFile; fileRef = FEB51F6B1A97B688001F921C /* Regress141809.mm */; }; … … 4259 4260 FEA0861E182B7A0400F6D851 /* Breakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Breakpoint.h; sourceTree = "<group>"; }; 4260 4261 FEA0861F182B7A0400F6D851 /* DebuggerPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebuggerPrimitives.h; sourceTree = "<group>"; }; 4262 FEA1E4381C213A2600277A16 /* ValueProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ValueProfile.cpp; sourceTree = "<group>"; }; 4261 4263 FEB137561BB11EEE00CD5100 /* MacroAssemblerARM64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssemblerARM64.cpp; sourceTree = "<group>"; }; 4262 4264 FEB51F6A1A97B688001F921C /* Regress141809.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Regress141809.h; path = API/tests/Regress141809.h; sourceTree = "<group>"; }; … … 6521 6523 B59F89381891ADB500D5CCDC /* UnlinkedInstructionStream.cpp */, 6522 6524 B59F89371891AD3300D5CCDC /* UnlinkedInstructionStream.h */, 6525 FEA1E4381C213A2600277A16 /* ValueProfile.cpp */, 6523 6526 0F963B3613FC6FDE0002D9B2 /* ValueProfile.h */, 6524 6527 0F24E55717F74EDB00ABB217 /* ValueRecovery.cpp */, … … 9245 9248 0FF42740158EBE8B004CB9FF /* udis86_decode.c in Sources */, 9246 9249 0FF42743158EBE91004CB9FF /* udis86_input.c in Sources */, 9250 FEA1E4391C213A2B00277A16 /* ValueProfile.cpp in Sources */, 9247 9251 0FF4274D158EBFE6004CB9FF /* udis86_itab_holder.c in Sources */, 9248 9252 0FF42745158EBE91004CB9FF /* udis86_syn-att.c in Sources */, -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r194248 r194294 742 742 } 743 743 744 void CodeBlock::dumpResultProfile(PrintStream& out, ResultProfile* profile, bool& hasPrintedProfiling) 745 { 746 if (!profile) 747 return; 748 749 beginDumpProfiling(out, hasPrintedProfiling); 750 out.print("results: ", *profile); 751 } 752 744 753 void CodeBlock::printLocationAndOp(PrintStream& out, ExecState*, int location, const Instruction*&, const char* op) 745 754 { … … 1652 1661 1653 1662 dumpRareCaseProfile(out, "rare case: ", rareCaseProfileForBytecodeOffset(location), hasPrintedProfiling); 1654 dumpR areCaseProfile(out, "special fast case: ", specialFastCaseProfileForBytecodeOffset(location), hasPrintedProfiling);1663 dumpResultProfile(out, resultProfileForBytecodeOffset(location), hasPrintedProfiling); 1655 1664 1656 1665 #if ENABLE(DFG_JIT) … … 3132 3141 { 3133 3142 m_rareCaseProfiles.shrinkToFit(); 3134 m_ specialFastCaseProfiles.shrinkToFit();3143 m_resultProfiles.shrinkToFit(); 3135 3144 3136 3145 if (shrinkMode == EarlyShrink) { … … 3977 3986 dataLogF(" bc = %d: %u\n", profile->m_bytecodeOffset, profile->m_counter); 3978 3987 } 3979 dataLog(" SpecialFastCaseProfile for ", *this, ":\n");3980 for (unsigned i = 0; i < numberOf SpecialFastCaseProfiles(); ++i) {3981 RareCaseProfile* profile = specialFastCaseProfile(i);3982 dataLog F(" bc = %d: %u\n", profile->m_bytecodeOffset, profile->m_counter);3988 dataLog("ResultProfile for ", *this, ":\n"); 3989 for (unsigned i = 0; i < numberOfResultProfiles(); ++i) { 3990 const ResultProfile& profile = *resultProfile(i); 3991 dataLog(" bc = ", profile.bytecodeOffset(), ": ", profile, "\n"); 3983 3992 } 3984 3993 } … … 4176 4185 return profile->m_counter; 4177 4186 return 0; 4187 } 4188 4189 ResultProfile* CodeBlock::resultProfileForBytecodeOffset(int bytecodeOffset) 4190 { 4191 return tryBinarySearch<ResultProfile, int>( 4192 m_resultProfiles, m_resultProfiles.size(), bytecodeOffset, 4193 getResultProfileBytecodeOffset); 4194 } 4195 4196 void CodeBlock::updateResultProfileForBytecodeOffset(int bytecodeOffset, JSValue result) 4197 { 4198 #if ENABLE(DFG_JIT) 4199 ResultProfile* profile = resultProfileForBytecodeOffset(bytecodeOffset); 4200 if (!profile) 4201 profile = addResultProfile(bytecodeOffset); 4202 4203 if (result.isNumber()) { 4204 if (!result.isInt32()) { 4205 double doubleVal = result.asNumber(); 4206 if (!doubleVal && std::signbit(doubleVal)) 4207 profile->setObservedNegZeroDouble(); 4208 else 4209 profile->setObservedNonNegZeroDouble(); 4210 } 4211 } else 4212 profile->setObservedNonNumber(); 4213 #else 4214 UNUSED_PARAM(bytecodeOffset); 4215 UNUSED_PARAM(result); 4216 #endif 4178 4217 } 4179 4218 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r193485 r194294 453 453 } 454 454 455 RareCaseProfile* addSpecialFastCaseProfile(int bytecodeOffset) 456 { 457 m_specialFastCaseProfiles.append(RareCaseProfile(bytecodeOffset)); 458 return &m_specialFastCaseProfiles.last(); 459 } 460 unsigned numberOfSpecialFastCaseProfiles() { return m_specialFastCaseProfiles.size(); } 461 RareCaseProfile* specialFastCaseProfile(int index) { return &m_specialFastCaseProfiles[index]; } 462 RareCaseProfile* specialFastCaseProfileForBytecodeOffset(int bytecodeOffset) 463 { 464 return tryBinarySearch<RareCaseProfile, int>( 465 m_specialFastCaseProfiles, m_specialFastCaseProfiles.size(), bytecodeOffset, 466 getRareCaseProfileBytecodeOffset); 467 } 455 ResultProfile* addResultProfile(int bytecodeOffset) 456 { 457 m_resultProfiles.append(ResultProfile(bytecodeOffset)); 458 return &m_resultProfiles.last(); 459 } 460 unsigned numberOfResultProfiles() { return m_resultProfiles.size(); } 461 ResultProfile* resultProfileForBytecodeOffset(int bytecodeOffset); 462 463 void updateResultProfileForBytecodeOffset(int bytecodeOffset, JSValue result); 464 468 465 unsigned specialFastCaseProfileCountForBytecodeOffset(int bytecodeOffset) 469 466 { 470 R areCaseProfile* profile = specialFastCaseProfileForBytecodeOffset(bytecodeOffset);467 ResultProfile* profile = resultProfileForBytecodeOffset(bytecodeOffset); 471 468 if (!profile) 472 469 return 0; 473 return profile-> m_counter;470 return profile->specialFastPathCount(); 474 471 } 475 472 … … 995 992 void dumpArrayProfiling(PrintStream&, const Instruction*&, bool& hasPrintedProfiling); 996 993 void dumpRareCaseProfile(PrintStream&, const char* name, RareCaseProfile*, bool& hasPrintedProfiling); 997 994 void dumpResultProfile(PrintStream&, ResultProfile*, bool& hasPrintedProfiling); 995 998 996 bool shouldVisitStrongly(); 999 997 bool shouldJettisonDueToWeakReference(); … … 1070 1068 Vector<ValueProfile> m_valueProfiles; 1071 1069 SegmentedVector<RareCaseProfile, 8> m_rareCaseProfiles; 1072 SegmentedVector<R areCaseProfile, 8> m_specialFastCaseProfiles;1070 SegmentedVector<ResultProfile, 8> m_resultProfiles; 1073 1071 Vector<ArrayAllocationProfile> m_arrayAllocationProfiles; 1074 1072 ArrayProfileVector m_arrayProfiles; -
trunk/Source/JavaScriptCore/bytecode/ValueProfile.h
r165676 r194294 207 207 } 208 208 209 struct ResultProfile { 210 private: 211 static const int numberOfFlagBits = 4; 212 213 public: 214 ResultProfile(int bytecodeOffset) 215 : m_bytecodeOffsetAndFlags(bytecodeOffset << numberOfFlagBits) 216 { 217 ASSERT(((bytecodeOffset << numberOfFlagBits) >> numberOfFlagBits) == bytecodeOffset); 218 } 219 220 enum ObservedResults { 221 NonNegZeroDouble = 1 << 0, 222 NegZeroDouble = 1 << 1, 223 NonNumber = 1 << 2, 224 Int32Overflow = 1 << 3, 225 }; 226 227 int bytecodeOffset() const { return m_bytecodeOffsetAndFlags >> numberOfFlagBits; } 228 unsigned specialFastPathCount() const { return m_specialFastPathCount; } 229 230 bool didObserveNonInt32() const { return hasBits(NonNegZeroDouble | NegZeroDouble | NonNumber); } 231 bool didObserveDouble() const { return hasBits(NonNegZeroDouble | NegZeroDouble); } 232 bool didObserveNonNegZeroDouble() const { return hasBits(NonNegZeroDouble); } 233 bool didObserveNegZeroDouble() const { return hasBits(NegZeroDouble); } 234 bool didObserveNonNumber() const { return hasBits(NonNumber); } 235 bool didObserveInt32Overflow() const { return hasBits(Int32Overflow); } 236 237 void setObservedNonNegZeroDouble() { setBit(NonNegZeroDouble); } 238 void setObservedNegZeroDouble() { setBit(NegZeroDouble); } 239 void setObservedNonNumber() { setBit(NonNumber); } 240 void setObservedInt32Overflow() { setBit(Int32Overflow); } 241 242 void* addressOfFlags() { return &m_bytecodeOffsetAndFlags; } 243 void* addressOfSpecialFastPathCount() { return &m_specialFastPathCount; } 244 245 private: 246 bool hasBits(int mask) const { return m_bytecodeOffsetAndFlags & mask; } 247 void setBit(int mask) { m_bytecodeOffsetAndFlags |= mask; } 248 249 int m_bytecodeOffsetAndFlags; 250 unsigned m_specialFastPathCount { 0 }; 251 }; 252 253 inline int getResultProfileBytecodeOffset(ResultProfile* profile) 254 { 255 return profile->bytecodeOffset(); 256 } 257 209 258 } // namespace JSC 210 259 260 namespace WTF { 261 262 void printInternal(PrintStream&, const JSC::ResultProfile&); 263 264 } // namespace WTF 265 211 266 #endif // ValueProfile_h 212 267 -
trunk/Source/JavaScriptCore/jit/JITArithmetic.cpp
r194131 r194294 756 756 FPRReg scratchFPR = fpRegT2; 757 757 758 uint32_t* profilingCounter = &m_codeBlock->addSpecialFastCaseProfile(m_bytecodeOffset)->m_counter; 758 ResultProfile* resultProfile = nullptr; 759 if (shouldEmitProfiling()) 760 resultProfile = m_codeBlock->addResultProfile(m_bytecodeOffset); 759 761 760 762 SnippetOperand leftOperand(types.first()); … … 783 785 784 786 JITDivGenerator gen(leftOperand, rightOperand, resultRegs, leftRegs, rightRegs, 785 fpRegT0, fpRegT1, scratchGPR, scratchFPR, profilingCounter);787 fpRegT0, fpRegT1, scratchGPR, scratchFPR, resultProfile); 786 788 787 789 gen.generateFastPath(*this); … … 829 831 #endif 830 832 831 uint32_t* profilingCounter= nullptr;833 ResultProfile* resultProfile = nullptr; 832 834 if (shouldEmitProfiling()) 833 profilingCounter = &m_codeBlock->addSpecialFastCaseProfile(m_bytecodeOffset)->m_counter;835 resultProfile = m_codeBlock->addResultProfile(m_bytecodeOffset); 834 836 835 837 SnippetOperand leftOperand(types.first()); … … 849 851 850 852 JITMulGenerator gen(leftOperand, rightOperand, resultRegs, leftRegs, rightRegs, 851 fpRegT0, fpRegT1, scratchGPR, scratchFPR, profilingCounter);853 fpRegT0, fpRegT1, scratchGPR, scratchFPR, resultProfile); 852 854 853 855 gen.generateFastPath(*this); -
trunk/Source/JavaScriptCore/jit/JITDivGenerator.cpp
r192836 r194294 107 107 notDoubleZero.link(&jit); 108 108 #endif 109 if (m_ profilingCounter)110 jit.add32(CCallHelpers::TrustedImm32(1), CCallHelpers::AbsoluteAddress(m_ profilingCounter));109 if (m_resultProfile) 110 jit.add32(CCallHelpers::TrustedImm32(1), CCallHelpers::AbsoluteAddress(m_resultProfile->addressOfSpecialFastPathCount())); 111 111 jit.boxDouble(m_leftFPR, m_result); 112 112 } -
trunk/Source/JavaScriptCore/jit/JITDivGenerator.h
r192836 r194294 39 39 JSValueRegs result, JSValueRegs left, JSValueRegs right, 40 40 FPRReg leftFPR, FPRReg rightFPR, GPRReg scratchGPR, FPRReg scratchFPR, 41 uint32_t* profilingCounter= nullptr)41 ResultProfile* resultProfile = nullptr) 42 42 : m_leftOperand(leftOperand) 43 43 , m_rightOperand(rightOperand) … … 49 49 , m_scratchGPR(scratchGPR) 50 50 , m_scratchFPR(scratchFPR) 51 , m_ profilingCounter(profilingCounter)51 , m_resultProfile(resultProfile) 52 52 { 53 53 ASSERT(!m_leftOperand.isConstInt32() || !m_rightOperand.isConstInt32()); … … 72 72 GPRReg m_scratchGPR; 73 73 FPRReg m_scratchFPR; 74 uint32_t* m_profilingCounter;74 ResultProfile* m_resultProfile; 75 75 bool m_didEmitFastPath { false }; 76 76 -
trunk/Source/JavaScriptCore/jit/JITMulGenerator.cpp
r192842 r194294 92 92 93 93 m_slowPathJumpList.append(jit.branchMul32(CCallHelpers::Overflow, m_right.payloadGPR(), m_left.payloadGPR(), m_scratchGPR)); 94 if (!m_ profilingCounter) {94 if (!m_resultProfile) { 95 95 m_slowPathJumpList.append(jit.branchTest32(CCallHelpers::Zero, m_scratchGPR)); // Go slow if potential negative zero. 96 96 … … 105 105 // Record this, so that the speculative JIT knows that we failed speculation 106 106 // because of a negative zero. 107 jit.add32(CCallHelpers::TrustedImm32(1), CCallHelpers::AbsoluteAddress(m_ profilingCounter));107 jit.add32(CCallHelpers::TrustedImm32(1), CCallHelpers::AbsoluteAddress(m_resultProfile->addressOfSpecialFastPathCount())); 108 108 m_slowPathJumpList.append(jit.jump()); 109 109 -
trunk/Source/JavaScriptCore/jit/JITMulGenerator.h
r192993 r194294 38 38 JITMulGenerator(SnippetOperand leftOperand, SnippetOperand rightOperand, 39 39 JSValueRegs result, JSValueRegs left, JSValueRegs right, 40 FPRReg leftFPR, FPRReg rightFPR, GPRReg scratchGPR, FPRReg scratchFPR, uint32_t* profilingCounter = nullptr) 40 FPRReg leftFPR, FPRReg rightFPR, GPRReg scratchGPR, FPRReg scratchFPR, 41 ResultProfile* resultProfile = nullptr) 41 42 : m_leftOperand(leftOperand) 42 43 , m_rightOperand(rightOperand) … … 48 49 , m_scratchGPR(scratchGPR) 49 50 , m_scratchFPR(scratchFPR) 50 , m_ profilingCounter(profilingCounter)51 , m_resultProfile(resultProfile) 51 52 { 52 53 ASSERT(!m_leftOperand.isPositiveConstInt32() || !m_rightOperand.isPositiveConstInt32()); … … 69 70 GPRReg m_scratchGPR; 70 71 FPRReg m_scratchFPR; 71 uint32_t* m_profilingCounter;72 ResultProfile* m_resultProfile; 72 73 bool m_didEmitFastPath { false }; 73 74 -
trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
r193603 r194294 117 117 } while (false) 118 118 119 #define RETURN(value) do { \ 120 JSValue rReturnValue = (value); \ 121 CHECK_EXCEPTION(); \ 122 OP(1) = rReturnValue; \ 123 END_IMPL(); \ 124 } while (false) 125 126 #define RETURN_PROFILED(opcode, value) do { \ 127 JSValue rpPeturnValue = (value); \ 128 CHECK_EXCEPTION(); \ 129 OP(1) = rpPeturnValue; \ 130 PROFILE_VALUE(opcode, rpPeturnValue); \ 131 END_IMPL(); \ 132 } while (false) 119 #define RETURN_WITH_PROFILING(value__, profilingAction__) do { \ 120 JSValue returnValue__ = (value__); \ 121 CHECK_EXCEPTION(); \ 122 OP(1) = returnValue__; \ 123 profilingAction__; \ 124 END_IMPL(); \ 125 } while (false) 126 127 #define RETURN(value) \ 128 RETURN_WITH_PROFILING(value, { }) 129 130 #define RETURN_PROFILED(opcode__, value__) \ 131 RETURN_WITH_PROFILING(value__, PROFILE_VALUE(opcode__, returnValue__)) 133 132 134 133 #define PROFILE_VALUE(opcode, value) do { \ 135 134 pc[OPCODE_LENGTH(opcode) - 1].u.profile->m_buckets[0] = \ 136 135 JSValue::encode(value); \ 136 } while (false) 137 138 #define RETURN_WITH_RESULT_PROFILING(value__) \ 139 RETURN_WITH_PROFILING(value__, PROFILE_RESULT(returnValue__)) 140 141 #define PROFILE_RESULT(value__) do { \ 142 CodeBlock* codeBlock = exec->codeBlock(); \ 143 unsigned bytecodeOffset = codeBlock->bytecodeOffset(pc); \ 144 codeBlock->updateResultProfileForBytecodeOffset(bytecodeOffset, value__); \ 137 145 } while (false) 138 146 … … 358 366 359 367 if (v1.isString() && !v2.isObject()) 360 RETURN (jsString(exec, asString(v1), v2.toString(exec)));368 RETURN_WITH_RESULT_PROFILING(jsString(exec, asString(v1), v2.toString(exec))); 361 369 362 370 if (v1.isNumber() && v2.isNumber()) 363 RETURN (jsNumber(v1.asNumber() + v2.asNumber()));364 365 RETURN (jsAddSlowCase(exec, v1, v2));371 RETURN_WITH_RESULT_PROFILING(jsNumber(v1.asNumber() + v2.asNumber())); 372 373 RETURN_WITH_RESULT_PROFILING(jsAddSlowCase(exec, v1, v2)); 366 374 } 367 375 … … 375 383 double a = OP_C(2).jsValue().toNumber(exec); 376 384 double b = OP_C(3).jsValue().toNumber(exec); 377 RETURN (jsNumber(a * b));385 RETURN_WITH_RESULT_PROFILING(jsNumber(a * b)); 378 386 } 379 387 … … 383 391 double a = OP_C(2).jsValue().toNumber(exec); 384 392 double b = OP_C(3).jsValue().toNumber(exec); 385 RETURN (jsNumber(a - b));393 RETURN_WITH_RESULT_PROFILING(jsNumber(a - b)); 386 394 } 387 395 … … 391 399 double a = OP_C(2).jsValue().toNumber(exec); 392 400 double b = OP_C(3).jsValue().toNumber(exec); 393 RETURN (jsNumber(a / b));401 RETURN_WITH_RESULT_PROFILING(jsNumber(a / b)); 394 402 } 395 403
Note:
See TracChangeset
for help on using the changeset viewer.