Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Issue 11318018: - Represent strings internally in UTF-16 format, this makes it (Closed)

Created:
8 years, 1 month ago by siva
Modified:
8 years, 1 month ago
CC:
reviews_dartlang.org, erikcorry
Visibility:
Public.

Description

- Represent strings internally in UTF-16 format, this makes it compatible with webkit and will allow for easy externalization of strings. One byte strings are retained for pure ASCII strings. (The language specification was changed recently to reflect this as follows "A string is a sequence of UTF-16 code units"). - Remove four byte string class and all references to it. - Rename some of the string functions in Dart API to make them consistent and better describe the underlying functionality Dart_NewString => Dart_NewStringFromCString Dart_NewString8 => Dart_NewStringFromUTF8 Dart_NewString16 => Dart_NewStringFromUTF16 Dart_NewString32 => Dart_NewStringFromUTF32 Dart_NewExternalString8 => Dart_NewExternalUTF8String Dart_NewExternalString16 => Dart_NewExternalUTF16String Dart_NewExternalString32 => Dart_NewExternalUTF32String Dart_StringGet8 => Dart_StringToUTF8 Dart_StringGet16 => Dart_StringToUTF16 Dart_StringToCString => Dart_StringToCString Dart_IsString8 => Removed Dart_IsString16 -> Removed Dart_StringToBytes -> Removed Dart_StringGet32 -> Removed Committed: https://code.google.com/p/dart/source/detail?r=14357

Patch Set 1 #

Total comments: 10

Patch Set 2 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+1250 lines, -2013 lines) Patch
M runtime/bin/builtin.cc View 1 3 chunks +5 lines, -4 lines 0 comments Download
M runtime/bin/builtin_natives.cc View 1 2 chunks +7 lines, -4 lines 0 comments Download
M runtime/bin/builtin_nolib.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/bin/common.cc View 1 1 chunk +5 lines, -5 lines 0 comments Download
M runtime/bin/crypto.cc View 1 3 chunks +3 lines, -3 lines 0 comments Download
M runtime/bin/dartutils.h View 1 1 chunk +7 lines, -0 lines 0 comments Download
M runtime/bin/dartutils.cc View 1 12 chunks +35 lines, -33 lines 0 comments Download
M runtime/bin/dbg_message.cc View 1 3 chunks +5 lines, -5 lines 0 comments Download
M runtime/bin/directory.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/bin/file.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/bin/gen_snapshot.cc View 1 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/bin/main.cc View 1 10 chunks +17 lines, -14 lines 0 comments Download
M runtime/bin/platform.cc View 1 3 chunks +5 lines, -4 lines 0 comments Download
M runtime/bin/socket.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/test_extension.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M runtime/include/dart_api.h View 1 3 chunks +56 lines, -107 lines 0 comments Download
M runtime/lib/mirrors.cc View 1 25 chunks +34 lines, -29 lines 0 comments Download
M runtime/lib/string.cc View 1 2 chunks +14 lines, -15 lines 0 comments Download
M runtime/vm/benchmark_test.h View 1 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/benchmark_test.cc View 1 3 chunks +10 lines, -20 lines 0 comments Download
M runtime/vm/class_finalizer.cc View 1 2 chunks +0 lines, -6 lines 0 comments Download
M runtime/vm/custom_isolate_test.cc View 1 2 chunks +3 lines, -3 lines 0 comments Download
M runtime/vm/dart_api_impl.cc View 1 5 chunks +60 lines, -136 lines 2 comments Download
M runtime/vm/dart_api_impl_test.cc View 1 175 chunks +398 lines, -428 lines 0 comments Download
M runtime/vm/dart_api_message.cc View 1 1 chunk +0 lines, -3 lines 0 comments Download
M runtime/vm/debugger_api_impl_test.cc View 1 8 chunks +11 lines, -11 lines 0 comments Download
M runtime/vm/exceptions_test.cc View 1 3 chunks +5 lines, -5 lines 0 comments Download
M runtime/vm/flow_graph_compiler.cc View 1 1 chunk +0 lines, -2 lines 0 comments Download
M runtime/vm/heap_profiler.cc View 1 3 chunks +3 lines, -16 lines 0 comments Download
M runtime/vm/heap_test.cc View 1 2 chunks +2 lines, -6 lines 0 comments Download
M runtime/vm/isolate_test.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/object.h View 1 6 chunks +32 lines, -130 lines 0 comments Download
M runtime/vm/object.cc View 1 24 chunks +125 lines, -363 lines 0 comments Download
M runtime/vm/object_store.h View 1 3 chunks +0 lines, -14 lines 0 comments Download
M runtime/vm/object_store.cc View 1 1 chunk +0 lines, -2 lines 0 comments Download
M runtime/vm/object_test.cc View 1 26 chunks +92 lines, -304 lines 0 comments Download
M runtime/vm/raw_object.h View 1 9 chunks +23 lines, -42 lines 0 comments Download
M runtime/vm/raw_object.cc View 1 3 chunks +0 lines, -24 lines 0 comments Download
M runtime/vm/raw_object_snapshot.cc View 1 4 chunks +0 lines, -70 lines 0 comments Download
M runtime/vm/snapshot.h View 1 2 chunks +0 lines, -2 lines 0 comments Download
M runtime/vm/snapshot.cc View 1 1 chunk +0 lines, -7 lines 0 comments Download
M runtime/vm/snapshot_test.cc View 1 8 chunks +16 lines, -16 lines 0 comments Download
M runtime/vm/stack_frame_test.cc View 1 2 chunks +4 lines, -4 lines 0 comments Download
M runtime/vm/symbols.h View 1 1 chunk +0 lines, -2 lines 0 comments Download
M runtime/vm/symbols.cc View 1 1 chunk +11 lines, -11 lines 0 comments Download
M runtime/vm/unicode.h View 1 2 chunks +39 lines, -6 lines 0 comments Download
M runtime/vm/unicode.cc View 1 6 chunks +99 lines, -49 lines 0 comments Download
M runtime/vm/unicode_test.cc View 1 85 chunks +86 lines, -85 lines 0 comments Download
M runtime/vm/unit_test.h View 1 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/unit_test.cc View 1 3 chunks +4 lines, -4 lines 0 comments Download
M samples/sample_extension/sample_extension.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M tests/co19/co19-dart2js.status View 1 1 chunk +1 line, -1 line 0 comments Download
M tests/co19/co19-runtime.status View 1 1 chunk +4 lines, -0 lines 0 comments Download
M tests/language/char_escape_test.dart View 1 1 chunk +6 lines, -6 lines 0 comments Download
M tests/utils/utils.status View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
siva
Moved the changelist over to dart-all Peter could you review the dart2js parts.
8 years, 1 month ago (2012-10-27 01:01:21 UTC) #1
ngeoffray
https://chromiumcodereview.appspot.com/11318018/diff/1/lib/compiler/implementation/string_validator.dart File lib/compiler/implementation/string_validator.dart (right): https://chromiumcodereview.appspot.com/11318018/diff/1/lib/compiler/implementation/string_validator.dart#newcode102 lib/compiler/implementation/string_validator.dart:102: bool verify_code = false; verify_code -> verifyCode
8 years, 1 month ago (2012-10-27 09:02:00 UTC) #2
ahe
I don't think representing strings in UTF-16 is good for Dart users. So I would ...
8 years, 1 month ago (2012-10-28 12:07:02 UTC) #3
cshapiro
http://codereview.chromium.org/11318018/diff/1/lib/compiler/implementation/string_validator.dart File lib/compiler/implementation/string_validator.dart (right): http://codereview.chromium.org/11318018/diff/1/lib/compiler/implementation/string_validator.dart#newcode175 lib/compiler/implementation/string_validator.dart:175: if (verify_code && !isUnicodeScalarValue(code)) { The specification for string ...
8 years, 1 month ago (2012-10-29 06:37:17 UTC) #4
ahe
http://codereview.chromium.org/11318018/diff/1/lib/compiler/implementation/string_validator.dart File lib/compiler/implementation/string_validator.dart (right): http://codereview.chromium.org/11318018/diff/1/lib/compiler/implementation/string_validator.dart#newcode175 lib/compiler/implementation/string_validator.dart:175: if (verify_code && !isUnicodeScalarValue(code)) { On 2012/10/29 06:37:17, cshapiro ...
8 years, 1 month ago (2012-10-29 08:11:07 UTC) #5
ahe
Erik Corry has convinced me that UTF-16 is the best way to represent Dart strings. ...
8 years, 1 month ago (2012-10-29 10:58:12 UTC) #6
siva
http://codereview.chromium.org/11318018/diff/1/lib/compiler/implementation/js_backend/constant_emitter.dart File lib/compiler/implementation/js_backend/constant_emitter.dart (right): http://codereview.chromium.org/11318018/diff/1/lib/compiler/implementation/js_backend/constant_emitter.dart#newcode113 lib/compiler/implementation/js_backend/constant_emitter.dart:113: if (code >= 0xD800 && code <= 0xDFFF) { ...
8 years, 1 month ago (2012-10-31 01:21:25 UTC) #7
siva
- Dropped the dart2js compiler changes from this CL - updated status files to reflect ...
8 years, 1 month ago (2012-10-31 01:50:11 UTC) #8
Bill Hesse
There seems to be a bug in Dart_StringToUTF8. I have changed print in builtin_natives.cc to ...
8 years, 1 month ago (2012-11-01 11:35:02 UTC) #9
siva
8 years, 1 month ago (2012-11-01 20:04:11 UTC) #10
https://codereview.chromium.org/11318018/diff/20001/runtime/vm/dart_api_impl.cc
File runtime/vm/dart_api_impl.cc (right):

https://codereview.chromium.org/11318018/diff/20001/runtime/vm/dart_api_impl....
runtime/vm/dart_api_impl.cc:1674: intptr_t str_len = str_obj.Length();
Yes that should be
intptr_t str_len = Utf8::Length(str_obj);

I have uploaded a new CL for this.

On 2012/11/01 11:35:02, Bill Hesse wrote:
> This seems totally wrong, unless we restrict the function to only apply to
> one-byte strings (ascii).  There is no way to get the UTF8 length from a
string
> except Uft8::Length, as far as I see, and this is not exposed through the API,
> so the API user has no way to pass the correct size array in.

Powered by Google App Engine
This is Rietveld 408576698