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

Side by Side Diff: src/objects.cc

Issue 6626043: Add an interface for an embedder to provide information about native (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix GetCopy 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
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 5219 matching lines...) Expand 10 before | Expand all | Expand 10 after
5230 bool String::IsTwoByteEqualTo(Vector<const uc16> str) { 5230 bool String::IsTwoByteEqualTo(Vector<const uc16> str) {
5231 int slen = length(); 5231 int slen = length();
5232 if (str.length() != slen) return false; 5232 if (str.length() != slen) return false;
5233 for (int i = 0; i < slen; i++) { 5233 for (int i = 0; i < slen; i++) {
5234 if (Get(i) != str[i]) return false; 5234 if (Get(i) != str[i]) return false;
5235 } 5235 }
5236 return true; 5236 return true;
5237 } 5237 }
5238 5238
5239 5239
5240 template <typename schar>
5241 static inline uint32_t HashSequentialString(const schar* chars, int length) {
5242 StringHasher hasher(length);
5243 if (!hasher.has_trivial_hash()) {
5244 int i;
5245 for (i = 0; hasher.is_array_index() && (i < length); i++) {
5246 hasher.AddCharacter(chars[i]);
5247 }
5248 for (; i < length; i++) {
5249 hasher.AddCharacterNoIndex(chars[i]);
5250 }
5251 }
5252 return hasher.GetHashField();
5253 }
5254
5255
5256 uint32_t String::ComputeAndSetHash() { 5240 uint32_t String::ComputeAndSetHash() {
5257 // Should only be called if hash code has not yet been computed. 5241 // Should only be called if hash code has not yet been computed.
5258 ASSERT(!HasHashCode()); 5242 ASSERT(!HasHashCode());
5259 5243
5260 const int len = length(); 5244 const int len = length();
5261 5245
5262 // Compute the hash code. 5246 // Compute the hash code.
5263 uint32_t field = 0; 5247 uint32_t field = 0;
5264 if (StringShape(this).IsSequentialAscii()) { 5248 if (StringShape(this).IsSequentialAscii()) {
5265 field = HashSequentialString(SeqAsciiString::cast(this)->GetChars(), len); 5249 field = HashSequentialString(SeqAsciiString::cast(this)->GetChars(), len);
(...skipping 4789 matching lines...) Expand 10 before | Expand all | Expand 10 after
10055 if (break_point_objects()->IsUndefined()) return 0; 10039 if (break_point_objects()->IsUndefined()) return 0;
10056 // Single beak point. 10040 // Single beak point.
10057 if (!break_point_objects()->IsFixedArray()) return 1; 10041 if (!break_point_objects()->IsFixedArray()) return 1;
10058 // Multiple break points. 10042 // Multiple break points.
10059 return FixedArray::cast(break_point_objects())->length(); 10043 return FixedArray::cast(break_point_objects())->length();
10060 } 10044 }
10061 #endif 10045 #endif
10062 10046
10063 10047
10064 } } // namespace v8::internal 10048 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698