WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
144330
[ES6] Implement String.raw
https://bugs.webkit.org/show_bug.cgi?id=144330
Summary
[ES6] Implement String.raw
Yusuke Suzuki
Reported
2015-04-28 07:26:21 PDT
[ES6] Implement String.raw
Attachments
Prototype
(6.42 KB, patch)
2015-04-29 07:11 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(15.52 KB, patch)
2015-05-01 02:48 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(15.30 KB, patch)
2015-05-01 04:21 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(15.69 KB, patch)
2015-05-02 02:04 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(15.73 KB, patch)
2015-05-09 20:35 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2015-04-28 07:27:10 PDT
Before implementing tagged-templates, let's implement String.raw!
Yusuke Suzuki
Comment 2
2015-04-29 07:11:21 PDT
Created
attachment 251949
[details]
Prototype Initial prototype.
Yusuke Suzuki
Comment 3
2015-05-01 02:48:35 PDT
Created
attachment 252145
[details]
Patch
Yusuke Suzuki
Comment 4
2015-05-01 04:21:47 PDT
Created
attachment 252147
[details]
Patch
Darin Adler
Comment 5
2015-05-01 15:29:13 PDT
Comment on
attachment 252147
[details]
Patch GTK build failure: DerivedSources/JavaScriptCore/StringConstructor.lut.h:35:83: error: 'stringRaw' was not declared in this scope
Yusuke Suzuki
Comment 6
2015-05-02 02:03:46 PDT
(In reply to
comment #5
)
> Comment on
attachment 252147
[details]
> Patch > > GTK build failure: > DerivedSources/JavaScriptCore/StringConstructor.lut.h:35:83: error: > 'stringRaw' was not declared in this scope
I think this is because JSCBuiltin.h is not updated correctly due to CMakeList.txt dependencies. I'll add blank line to CMakeLists.txt to force update.
Yusuke Suzuki
Comment 7
2015-05-02 02:04:25 PDT
Created
attachment 252225
[details]
Patch
Sam Weinig
Comment 8
2015-05-03 18:26:47 PDT
Comment on
attachment 252225
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=252225&action=review
> Source/JavaScriptCore/CMakeLists.txt:1215 > add_dependencies(JavaScriptCore llvmForJSC) > endif () > > +
Seems unrelated.
Yusuke Suzuki
Comment 9
2015-05-04 15:52:09 PDT
Comment on
attachment 252225
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=252225&action=review
>> Source/JavaScriptCore/CMakeLists.txt:1215 >> + > > Seems unrelated.
Yes, This is added from the previous patch because GTK's build dependency doesn't flush JSCBuiltins.h correctly. (Due to it, the previous patch fails only in GTK EWS)
https://bugs.webkit.org/show_bug.cgi?id=144330#c6
Adding a blank line to CMakeLists.txt forces CMake to generate new rule files and it refreshes JSCBuiltins.h. So when landing it, I'll remove this line :D (And maybe, I need to request full re-build to build bots for GTK ports)
Yusuke Suzuki
Comment 10
2015-05-08 14:06:08 PDT
Could anyone take a look?
Ryosuke Niwa
Comment 11
2015-05-09 17:04:40 PDT
Comment on
attachment 252225
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=252225&action=review
> Source/JavaScriptCore/builtins/StringConstructor.js:36 > + var raw = @Object(rawValue);
I know you're matching the spec text but it's somewhat confusing to have a variable name "raw" inside a function also named "raw".
> Source/JavaScriptCore/builtins/StringConstructor.js:40 > + var maxSafeInteger = 9007199254740991;
Can we just use 0x1FFFFFFFFFFFFF instead?
> Source/JavaScriptCore/builtins/StringConstructor.js:49 > + if (numberValue != numberValue) { // isNaN(numberValue) > + lengthValue = 0; > + } else if (numberValue === 0 || !@isFinite(numberValue)) { > + lengthValue = numberValue; > + } else { > + lengthValue = (numberValue > 0 ? 1 : -1) * @floor(@abs(numberValue)); > + }
These line shouldn't have curly braces per our style guideline.
> Source/JavaScriptCore/builtins/StringConstructor.js:51 > + var literalSegments = lengthValue > 0 ? (lengthValue < maxSafeInteger ? lengthValue : maxSafeInteger) : 0;
It seems like this variable name out to end with nouns such as count and length since this is really the maximum length we're allowed to process. Perhaps maximumSegmentCount?
> Source/JavaScriptCore/builtins/StringConstructor.js:57 > + var nextIndex = 0;
I'm not sure "nextIndex" provides any more semantics than just calling this "i".
> Source/JavaScriptCore/builtins/StringConstructor.js:58 > + while (true) {
Can we just do: for (var nextIndex = 0; ; nextIndex++) instead?
> Source/JavaScriptCore/builtins/StringConstructor.js:68 > + // |arguments| contain the first argument, |template|. > + next = @toString(arguments[nextIndex + 1]);
Instead of adding a comment like this, how about defining two local variables? var indexInRaw = i; var indexInArguments = i + 1;
Yusuke Suzuki
Comment 12
2015-05-09 18:39:32 PDT
Comment on
attachment 252225
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=252225&action=review
Thank you for your review!
>> Source/JavaScriptCore/builtins/StringConstructor.js:36 >> + var raw = @Object(rawValue); > > I know you're matching the spec text but it's somewhat confusing to have a variable name "raw" inside a function also named "raw".
Make sense. So replace it with `rawSegments`. (And replace `cooked` to `cookedSegments`)
>> Source/JavaScriptCore/builtins/StringConstructor.js:40 >> + var maxSafeInteger = 9007199254740991; > > Can we just use 0x1FFFFFFFFFFFFF instead?
Looks nice. Fixed.
>> Source/JavaScriptCore/builtins/StringConstructor.js:49 >> + } > > These line shouldn't have curly braces per our style guideline.
Oops. Fixed.
>> Source/JavaScriptCore/builtins/StringConstructor.js:51 >> + var literalSegments = lengthValue > 0 ? (lengthValue < maxSafeInteger ? lengthValue : maxSafeInteger) : 0; > > It seems like this variable name out to end with nouns such as count and length > since this is really the maximum length we're allowed to process. > Perhaps maximumSegmentCount?
Make sense. I suggest `segmentCount` because this is the count of the given segment array.
>> Source/JavaScriptCore/builtins/StringConstructor.js:57 >> + var nextIndex = 0; > > I'm not sure "nextIndex" provides any more semantics than just calling this "i".
OK, just use `i`.
>> Source/JavaScriptCore/builtins/StringConstructor.js:58 >> + while (true) { > > Can we just do: > for (var nextIndex = 0; ; nextIndex++) > instead?
Looks nice. The current implementation is aligned to the spec. But, we can a little bit clean up the implementation. I'll rewrite it.
>> Source/JavaScriptCore/builtins/StringConstructor.js:68 >> + next = @toString(arguments[nextIndex + 1]); > > Instead of adding a comment like this, how about defining two local variables? > var indexInRaw = i; > var indexInArguments = i + 1;
Looks nice. I'll use a local variable, `substitutionIndexInArguments`.
Yusuke Suzuki
Comment 13
2015-05-09 20:35:45 PDT
Created
attachment 252801
[details]
Patch
WebKit Commit Bot
Comment 14
2015-05-13 09:50:01 PDT
Comment on
attachment 252801
[details]
Patch Clearing flags on attachment: 252801 Committed
r184287
: <
http://trac.webkit.org/changeset/184287
>
WebKit Commit Bot
Comment 15
2015-05-13 09:50:06 PDT
All reviewed patches have been landed. Closing bug.
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