| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 9978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9989 return false; | 9989 return false; |
| 9990 } | 9990 } |
| 9991 } | 9991 } |
| 9992 return true; | 9992 return true; |
| 9993 } | 9993 } |
| 9994 | 9994 |
| 9995 | 9995 |
| 9996 bool String::Equals(const int32_t* utf32_array, intptr_t len) const { | 9996 bool String::Equals(const int32_t* utf32_array, intptr_t len) const { |
| 9997 CodePointIterator it(*this); | 9997 CodePointIterator it(*this); |
| 9998 intptr_t i = 0; | 9998 intptr_t i = 0; |
| 9999 while (it.Next()) { | 9999 bool has_more = it.Next(); |
| 10000 if (it.Current() != static_cast<int32_t>(utf32_array[i])) { | 10000 while (has_more && (i < len)) { |
| 10001 if ((it.Current() != static_cast<int32_t>(utf32_array[i]))) { |
| 10001 return false; | 10002 return false; |
| 10002 } | 10003 } |
| 10004 // Advance both streams forward. |
| 10003 ++i; | 10005 ++i; |
| 10006 has_more = it.Next(); |
| 10004 } | 10007 } |
| 10005 if (i != len) { | 10008 // Strings are only true iff we reached the end in both streams. |
| 10006 return false; | 10009 return (i == len) && !has_more; |
| 10007 } | |
| 10008 return true; | |
| 10009 } | 10010 } |
| 10010 | 10011 |
| 10011 | 10012 |
| 10012 intptr_t String::CompareTo(const String& other) const { | 10013 intptr_t String::CompareTo(const String& other) const { |
| 10013 const intptr_t this_len = this->Length(); | 10014 const intptr_t this_len = this->Length(); |
| 10014 const intptr_t other_len = other.IsNull() ? 0 : other.Length(); | 10015 const intptr_t other_len = other.IsNull() ? 0 : other.Length(); |
| 10015 const intptr_t len = (this_len < other_len) ? this_len : other_len; | 10016 const intptr_t len = (this_len < other_len) ? this_len : other_len; |
| 10016 for (intptr_t i = 0; i < len; i++) { | 10017 for (intptr_t i = 0; i < len; i++) { |
| 10017 int32_t this_code_point = this->CharAt(i); | 10018 int32_t this_code_point = this->CharAt(i); |
| 10018 int32_t other_code_point = other.CharAt(i); | 10019 int32_t other_code_point = other.CharAt(i); |
| (...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12119 } | 12120 } |
| 12120 return result.raw(); | 12121 return result.raw(); |
| 12121 } | 12122 } |
| 12122 | 12123 |
| 12123 | 12124 |
| 12124 const char* WeakProperty::ToCString() const { | 12125 const char* WeakProperty::ToCString() const { |
| 12125 return "_WeakProperty"; | 12126 return "_WeakProperty"; |
| 12126 } | 12127 } |
| 12127 | 12128 |
| 12128 } // namespace dart | 12129 } // namespace dart |
| OLD | NEW |