Chromium Code Reviews| Index: runtime/vm/object.h |
| diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
| index 031a8541598da68e52d7e4eba1aefbd5114350b9..810fedf7044df9a58ca0e96e8ba74e7d20d305af 100644 |
| --- a/runtime/vm/object.h |
| +++ b/runtime/vm/object.h |
| @@ -17,6 +17,7 @@ |
| #include "vm/os.h" |
| #include "vm/raw_object.h" |
| #include "vm/scanner.h" |
| +#include "vm/unicode.h" |
| namespace dart { |
| @@ -3716,8 +3717,13 @@ class String : public Instance { |
| static intptr_t Hash(const String& str, intptr_t begin_index, intptr_t len); |
| static intptr_t Hash(const uint8_t* characters, intptr_t len); |
| static intptr_t Hash(const uint16_t* characters, intptr_t len); |
| - static intptr_t Hash(const uint32_t* characters, intptr_t len); |
| + static intptr_t Hash(const int32_t* characters, intptr_t len); |
| + // Despite the name, this does not return the character. It returns the |
| + // UTF-16 code unit at an index. UTF-16 is a superset of ASCII so you can |
| + // always use this if you are looking for ASCII. If you need to support |
|
siva
2012/11/16 22:32:04
Should we say ASCII or Latin1 here?
erikcorry
2012/11/19 12:40:41
Now says both.
|
| + // arbitrary Unicode characters then you should perhaps be using |
| + // Utf16::CharCodeAt(string, index), which returns the full 21 bit code point. |
| int32_t CharAt(intptr_t index) const; |
| intptr_t CharSize() const; |
| @@ -3729,7 +3735,7 @@ class String : public Instance { |
| bool Equals(const char* str) const; |
| bool Equals(const uint8_t* characters, intptr_t len) const; |
| bool Equals(const uint16_t* characters, intptr_t len) const; |
| - bool Equals(const uint32_t* characters, intptr_t len) const; |
| + bool Equals(const int32_t* characters, intptr_t len) const; |
| virtual bool Equals(const Instance& other) const; |
| @@ -3780,7 +3786,7 @@ class String : public Instance { |
| Heap::Space space = Heap::kNew); |
| // Creates a new String object from an array of UTF-32 encoded characters. |
| - static RawString* New(const uint32_t* utf32_array, |
| + static RawString* New(const int32_t* utf32_array, |
| intptr_t array_len, |
| Heap::Space space = Heap::kNew); |
| @@ -3926,7 +3932,7 @@ class OneByteString : public AllStatic { |
| static RawOneByteString* New(const uint16_t* characters, |
| intptr_t len, |
| Heap::Space space); |
| - static RawOneByteString* New(const uint32_t* characters, |
| + static RawOneByteString* New(const int32_t* characters, |
| intptr_t len, |
| Heap::Space space); |
| static RawOneByteString* New(const String& str, |
| @@ -3941,6 +3947,7 @@ class OneByteString : public AllStatic { |
| static RawOneByteString* Transform(int32_t (*mapping)(int32_t ch), |
| const String& str, |
| + int out_length, |
|
siva
2012/11/16 22:32:04
we always use intptr_t for length values in the VM
erikcorry
2012/11/19 12:40:41
Done.
|
| Heap::Space space); |
| static const ClassId kClassId = kOneByteStringCid; |
| @@ -4009,7 +4016,7 @@ class TwoByteString : public AllStatic { |
| intptr_t len, |
| Heap::Space space); |
| static RawTwoByteString* New(intptr_t utf16_len, |
| - const uint32_t* characters, |
| + const int32_t* characters, |
| intptr_t len, |
| Heap::Space space); |
| static RawTwoByteString* New(const String& str, |
| @@ -4024,6 +4031,7 @@ class TwoByteString : public AllStatic { |
| static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch), |
| const String& str, |
| + int out_length, |
|
siva
2012/11/16 22:32:04
Ditto.
erikcorry
2012/11/19 12:40:41
Done.
|
| Heap::Space space); |
| static RawTwoByteString* null() { |