RESOLVED FIXED 26561
Remove memcpy from ScriptSourceCode::source()
https://bugs.webkit.org/show_bug.cgi?id=26561
Summary Remove memcpy from ScriptSourceCode::source()
Adam Barth
Reported 2009-06-19 16:40:01 PDT
Darin worries that this memcpy might be slow. Patch forthcoming.
Attachments
patch (1.75 KB, patch)
2009-06-19 16:44 PDT, Adam Barth
no flags
patch (1.75 KB, patch)
2009-06-19 16:46 PDT, Adam Barth
darin: review+
Adam Barth
Comment 1 2009-06-19 16:44:10 PDT
Created attachment 31574 [details] patch Notice that the string is kept alive anyway because the ScriptSourceCode holds a JSC::SourceCode which holds a RefPtr<SourceProvider> which holds String m_source (via StringSourceProvider : public JSC::SourceProvider).
Adam Barth
Comment 2 2009-06-19 16:46:17 PDT
Created attachment 31576 [details] patch Oops. Forgot the const.
Darin Adler
Comment 3 2009-06-19 18:12:13 PDT
Comment on attachment 31574 [details] patch > + // This same string is actually buried in m_code, but there isn't a clean > + // want to write an accessor for it, so we cache a refernce to it. > + String m_source; "clean want"? How about "clean way"? But I do think there is a clean way to get at it. Just add a source() member to StringSourceProvider, then call static_cast<StringSourceProvider*>(m_code->provider())->source().
Darin Adler
Comment 4 2009-06-19 18:12:47 PDT
Comment on attachment 31576 [details] patch It's not really buried all that deeply. I seriously think you could just do static_cast<StringSourceProvider*>(m_code->provider())->source(). r=me
Adam Barth
Comment 5 2009-06-20 01:14:24 PDT
> It's not really buried all that deeply. I seriously think you could just do > static_cast<StringSourceProvider*>(m_code->provider())->source(). r=me Ah. I hadn't considered using a static_cast. That should work.
Adam Barth
Comment 6 2009-06-20 02:21:40 PDT
Sending WebCore/ChangeLog Sending WebCore/bindings/js/ScriptSourceCode.h Sending WebCore/bindings/js/StringSourceProvider.h Transmitting file data ... Committed revision 44894.
Note You need to log in before you can comment on or make changes to this bug.