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

Unified Diff: runtime/vm/object.h

Issue 11412258: Use the code point iterator when computing 16-bit string hash codes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: bugfix 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/tests/vm/vm.status ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 5355fb1364f2b9989ed622fa22d5efd32b3b6fa1..721b83a5cd3f7394df11d04ecf565bdded92b674 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -3742,13 +3742,23 @@ class String : public Instance {
public:
explicit CodePointIterator(const String& str)
: str_(str),
+ ch_(0),
index_(-1),
- ch_(-1) {
+ end_(str.Length()) {
+ }
+
+ CodePointIterator(const String& str, intptr_t start, intptr_t length)
+ : str_(str),
+ ch_(0),
+ index_(start - 1),
+ end_(start + length) {
+ ASSERT(start >= 0);
+ ASSERT(end_ <= str.Length());
}
int32_t Current() {
ASSERT(index_ >= 0);
- ASSERT(index_ < str_.Length());
+ ASSERT(index_ < end_);
return ch_;
}
@@ -3756,8 +3766,9 @@ class String : public Instance {
private:
const String& str_;
- intptr_t index_;
int32_t ch_;
+ intptr_t index_;
+ intptr_t end_;
DISALLOW_IMPLICIT_CONSTRUCTORS(CodePointIterator);
};
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698