Bug 128624

Summary: Merge AtomicString, Identifier
Product: WebKit Reporter: Gavin Barraclough <barraclough>
Component: JavaScriptCoreAssignee: Gavin Barraclough <barraclough>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, benjamin, cmarcelo, commit-queue, darin, kling, koivisto, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Rage hacked, builds, fixed ASSERTions & infinite loops, but almost all tests still failing!
none
New patch
none
New fix
none
review fixes, windows build fix, separate out new file.
none
Tests pass, think the JSC/WTF changes are probably complete.
none
Patch, with speculative Windows build fix ggaren: review+

Gavin Barraclough
Reported 2014-02-11 13:53:49 PST
.
Attachments
Rage hacked, builds, fixed ASSERTions & infinite loops, but almost all tests still failing! (127.17 KB, patch)
2014-02-11 13:55 PST, Gavin Barraclough
no flags
New patch (32.46 KB, patch)
2014-03-17 17:15 PDT, Gavin Barraclough
no flags
New fix (32.86 KB, patch)
2014-03-17 18:48 PDT, Gavin Barraclough
no flags
review fixes, windows build fix, separate out new file. (36.81 KB, patch)
2014-03-19 14:58 PDT, Gavin Barraclough
no flags
Tests pass, think the JSC/WTF changes are probably complete. (43.60 KB, patch)
2014-03-20 00:18 PDT, Gavin Barraclough
no flags
Patch, with speculative Windows build fix (47.31 KB, patch)
2014-03-20 12:00 PDT, Gavin Barraclough
ggaren: review+
Gavin Barraclough
Comment 1 2014-02-11 13:55:28 PST
Created attachment 223898 [details] Rage hacked, builds, fixed ASSERTions & infinite loops, but almost all tests still failing!
Gavin Barraclough
Comment 2 2014-03-17 17:15:06 PDT
Created attachment 226987 [details] New patch
Gavin Barraclough
Comment 3 2014-03-17 17:15:30 PDT
JS Perf looks fine. All benchmarks: <arithmetic> 149.9601+-1.3387 148.4964+-0.8381 might be 1.0099x faster <geometric> 19.2674+-0.0367 ^ 19.1212+-0.0932 ^ definitely 1.0076x faster <harmonic> 4.2925+-0.0201 4.2662+-0.0586 might be 1.0062x faster
Gavin Barraclough
Comment 4 2014-03-17 17:16:43 PDT
Oh, patch needs Changelogs & some of those inlines could do with their own header.
WebKit Commit Bot
Comment 5 2014-03-17 17:17:30 PDT
Attachment 226987 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/runtime/Identifier.h:113: The parameter name "r" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/runtime/Identifier.h:114: The parameter name "r" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 2 in 21 files If any of these errors are false positives, please file a bug against check-webkit-style.
Gavin Barraclough
Comment 6 2014-03-17 18:48:48 PDT
Created attachment 226997 [details] New fix Still needs changelog, etc.
Andreas Kling
Comment 7 2014-03-17 20:00:23 PDT
Freakin' awesome!
Benjamin Poulain
Comment 8 2014-03-17 20:09:09 PDT
(In reply to comment #7) > Freakin' awesome! +1
Darin Adler
Comment 9 2014-03-17 20:18:52 PDT
Comment on attachment 226997 [details] New fix View in context: https://bugs.webkit.org/attachment.cgi?id=226997&action=review > Source/JavaScriptCore/runtime/SmallStrings.cpp:62 > m_reps[i] = StringImpl::createSubstringSharingImpl(baseString, i, 1); > + m_reps[i] = AtomicString::add(m_reps[i].get()); Why use m_reps[i] for the intermediate value? Why not do this all on one line. > Source/JavaScriptCore/runtime/VM.cpp:198 > + , propertyNames(0) nullptr? > Source/WTF/wtf/text/AtomicStringTable.cpp:56 > + for (auto iter : m_table) Should name this "string", not "iter". I prefer "auto*" or "auto&" here to make it clear we don’t have any bad copying going on. > Source/WTF/wtf/text/AtomicStringTable.cpp:60 > void AtomicStringTable::destroy(AtomicStringTable* table) Do we even need this function any more since we have a public destructor now?
Darin Adler
Comment 10 2014-03-17 20:43:58 PDT
Comment on attachment 226997 [details] New fix View in context: https://bugs.webkit.org/attachment.cgi?id=226997&action=review Any of these functions that should take or return references rather than pointers? > Source/JavaScriptCore/runtime/VM.h:296 > + IdentifierTable* atomicStringTable() const { return identifierTable; } Consider returning a reference instead of a pointer? Why do we need this function? Just to rename the identifierTable data member? > Source/WTF/wtf/WTFThreadData.h:55 > +typedef AtomicStringTable IdentifierTable; Long term would we just get rid of this typedef?
Gavin Barraclough
Comment 11 2014-03-19 14:28:52 PDT
(In reply to comment #9) > Why use m_reps[i] for the intermediate value? Why not do this all on one line. > > nullptr? > > I prefer "auto*" or "auto&" here to make it clear we don’t have any bad copying going on. done, done, done. > > Source/WTF/wtf/text/AtomicStringTable.cpp:60 > > void AtomicStringTable::destroy(AtomicStringTable* table) > > Do we even need this function any more since we have a public destructor now? Short answer, yes. Long answer, no. We still need this because it's used as a part of the mechanism for the main thread / web thread to decide who gets to delete their shared string table. But it's probably an over engineered solution – we probably just an if statement in WTFThreadData's destructor. Let me revise in a follow-on patch. (In reply to comment #10) > > > Source/JavaScriptCore/runtime/VM.h:296 > > + IdentifierTable* atomicStringTable() const { return identifierTable; } > > Consider returning a reference instead of a pointer? done, > Why do we need this function? Just to rename the identifierTable data member? We use this method so you can call AtomicString::add(VM&, StringImpl*), or AtomicString::add(ExecState&, StringImpl*), template on the first argument type to avoid a layering violation. Hopefully we may be ablate make this go away in a followup patch, if WTFThreadData access is now fast enough we make be able to always look up the string table from the thread data, rather than reading it off the VM in JSC. > > Source/WTF/wtf/WTFThreadData.h:55 > > +typedef AtomicStringTable IdentifierTable; > > Long term would we just get rid of this typedef? Yep, definitely. I'll do a followup purge of WTF for use of the work 'Identifier' (e.g. we should probably also remove isIdentifier, all uses -> isAtomic).
Gavin Barraclough
Comment 12 2014-03-19 14:58:55 PDT
Created attachment 227221 [details] review fixes, windows build fix, separate out new file. Still missing ChangeLogs, and 2 JSC tests are failing.
Gavin Barraclough
Comment 13 2014-03-20 00:18:05 PDT
Created attachment 227265 [details] Tests pass, think the JSC/WTF changes are probably complete. Should probably take another look at that WebCore change, and the Windows build is probably still broke (related). I've added JSC/WTF Changelogs, but still needs some description.
Gavin Barraclough
Comment 14 2014-03-20 12:00:47 PDT
Created attachment 227312 [details] Patch, with speculative Windows build fix
Geoffrey Garen
Comment 15 2014-03-20 12:03:37 PDT
Comment on attachment 227312 [details] Patch, with speculative Windows build fix View in context: https://bugs.webkit.org/attachment.cgi?id=227312&action=review r=me if it blends > Source/JavaScriptCore/ChangeLog:9 > + WTF::StringImpl currently supports two uniquing mechanism - AtomicString and > + Identifer - that is one too many. So, you're saying we should unique our uniquing?
Gavin Barraclough
Comment 16 2014-03-20 12:27:02 PDT
Transmitting file data ............................ Committed revision 165982.
Gavin Barraclough
Comment 17 2014-03-20 13:04:29 PDT
Build fix in revision 165990.
Ryosuke Niwa
Comment 19 2022-07-21 17:04:29 PDT
*** Bug 38015 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.