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

Unified Diff: runtime/vm/symbols.cc

Issue 11411092: Revert "Add some support for the code-point code-unit distinction." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/symbols.h ('k') | runtime/vm/unicode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/symbols.cc
diff --git a/runtime/vm/symbols.cc b/runtime/vm/symbols.cc
index b0d4801a9a57311c03c324ab47f439799b028b6e..a135ec6092f23dd55e7b9ac6ccdcbfcfb3efafd7 100644
--- a/runtime/vm/symbols.cc
+++ b/runtime/vm/symbols.cc
@@ -55,7 +55,7 @@ void Symbols::InitOnce(Isolate* isolate) {
}
Object::RegisterSingletonClassNames();
- for (uint16_t c = 0; c <= kMaxOneCharCodeSymbol; c++) {
+ for (uint32_t c = 0; c <= kMaxOneCharCodeSymbol; c++) {
ASSERT(kMaxPredefinedId + c < kMaxId);
predefined_[kMaxPredefinedId + c] = New(&c, 1);
}
@@ -102,7 +102,7 @@ RawString* Symbols::New(const char* str) {
Utf8::Type type;
intptr_t str_len = strlen(str);
const uint8_t* utf8_array = reinterpret_cast<const uint8_t*>(str);
- intptr_t len = Utf8::CodeUnitCount(utf8_array, str_len, &type);
+ intptr_t len = Utf8::CodePointCount(utf8_array, str_len, &type);
Zone* zone = Isolate::Current()->current_zone();
if (len == 0) {
return Symbols::New(reinterpret_cast<uint8_t*>(NULL), 0);
@@ -152,6 +152,7 @@ RawString* Symbols::New(const T* characters, intptr_t len) {
template RawString* Symbols::New(const uint8_t* characters, intptr_t len);
template RawString* Symbols::New(const uint16_t* characters, intptr_t len);
+template RawString* Symbols::New(const uint32_t* characters, intptr_t len);
RawString* Symbols::New(const String& str) {
@@ -203,16 +204,9 @@ RawString* Symbols::New(const String& str, intptr_t begin_index, intptr_t len) {
}
-RawString* Symbols::FromCharCode(int32_t char_code) {
+RawString* Symbols::FromCharCode(uint32_t char_code) {
if (char_code > kMaxOneCharCodeSymbol) {
- if (char_code > Utf16::kMaxBmpCodepoint) {
- uint16_t code_units[2];
- Utf16::Encode(char_code, &code_units[0]);
- return New(&code_units[0], 2);
- } else {
- uint16_t code_unit = char_code;
- return New(&code_unit, 1);
- }
+ return New(&char_code, 1);
}
return predefined_[kNullCharId + char_code];
}
@@ -294,6 +288,11 @@ template intptr_t Symbols::FindIndex(const Array& symbol_table,
const uint16_t* characters,
intptr_t len,
intptr_t hash);
+template intptr_t Symbols::FindIndex(const Array& symbol_table,
+ const uint32_t* characters,
+ intptr_t len,
+ intptr_t hash);
+
intptr_t Symbols::FindIndex(const Array& symbol_table,
const String& str,
« no previous file with comments | « runtime/vm/symbols.h ('k') | runtime/vm/unicode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698