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

Side by Side Diff: src/objects.cc

Issue 6685052: Version 3.2.2. Fixed a number of crash and correctness bugs. Improved Cranksh... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5220 matching lines...) Expand 10 before | Expand all | Expand 10 after
5231 bool String::IsTwoByteEqualTo(Vector<const uc16> str) { 5231 bool String::IsTwoByteEqualTo(Vector<const uc16> str) {
5232 int slen = length(); 5232 int slen = length();
5233 if (str.length() != slen) return false; 5233 if (str.length() != slen) return false;
5234 for (int i = 0; i < slen; i++) { 5234 for (int i = 0; i < slen; i++) {
5235 if (Get(i) != str[i]) return false; 5235 if (Get(i) != str[i]) return false;
5236 } 5236 }
5237 return true; 5237 return true;
5238 } 5238 }
5239 5239
5240 5240
5241 template <typename schar>
5242 static inline uint32_t HashSequentialString(const schar* chars, int length) {
5243 StringHasher hasher(length);
5244 if (!hasher.has_trivial_hash()) {
5245 int i;
5246 for (i = 0; hasher.is_array_index() && (i < length); i++) {
5247 hasher.AddCharacter(chars[i]);
5248 }
5249 for (; i < length; i++) {
5250 hasher.AddCharacterNoIndex(chars[i]);
5251 }
5252 }
5253 return hasher.GetHashField();
5254 }
5255
5256
5257 uint32_t String::ComputeAndSetHash() { 5241 uint32_t String::ComputeAndSetHash() {
5258 // Should only be called if hash code has not yet been computed. 5242 // Should only be called if hash code has not yet been computed.
5259 ASSERT(!HasHashCode()); 5243 ASSERT(!HasHashCode());
5260 5244
5261 const int len = length(); 5245 const int len = length();
5262 5246
5263 // Compute the hash code. 5247 // Compute the hash code.
5264 uint32_t field = 0; 5248 uint32_t field = 0;
5265 if (StringShape(this).IsSequentialAscii()) { 5249 if (StringShape(this).IsSequentialAscii()) {
5266 field = HashSequentialString(SeqAsciiString::cast(this)->GetChars(), len); 5250 field = HashSequentialString(SeqAsciiString::cast(this)->GetChars(), len);
(...skipping 4791 matching lines...) Expand 10 before | Expand all | Expand 10 after
10058 if (break_point_objects()->IsUndefined()) return 0; 10042 if (break_point_objects()->IsUndefined()) return 0;
10059 // Single beak point. 10043 // Single beak point.
10060 if (!break_point_objects()->IsFixedArray()) return 1; 10044 if (!break_point_objects()->IsFixedArray()) return 1;
10061 // Multiple break points. 10045 // Multiple break points.
10062 return FixedArray::cast(break_point_objects())->length(); 10046 return FixedArray::cast(break_point_objects())->length();
10063 } 10047 }
10064 #endif 10048 #endif
10065 10049
10066 10050
10067 } } // namespace v8::internal 10051 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698