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

Unified Diff: vm/object.h

Issue 10785007: Minor changes based on the profile while running dart2js compile all. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 months 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 | « vm/flow_graph_compiler.cc ('k') | vm/object.cc » ('j') | vm/object.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object.h
===================================================================
--- vm/object.h (revision 9647)
+++ vm/object.h (working copy)
@@ -3188,16 +3188,10 @@
virtual intptr_t CharSize() const;
- bool Equals(const String& str) const {
- if (raw() == str.raw()) {
- return true; // Both handles point to the same raw instance.
- }
- if (str.IsNull()) {
- return false;
- }
- return Equals(str, 0, str.Length());
- }
- bool Equals(const String& str, intptr_t begin_index, intptr_t len) const;
+ inline bool Equals(const String& str) const;
+ inline bool Equals(const String& str,
+ intptr_t begin_index,
+ intptr_t len) const;
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;
@@ -5138,6 +5132,36 @@
return (Smi::Value(raw_ptr()->bitmap_size_in_bytes_) * kBitsPerByte);
}
+
+bool String::Equals(const String& str) const {
+ if (raw() == str.raw()) {
+ return true; // Both handles point to the same raw instance.
+ }
+ if (str.IsNull()) {
+ return false;
+ }
+ return Equals(str, 0, str.Length());
+}
+
+
+bool String::Equals(const String& str,
+ intptr_t begin_index,
+ intptr_t len) const {
+ ASSERT(begin_index >= 0);
srdjan 2012/07/13 23:22:23 Compare raws as well.
siva 2012/07/16 18:29:23 I don't think we can do a raw comparision and retu
+ ASSERT(begin_index == 0 || begin_index < str.Length());
srdjan 2012/07/13 23:22:23 Add parenthesis
siva 2012/07/16 18:29:23 Done.
+ ASSERT(len >= 0);
+ ASSERT(len <= str.Length());
+ if (len != this->Length()) {
+ return false; // Lengths don't match.
+ }
+ for (intptr_t i = 0; i < len; i++) {
+ if (this->CharAt(i) != str.CharAt(begin_index + i)) {
+ return false;
+ }
+ }
+ return true;
+}
+
} // namespace dart
#endif // VM_OBJECT_H_
« no previous file with comments | « vm/flow_graph_compiler.cc ('k') | vm/object.cc » ('j') | vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698