| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 i::Handle<i::Object> hash_symbol = i::Factory::identity_hash_symbol(); | 2568 i::Handle<i::Object> hash_symbol = i::Factory::identity_hash_symbol(); |
| 2569 i::Handle<i::Object> hash = i::GetProperty(hidden_props, hash_symbol); | 2569 i::Handle<i::Object> hash = i::GetProperty(hidden_props, hash_symbol); |
| 2570 int hash_value; | 2570 int hash_value; |
| 2571 if (hash->IsSmi()) { | 2571 if (hash->IsSmi()) { |
| 2572 hash_value = i::Smi::cast(*hash)->value(); | 2572 hash_value = i::Smi::cast(*hash)->value(); |
| 2573 } else { | 2573 } else { |
| 2574 int attempts = 0; | 2574 int attempts = 0; |
| 2575 do { | 2575 do { |
| 2576 // Generate a random 32-bit hash value but limit range to fit | 2576 // Generate a random 32-bit hash value but limit range to fit |
| 2577 // within a smi. | 2577 // within a smi. |
| 2578 hash_value = i::V8::Random() & i::Smi::kMaxValue; | 2578 hash_value = i::V8::Random(self->GetIsolate()) & i::Smi::kMaxValue; |
| 2579 attempts++; | 2579 attempts++; |
| 2580 } while (hash_value == 0 && attempts < 30); | 2580 } while (hash_value == 0 && attempts < 30); |
| 2581 hash_value = hash_value != 0 ? hash_value : 1; // never return 0 | 2581 hash_value = hash_value != 0 ? hash_value : 1; // never return 0 |
| 2582 i::SetProperty(hidden_props, | 2582 i::SetProperty(hidden_props, |
| 2583 hash_symbol, | 2583 hash_symbol, |
| 2584 i::Handle<i::Object>(i::Smi::FromInt(hash_value)), | 2584 i::Handle<i::Object>(i::Smi::FromInt(hash_value)), |
| 2585 static_cast<PropertyAttributes>(None)); | 2585 static_cast<PropertyAttributes>(None)); |
| 2586 } | 2586 } |
| 2587 return hash_value; | 2587 return hash_value; |
| 2588 } | 2588 } |
| (...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4855 | 4855 |
| 4856 | 4856 |
| 4857 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 4857 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 4858 HandleScopeImplementer* thread_local = | 4858 HandleScopeImplementer* thread_local = |
| 4859 reinterpret_cast<HandleScopeImplementer*>(storage); | 4859 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 4860 thread_local->IterateThis(v); | 4860 thread_local->IterateThis(v); |
| 4861 return storage + ArchiveSpacePerThread(); | 4861 return storage + ArchiveSpacePerThread(); |
| 4862 } | 4862 } |
| 4863 | 4863 |
| 4864 } } // namespace v8::internal | 4864 } } // namespace v8::internal |
| OLD | NEW |