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

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: 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
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 340a105de80b22d3850892145d23d70cace4d90e..adf29e5c3936eb103f229babbc00503f2de9da9f 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -3724,13 +3724,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_ != -1);
siva 2012/11/30 02:00:19 why was this change necessary?
cshapiro 2012/11/30 02:28:22 It was a remnant of an intermediate edit. Reverte
+ ASSERT(index_ < end_);
return ch_;
}
@@ -3738,8 +3748,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') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698