OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/isolate.h" | 5 #include "src/isolate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 if (FLAG_random_seed != 0) { | 2876 if (FLAG_random_seed != 0) { |
2877 random_number_generator_ = | 2877 random_number_generator_ = |
2878 new base::RandomNumberGenerator(FLAG_random_seed); | 2878 new base::RandomNumberGenerator(FLAG_random_seed); |
2879 } else { | 2879 } else { |
2880 random_number_generator_ = new base::RandomNumberGenerator(); | 2880 random_number_generator_ = new base::RandomNumberGenerator(); |
2881 } | 2881 } |
2882 } | 2882 } |
2883 return random_number_generator_; | 2883 return random_number_generator_; |
2884 } | 2884 } |
2885 | 2885 |
| 2886 int Isolate::GenerateIdentityHash(uint32_t mask) { |
| 2887 int hash; |
| 2888 int attempts = 0; |
| 2889 do { |
| 2890 hash = random_number_generator()->NextInt() & mask; |
| 2891 } while (hash == 0 && attempts++ < 30); |
| 2892 return hash != 0 ? hash : 1; |
| 2893 } |
2886 | 2894 |
2887 Object* Isolate::FindCodeObject(Address a) { | 2895 Object* Isolate::FindCodeObject(Address a) { |
2888 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a); | 2896 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a); |
2889 } | 2897 } |
2890 | 2898 |
2891 | 2899 |
2892 #ifdef DEBUG | 2900 #ifdef DEBUG |
2893 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2901 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2894 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2902 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2895 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2903 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3315 // Then check whether this scope intercepts. | 3323 // Then check whether this scope intercepts. |
3316 if ((flag & intercept_mask_)) { | 3324 if ((flag & intercept_mask_)) { |
3317 intercepted_flags_ |= flag; | 3325 intercepted_flags_ |= flag; |
3318 return true; | 3326 return true; |
3319 } | 3327 } |
3320 return false; | 3328 return false; |
3321 } | 3329 } |
3322 | 3330 |
3323 } // namespace internal | 3331 } // namespace internal |
3324 } // namespace v8 | 3332 } // namespace v8 |
OLD | NEW |