OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3288 | 3288 |
3289 | 3289 |
3290 Smi* JSReceiver::GenerateIdentityHash() { | 3290 Smi* JSReceiver::GenerateIdentityHash() { |
3291 Isolate* isolate = GetIsolate(); | 3291 Isolate* isolate = GetIsolate(); |
3292 | 3292 |
3293 int hash_value; | 3293 int hash_value; |
3294 int attempts = 0; | 3294 int attempts = 0; |
3295 do { | 3295 do { |
3296 // Generate a random 32-bit hash value but limit range to fit | 3296 // Generate a random 32-bit hash value but limit range to fit |
3297 // within a smi. | 3297 // within a smi. |
3298 hash_value = V8::Random(isolate) & Smi::kMaxValue; | 3298 hash_value = V8::RandomPrivate(isolate) & Smi::kMaxValue; |
3299 attempts++; | 3299 attempts++; |
3300 } while (hash_value == 0 && attempts < 30); | 3300 } while (hash_value == 0 && attempts < 30); |
3301 hash_value = hash_value != 0 ? hash_value : 1; // never return 0 | 3301 hash_value = hash_value != 0 ? hash_value : 1; // never return 0 |
3302 | 3302 |
3303 return Smi::FromInt(hash_value); | 3303 return Smi::FromInt(hash_value); |
3304 } | 3304 } |
3305 | 3305 |
3306 | 3306 |
3307 MaybeObject* JSObject::SetIdentityHash(Object* hash, CreationFlag flag) { | 3307 MaybeObject* JSObject::SetIdentityHash(Object* hash, CreationFlag flag) { |
3308 MaybeObject* maybe = SetHiddenProperty(GetHeap()->identity_hash_symbol(), | 3308 MaybeObject* maybe = SetHiddenProperty(GetHeap()->identity_hash_symbol(), |
(...skipping 8871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12180 if (break_point_objects()->IsUndefined()) return 0; | 12180 if (break_point_objects()->IsUndefined()) return 0; |
12181 // Single break point. | 12181 // Single break point. |
12182 if (!break_point_objects()->IsFixedArray()) return 1; | 12182 if (!break_point_objects()->IsFixedArray()) return 1; |
12183 // Multiple break points. | 12183 // Multiple break points. |
12184 return FixedArray::cast(break_point_objects())->length(); | 12184 return FixedArray::cast(break_point_objects())->length(); |
12185 } | 12185 } |
12186 #endif | 12186 #endif |
12187 | 12187 |
12188 | 12188 |
12189 } } // namespace v8::internal | 12189 } } // namespace v8::internal |
OLD | NEW |