| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4722 | 4722 |
| 4723 | 4723 |
| 4724 Smi* JSReceiver::GenerateIdentityHash() { | 4724 Smi* JSReceiver::GenerateIdentityHash() { |
| 4725 Isolate* isolate = GetIsolate(); | 4725 Isolate* isolate = GetIsolate(); |
| 4726 | 4726 |
| 4727 int hash_value; | 4727 int hash_value; |
| 4728 int attempts = 0; | 4728 int attempts = 0; |
| 4729 do { | 4729 do { |
| 4730 // Generate a random 32-bit hash value but limit range to fit | 4730 // Generate a random 32-bit hash value but limit range to fit |
| 4731 // within a smi. | 4731 // within a smi. |
| 4732 hash_value = V8::RandomPrivate(isolate) & Smi::kMaxValue; | 4732 hash_value = isolate->random_number_generator()->NextInt() & Smi::kMaxValue; |
| 4733 attempts++; | 4733 attempts++; |
| 4734 } while (hash_value == 0 && attempts < 30); | 4734 } while (hash_value == 0 && attempts < 30); |
| 4735 hash_value = hash_value != 0 ? hash_value : 1; // never return 0 | 4735 hash_value = hash_value != 0 ? hash_value : 1; // never return 0 |
| 4736 | 4736 |
| 4737 return Smi::FromInt(hash_value); | 4737 return Smi::FromInt(hash_value); |
| 4738 } | 4738 } |
| 4739 | 4739 |
| 4740 | 4740 |
| 4741 void JSObject::SetIdentityHash(Handle<JSObject> object, Smi* hash) { | 4741 void JSObject::SetIdentityHash(Handle<JSObject> object, Smi* hash) { |
| 4742 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), | 4742 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), |
| (...skipping 11305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16048 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16048 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16049 static const char* error_messages_[] = { | 16049 static const char* error_messages_[] = { |
| 16050 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16050 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16051 }; | 16051 }; |
| 16052 #undef ERROR_MESSAGES_TEXTS | 16052 #undef ERROR_MESSAGES_TEXTS |
| 16053 return error_messages_[reason]; | 16053 return error_messages_[reason]; |
| 16054 } | 16054 } |
| 16055 | 16055 |
| 16056 | 16056 |
| 16057 } } // namespace v8::internal | 16057 } } // namespace v8::internal |
| OLD | NEW |