RESOLVED FIXED 155200
DFG should be able to constant-fold strings
https://bugs.webkit.org/show_bug.cgi?id=155200
Summary DFG should be able to constant-fold strings
Filip Pizlo
Reported 2016-03-08 15:26:46 PST
Patch forthcoming.
Attachments
it begins (8.00 KB, patch)
2016-03-08 15:35 PST, Filip Pizlo
no flags
more (22.32 KB, patch)
2016-03-08 15:56 PST, Filip Pizlo
no flags
wow, it works! (35.99 KB, patch)
2016-03-08 19:31 PST, Filip Pizlo
no flags
the patch (37.87 KB, patch)
2016-03-08 19:57 PST, Filip Pizlo
ggaren: review+
patch for landing (36.74 KB, patch)
2016-03-08 20:34 PST, Filip Pizlo
no flags
Filip Pizlo
Comment 1 2016-03-08 15:35:14 PST
Created attachment 273353 [details] it begins
Filip Pizlo
Comment 2 2016-03-08 15:56:17 PST
Created attachment 273358 [details] more wrote all of the support for creating strings at compile time
Filip Pizlo
Comment 3 2016-03-08 19:31:35 PST
Created attachment 273373 [details] wow, it works!
WebKit Commit Bot
Comment 4 2016-03-08 19:35:46 PST
Attachment 273373 [details] did not pass style-queue: ERROR: LayoutTests/ChangeLog:1: ChangeLog entry has no bug number [changelog/bugnumber] [5] ERROR: Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp:228: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:1055: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 3 in 33 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 5 2016-03-08 19:57:42 PST
Created attachment 273375 [details] the patch
WebKit Commit Bot
Comment 6 2016-03-08 19:59:00 PST
Attachment 273375 [details] did not pass style-queue: ERROR: LayoutTests/ChangeLog:1: ChangeLog entry has no bug number [changelog/bugnumber] [5] ERROR: Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp:230: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:1055: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 3 in 34 files If any of these errors are false positives, please file a bug against check-webkit-style.
Geoffrey Garen
Comment 7 2016-03-08 20:01:46 PST
r=me with some comments > Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp:99 > + if (JSString* string = jsDynamicCast<JSString*>(value()->value())) > + return string->tryGetValueImpl(); Does the compiler guarantee that we won't GC KnownValues during compilation? > Source/WTF/wtf/text/StringImpl.cpp:246 > +Ref<StringImpl> StringImpl::clone() const > +{ > + if (is8Bit()) > + return create(characters8(), length()); > + return create(characters16(), length()); > +} StringImpl already has isolatedCopy(). You should use that and remove this. > Source/WTF/wtf/text/StringImpl.h:-588 > - ASSERT(!isCompilationThread()); I think it would be slightly nicer to ASSERT(!isCompilationThread() || !isAtomic()). That way, we won't use Identifiers on the compilation thread -- which is still totally prohibited.
Filip Pizlo
Comment 8 2016-03-08 20:09:54 PST
(In reply to comment #7) > r=me with some comments > > > Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp:99 > > + if (JSString* string = jsDynamicCast<JSString*>(value()->value())) > > + return string->tryGetValueImpl(); > > Does the compiler guarantee that we won't GC KnownValues during compilation? Yes. We only get JSStrings from FrozenValues, which are already registered with the GC, either strongly (the GC will keep them alive) or weakly (the GC will abort this compilation if they die). Note that the JIT safepoints with the GC, so while this code is running, we know that the GC is either not running at all or it's blocked on our execution lock. We will unlock our execution lock only at points where we know that all FrozenValues are properly accounted for. The GC will see them. > > > Source/WTF/wtf/text/StringImpl.cpp:246 > > +Ref<StringImpl> StringImpl::clone() const > > +{ > > + if (is8Bit()) > > + return create(characters8(), length()); > > + return create(characters16(), length()); > > +} > > StringImpl already has isolatedCopy(). You should use that and remove this. OK. > > > Source/WTF/wtf/text/StringImpl.h:-588 > > - ASSERT(!isCompilationThread()); > > I think it would be slightly nicer to ASSERT(!isCompilationThread() || > !isAtomic()). That way, we won't use Identifiers on the compilation thread > -- which is still totally prohibited. OK.
Filip Pizlo
Comment 9 2016-03-08 20:34:37 PST
Created attachment 273383 [details] patch for landing
WebKit Commit Bot
Comment 10 2016-03-08 20:36:23 PST
Attachment 273383 [details] did not pass style-queue: ERROR: LayoutTests/ChangeLog:1: ChangeLog entry has no bug number [changelog/bugnumber] [5] ERROR: Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp:230: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:1055: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 3 in 33 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 11 2016-03-08 21:26:34 PST
Benjamin Poulain
Comment 12 2016-03-09 00:31:24 PST
The debug bots are in bad shape following this. E.g.: -https://build.webkit.org/builders/Apple%20El%20Capitan%20Debug%20WK2%20%28Tests%29
Benjamin Poulain
Comment 13 2016-03-09 01:00:04 PST
(In reply to comment #12) > The debug bots are in bad shape following this. E.g.: > -https://build.webkit.org/builders/ > Apple%20El%20Capitan%20Debug%20WK2%20%28Tests%29 For reference, the fix is http://trac.webkit.org/changeset/197838
Note You need to log in before you can comment on or make changes to this bug.