Bug 148213

Summary: Lets rename codeOriginIndex to callSiteIndex and get rid of CallFrame::Location.
Product: WebKit Reporter: Saam Barati <saam>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: basile_clement, benjamin, commit-queue, fpizlo, ggaren, mark.lam, mmirman, msaboff, oliver, ysuzuki
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch
none
patch
none
patch fpizlo: review+

Saam Barati
Reported 2015-08-19 22:23:05 PDT
This will help when we need more fine grained control over call sites that cause exceptions when implementing try/catch in the DFG. HandlerInfo should use a CallSiteIndex instead of an unsigned byte code index. CodeBlock's linear search through handlers should be keyed by CallSiteIndex. Also, we should get rid of CallFrame::Location. The first bit that encodes as CodeOriginIndex/BytecodeIndex can be determined by CodeBlock::jitType(). StructureStubInfo should also have a field that is a CallSiteIndex and Repatch should store this as the CallFrame's CallSiteIndex. It should no longer get this information from ExecState.
Attachments
patch (56.01 KB, patch)
2015-08-20 18:35 PDT, Saam Barati
no flags
patch (57.22 KB, patch)
2015-08-20 18:41 PDT, Saam Barati
no flags
patch (58.24 KB, patch)
2015-08-20 18:47 PDT, Saam Barati
no flags
patch (59.38 KB, patch)
2015-08-24 14:54 PDT, Saam Barati
fpizlo: review+
Saam Barati
Comment 1 2015-08-20 18:16:35 PDT
I'm going to save HandlerInfo indexing for DFG exception handling patch.
Saam Barati
Comment 2 2015-08-20 18:35:44 PDT
Filip Pizlo
Comment 3 2015-08-20 18:37:17 PDT
Comment on attachment 259551 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=259551&action=review > Source/JavaScriptCore/interpreter/CallFrame.h:55 > + struct CallSiteIndex { > + explicit CallSiteIndex(uint32_t bits) > + : m_bits(bits) > + { } > +#if USE(JSVALUE32_64) > + explicit CallSiteIndex(Instruction* instruction) > + : m_bits(bitwise_cast<uint32_t>(instruction)) > + { } > +#endif > + inline uint32_t bits() const { return m_bits; } > + > + private: > + uint32_t m_bits; > + }; > + This should be in its own header. It should also be a class.
Filip Pizlo
Comment 4 2015-08-20 18:39:57 PDT
Comment on attachment 259551 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=259551&action=review > Source/JavaScriptCore/interpreter/CallFrameInlines.h:70 > +inline bool CallFrame::hasLocationAsCallSiteIndex() const > { > - ASSERT(hasLocationAsBytecodeOffset()); > ASSERT(codeBlock()); > - return Location::decode(locationAsRawBits()); > + switch (codeBlock()->jitType()) { > + case JITCode::DFGJIT: > + case JITCode::FTLJIT: > + return true; > + case JITCode::None: > + case JITCode::HostCallThunk: > + RELEASE_ASSERT_NOT_REACHED(); > + return false; > + default: > + return false; > + } > + > + RELEASE_ASSERT_NOT_REACHED(); > + return false; > } I don't get this. Does everyone have a location as a CallSiteIndex? Also, can we get rid of the term "location"? It appears that very location is encoded as a CallSiteIndex, so there shouldn't be a separate notion of "location".
Saam Barati
Comment 5 2015-08-20 18:41:41 PDT
Created attachment 259552 [details] patch rebased.
WebKit Commit Bot
Comment 6 2015-08-20 18:43:51 PDT
Attachment 259552 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h:83: Wrong number of spaces before statement. (expected: 12) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:54: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:54: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:117: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:143: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.h:59: The parameter name "value" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 6 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
Saam Barati
Comment 7 2015-08-20 18:47:36 PDT
Created attachment 259554 [details] patch it should also build with ToT
WebKit Commit Bot
Comment 8 2015-08-20 18:51:05 PDT
Attachment 259554 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h:83: Wrong number of spaces before statement. (expected: 12) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:54: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:54: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:117: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:143: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.h:59: The parameter name "value" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 6 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 9 2015-08-21 13:33:23 PDT
Comment on attachment 259554 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=259554&action=review > Source/JavaScriptCore/interpreter/CallFrameInlines.h:34 > inline bool CallFrame::hasLocationAsBytecodeOffset() const Should this be "hasCallSiteIndexAsBytecodeOffset"? > Source/JavaScriptCore/interpreter/CallFrameInlines.h:53 > +inline bool CallFrame::hasLocationAsCallSiteIndex() const I still don't get this method name. Isn't the thing we store into the tag of the argument count always a CallSiteIndex?
Saam Barati
Comment 10 2015-08-24 14:54:45 PDT
WebKit Commit Bot
Comment 11 2015-08-24 14:56:44 PDT
Attachment 259782 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h:83: Wrong number of spaces before statement. (expected: 12) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:54: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:54: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:117: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.cpp:143: Wrong number of spaces before statement. (expected: 8) [whitespace/indent] [4] ERROR: Source/JavaScriptCore/jit/JITInlineCacheGenerator.h:59: The parameter name "value" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 6 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
Saam Barati
Comment 12 2015-08-24 15:06:09 PDT
Bug renamed locally in changelog,
Saam Barati
Comment 13 2015-08-24 16:40:06 PDT
Comment on attachment 259782 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=259782&action=review > Source/JavaScriptCore/interpreter/CallFrame.cpp:104 > + return codeOrigin.bytecodeIndex; This line of code is unreachable and removed locally.
Saam Barati
Comment 14 2015-08-25 12:41:15 PDT
Filip Pizlo
Comment 15 2015-10-08 20:03:08 PDT
Comment on attachment 259782 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=259782&action=review > Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h:44 > - InlineCacheDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, UniquedStringImpl* uid) > + InlineCacheDescriptor(unsigned stackmapID, CallSiteIndex callSite, UniquedStringImpl* uid) This change was wrong. An instance of an InlineCacheDescriptor corresponds to a single DFG IR inline cache. This will lower to a single LLVM IR patchpoint. But that patchpoint can get duplicated in LLVM IR (for example via jump threading or tail duplication). This is represented by having each InlineCacheDescriptor subclass have a Vector<> of inline caches. All of those inline caches will share the same CodeOrigin. But, they should not share the same CallSiteIndex. Each inline cache generated by one of these descriptors should have its own CallSiteIndex. That's because each inline cache will have its own patchpoint, and so its own StackMaps::Record, and so it will have its own unique set of registers (its own used register set, its own input registers, its own result register, and its own registers for OSR exit). Therefore each one needs to have its own exception handler, which means having its own CallSiteIndex.
Saam Barati
Comment 16 2015-10-08 21:53:37 PDT
(In reply to comment #15) > Comment on attachment 259782 [details] > patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=259782&action=review > > > Source/JavaScriptCore/ftl/FTLInlineCacheDescriptor.h:44 > > - InlineCacheDescriptor(unsigned stackmapID, CodeOrigin codeOrigin, UniquedStringImpl* uid) > > + InlineCacheDescriptor(unsigned stackmapID, CallSiteIndex callSite, UniquedStringImpl* uid) > > This change was wrong. An instance of an InlineCacheDescriptor corresponds > to a single DFG IR inline cache. This will lower to a single LLVM IR > patchpoint. But that patchpoint can get duplicated in LLVM IR (for example > via jump threading or tail duplication). This is represented by having each > InlineCacheDescriptor subclass have a Vector<> of inline caches. > > All of those inline caches will share the same CodeOrigin. But, they should > not share the same CallSiteIndex. Each inline cache generated by one of > these descriptors should have its own CallSiteIndex. That's because each > inline cache will have its own patchpoint, and so its own StackMaps::Record, > and so it will have its own unique set of registers (its own used register > set, its own input registers, its own result register, and its own registers > for OSR exit). Therefore each one needs to have its own exception handler, > which means having its own CallSiteIndex. Dang, ok. I'll fix it.
Note You need to log in before you can comment on or make changes to this bug.