WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
109709
wtf/dtoa/* uses a confusing name to reference its buffers
https://bugs.webkit.org/show_bug.cgi?id=109709
Summary
wtf/dtoa/* uses a confusing name to reference its buffers
Eric Seidel (no email)
Reported
2013-02-13 10:05:59 PST
wtf/dota/* is copying Vectors all over the place I suspect this code was ported from stl. In WTF, Vector<T> as an argument will copy the whole contents of the vector, so we normally use const Vector<T>& grep -r "(Vector" * | grep -v '&' wtf/dtoa/bignum.cc: static uint64_t ReadUInt64(Vector<const char> buffer, wtf/dtoa/bignum.cc: void Bignum::AssignDecimalString(Vector<const char> value) { wtf/dtoa/bignum.cc: void Bignum::AssignHexString(Vector<const char> value) { wtf/dtoa/bignum.h: void AssignDecimalString(Vector<const char> value); wtf/dtoa/bignum.h: void AssignHexString(Vector<const char> value); wtf/dtoa/double-conversion.cc: double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); wtf/dtoa/fast-dtoa.cc: static bool RoundWeed(Vector<char> buffer, wtf/dtoa/fast-dtoa.cc: static bool RoundWeedCounted(Vector<char> buffer, wtf/dtoa/fixed-dtoa.cc: static void RoundUp(Vector<char> buffer, int* length, int* decimal_point) { wtf/dtoa/fixed-dtoa.cc: static void TrimZeros(Vector<char> buffer, int* length, int* decimal_point) { wtf/dtoa/strtod.cc: static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) { wtf/dtoa/strtod.cc: static Vector<const char> TrimTrailingZeros(Vector<const char> buffer) { wtf/dtoa/strtod.cc: static void TrimToMaxSignificantDigits(Vector<const char> buffer, wtf/dtoa/strtod.cc: static uint64_t ReadUint64(Vector<const char> buffer, wtf/dtoa/strtod.cc: static void ReadDiyFp(Vector<const char> buffer, wtf/dtoa/strtod.cc: static bool DoubleStrtod(Vector<const char> trimmed, wtf/dtoa/strtod.cc: static bool DiyFpStrtod(Vector<const char> buffer, wtf/dtoa/strtod.cc: static double BignumStrtod(Vector<const char> buffer, wtf/dtoa/strtod.cc: double Strtod(Vector<const char> buffer, int exponent) { wtf/dtoa/strtod.cc: return Strtod(Vector<const char>(significant_buffer, wtf/dtoa/strtod.h: double Strtod(Vector<const char> buffer, int exponent);
Attachments
Patch
(24.95 KB, patch)
2013-02-21 16:07 PST
,
Benjamin Poulain
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Benjamin Poulain
Comment 1
2013-02-20 19:05:47 PST
Interesting find! Do you want me to take care of it or do you already have a patch?
Eric Seidel (no email)
Comment 2
2013-02-20 19:15:27 PST
I have no plans to write a patch anytime soon, sadly. Must... finish... parser...
Eric Seidel (no email)
Comment 3
2013-02-20 19:16:10 PST
Aka, it's all yours if you want it. I would expect this to show up in Dromeo numbers. :)
Benjamin Poulain
Comment 4
2013-02-21 16:07:14 PST
Created
attachment 189627
[details]
Patch
WebKit Review Bot
Comment 5
2013-02-21 16:09:22 PST
Attachment 189627
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WTF/ChangeLog', u'Source/WTF/wtf/dtoa/bignum-dtoa.cc', u'Source/WTF/wtf/dtoa/bignum-dtoa.h', u'Source/WTF/wtf/dtoa/bignum.cc', u'Source/WTF/wtf/dtoa/bignum.h', u'Source/WTF/wtf/dtoa/double-conversion.cc', u'Source/WTF/wtf/dtoa/fast-dtoa.cc', u'Source/WTF/wtf/dtoa/fast-dtoa.h', u'Source/WTF/wtf/dtoa/fixed-dtoa.cc', u'Source/WTF/wtf/dtoa/fixed-dtoa.h', u'Source/WTF/wtf/dtoa/strtod.cc', u'Source/WTF/wtf/dtoa/strtod.h', u'Source/WTF/wtf/dtoa/utils.h']" exit_code: 1 Source/WTF/wtf/dtoa/fast-dtoa.h:80: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WTF/wtf/dtoa/fast-dtoa.h:80: The parameter name "buffer" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WTF/wtf/dtoa/bignum.h:133: bigits_ is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Source/WTF/wtf/dtoa/bignum-dtoa.h:80: The parameter name "buffer" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WTF/wtf/dtoa/bignum-dtoa.h:80: When wrapping a line, only indent 4 spaces. [whitespace/indent] [3] Source/WTF/wtf/dtoa/utils.h:144: Missing space inside { }. [whitespace/braces] [5] Source/WTF/wtf/dtoa/utils.h:144: Use 0 instead of NULL. [readability/null] [5] Source/WTF/wtf/dtoa/utils.h:145: Place brace on its own line for function definitions. [whitespace/braces] [4] Source/WTF/wtf/dtoa/utils.h:151: Place brace on its own line for function definitions. [whitespace/braces] [4] Source/WTF/wtf/dtoa/utils.h:258: buffer_ is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Source/WTF/wtf/dtoa/strtod.h:39: Code inside a namespace should not be indented. [whitespace/indent] [4] Source/WTF/wtf/dtoa/strtod.h:39: The parameter name "buffer" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WTF/wtf/dtoa/fixed-dtoa.h:54: The parameter name "buffer" adds no information, so it should be removed. [readability/parameter_name] [5] Source/WTF/wtf/dtoa/fixed-dtoa.h:54: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Total errors found: 14 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Seidel (no email)
Comment 6
2013-02-21 16:10:03 PST
Comment on
attachment 189627
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=189627&action=review
> Source/WTF/wtf/dtoa/utils.h:140 > - // This is a simplified version of V8's Vector class. > + // This is a simplified version of V8's BufferReference class.
Probably want to fix this comment now.
Eric Seidel (no email)
Comment 7
2013-02-21 16:10:41 PST
Did we copy this code from v8? Do we intend to maintain a copy? Do we want it to diverge?
Benjamin Poulain
Comment 8
2013-02-21 16:14:13 PST
> > Source/WTF/wtf/dtoa/utils.h:140 > > - // This is a simplified version of V8's Vector class. > > + // This is a simplified version of V8's BufferReference class. > > Probably want to fix this comment now.
Oops, will do. I should probably have read the result of my FindAndReplace :)
> Did we copy this code from v8? Do we intend to maintain a copy? Do we want it to diverge?
We already improved the V8 code quite a bit since it was imported.
Darin Adler
Comment 9
2013-04-08 10:24:09 PDT
Comment on
attachment 189627
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=189627&action=review
>> Source/WTF/wtf/dtoa/utils.h:140 >> - // This is a simplified version of V8's Vector class. >> + // This is a simplified version of V8's BufferReference class. > > Probably want to fix this comment now.
Let me amplify what Eric said. This comment makes no sense like this. Please fix it before landing.
Darin Adler
Comment 10
2013-04-08 10:25:09 PDT
Comment on
attachment 189627
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=189627&action=review
>>> Source/WTF/wtf/dtoa/utils.h:140 >>> + // This is a simplified version of V8's BufferReference class. >> >> Probably want to fix this comment now. > > Let me amplify what Eric said. This comment makes no sense like this. Please fix it before landing.
Oops, I now see Ben replying, so he didn’t need me to say this again! Sorry.
Benjamin Poulain
Comment 11
2013-04-08 19:27:34 PDT
Committed
r147976
: <
http://trac.webkit.org/changeset/147976
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug