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

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') | no next file with comments »
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;
srdjan 2012/07/16 20:42:07 Add comment: begin_index of 'str' or 'this'?
siva 2012/07/17 19:15:21 Done.
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;
@@ -3340,6 +3334,8 @@
RawOneByteString* EscapeDoubleQuotes() const;
+ bool EqualsIgnoringPrivate(const OneByteString& str) const;
srdjan 2012/07/16 20:42:07 I think it would be clearer to name it EqualsIgnor
siva 2012/07/17 19:15:21 Done.
+
static intptr_t data_offset() { return OFFSET_OF(RawOneByteString, data_); }
static intptr_t InstanceSize() {
@@ -3353,6 +3349,12 @@
static RawOneByteString* New(intptr_t len,
Heap::Space space);
+ static RawOneByteString* New(const char* c_string,
+ Heap::Space space = Heap::kNew) {
+ return New(reinterpret_cast<const uint8_t*>(c_string),
+ strlen(c_string),
+ space);
+ }
static RawOneByteString* New(const uint8_t* characters,
intptr_t len,
Heap::Space space);
@@ -5138,6 +5140,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);
+ ASSERT((begin_index == 0) || (begin_index < str.Length()));
+ 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698