RESOLVED FIXED 26857
[Chromium] Upstream V8Binding
https://bugs.webkit.org/show_bug.cgi?id=26857
Summary [Chromium] Upstream V8Binding
Nate Chapin
Reported 2009-06-30 13:42:22 PDT
See summary.
Attachments
patch (28.66 KB, patch)
2009-06-30 13:51 PDT, Nate Chapin
no flags
patch2 (31.07 KB, patch)
2009-07-01 11:12 PDT, Nate Chapin
no flags
patch3 (33.44 KB, patch)
2009-07-01 16:44 PDT, Nate Chapin
levin: review-
patch4 (33.21 KB, patch)
2009-07-02 14:27 PDT, Nate Chapin
levin: review-
patch5 (33.18 KB, patch)
2009-07-02 17:00 PDT, Nate Chapin
levin: review+
Nate Chapin
Comment 1 2009-06-30 13:51:25 PDT
Eric Seidel (no email)
Comment 2 2009-06-30 14:41:57 PDT
Comment on attachment 32090 [details] patch Seems strange that valueToStringWithNullOrUndefinedCheck is the odd-man out here. All the rest are toWebCoreString() instead of valueTo*
Dimitri Glazkov (Google)
Comment 3 2009-06-30 19:45:31 PDT
Comment on attachment 32090 [details] patch Clearing the flag, Nate's working on a bigger/better naming convention. Oh, and it's also faster. Because obviously fastness is important.
Nate Chapin
Comment 4 2009-07-01 11:12:10 PDT
Nate Chapin
Comment 5 2009-07-01 16:44:47 PDT
Created attachment 32159 [details] patch3 Forgot to edit CodeGeneratorV8.pm upstream in previous patches.
David Levin
Comment 6 2009-07-01 22:46:40 PDT
Comment on attachment 32159 [details] patch3 A few things to address. > Index: WebCore/bindings/v8/V8Binding.cpp > +class WebCoreStringResource: public v8::String::ExternalStringResource { Add a space after WebCoreStringResource. > +public: > + explicit WebCoreStringResource(const String& string) > + : m_impl(string.impl()) { } The { } should go on separate lines at this point. > + > + virtual ~WebCoreStringResource() {} Add space in {} > +String v8StringToWebCoreString(v8::Handle<v8::String> v8String, bool externalize) > +{ > + WebCoreStringResource* stringResource = static_cast<WebCoreStringResource*>(v8String->GetExternalStringResource()); > + if (stringResource) > + return stringResource->webcoreString(); > + > + int length = v8String->Length(); > + if (length == 0) { Comparison to 0. > +String v8ValueToWebCoreString(v8::Handle<v8::Value> object) > +{ > + if (object->IsString()) { > + v8::Handle<v8::String> v8String = v8::Handle<v8::String>::Cast(object); > + String webCoreString = v8StringToWebCoreString(v8String, true); > + return webCoreString; This seems overly verbose plus it may inhibit return value optimization. I'd suggest just doing: return v8StringToWebCoreString(v8String, true); > + } else if (object->IsInt32()) { > + int value = object->Int32Value(); > + // Most numbers used are <= 100. Even if they aren't used there's very little in using the space. > + const int kLowNumbers = 100; > + static AtomicString lowNumbers[kLowNumbers + 1]; Consider using DEFINE_STATIC_LOCAL > Property changes on: WebCore/bindings/v8/V8Binding.cpp > ___________________________________________________________________ > Added: svn:executable > + * This should be fixed. > Index: WebCore/bindings/v8/V8Binding.h > +#include "config.h" Don't include config.h in header files.
Nate Chapin
Comment 7 2009-07-02 14:27:18 PDT
David Levin
Comment 8 2009-07-02 15:16:25 PDT
Comment on attachment 32198 [details] patch4 A few last things to address: > Index: WebCore/bindings/v8/V8Binding.cpp > +class WebCoreStringResource : public v8::String::ExternalStringResource { > +public: > + explicit WebCoreStringResource(const String& string) > + : m_impl(string.impl()) { } The { } should go on separate lines (since you have initializers). > +String v8StringToWebCoreString(v8::Handle<v8::String> v8String, bool externalize) > +{ ... > + > + int length = v8String->Length(); > + if (length) { if (!length) > +String v8ValueToWebCoreString(v8::Handle<v8::Value> object) > +{ ... > + return webCoreString; > + } else { This else should go away since there is a "return" finishing the previous block.
Nate Chapin
Comment 9 2009-07-02 17:00:56 PDT
Nate Chapin
Comment 10 2009-07-06 16:21:01 PDT
Rolled back in r45574 because it was going to be breaking the Chromium canary for too long, will resubmit tomorrow.
Nate Chapin
Comment 11 2009-07-07 13:09:34 PDT
Re-landed at r45603.
Note You need to log in before you can comment on or make changes to this bug.