OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 20 matching lines...) Expand all Loading... |
31 #include "api.h" | 31 #include "api.h" |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
33 #include "codegen.h" | 33 #include "codegen.h" |
34 #include "compilation-cache.h" | 34 #include "compilation-cache.h" |
35 #include "cpu-profiler.h" | 35 #include "cpu-profiler.h" |
36 #include "debug.h" | 36 #include "debug.h" |
37 #include "deoptimizer.h" | 37 #include "deoptimizer.h" |
38 #include "global-handles.h" | 38 #include "global-handles.h" |
39 #include "heap-profiler.h" | 39 #include "heap-profiler.h" |
40 #include "incremental-marking.h" | 40 #include "incremental-marking.h" |
| 41 #include "isolate-inl.h" |
41 #include "mark-compact.h" | 42 #include "mark-compact.h" |
42 #include "natives.h" | 43 #include "natives.h" |
43 #include "objects-visiting.h" | 44 #include "objects-visiting.h" |
44 #include "objects-visiting-inl.h" | 45 #include "objects-visiting-inl.h" |
45 #include "once.h" | 46 #include "once.h" |
46 #include "runtime-profiler.h" | 47 #include "runtime-profiler.h" |
47 #include "scopeinfo.h" | 48 #include "scopeinfo.h" |
48 #include "snapshot.h" | 49 #include "snapshot.h" |
49 #include "store-buffer.h" | 50 #include "store-buffer.h" |
| 51 #include "utils/random-number-generator.h" |
50 #include "v8threads.h" | 52 #include "v8threads.h" |
51 #include "v8utils.h" | 53 #include "v8utils.h" |
52 #include "vm-state-inl.h" | 54 #include "vm-state-inl.h" |
53 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP | 55 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP |
54 #include "regexp-macro-assembler.h" | 56 #include "regexp-macro-assembler.h" |
55 #include "arm/regexp-macro-assembler-arm.h" | 57 #include "arm/regexp-macro-assembler-arm.h" |
56 #endif | 58 #endif |
57 #if V8_TARGET_ARCH_MIPS && !V8_INTERPRETED_REGEXP | 59 #if V8_TARGET_ARCH_MIPS && !V8_INTERPRETED_REGEXP |
58 #include "regexp-macro-assembler.h" | 60 #include "regexp-macro-assembler.h" |
59 #include "mips/regexp-macro-assembler-mips.h" | 61 #include "mips/regexp-macro-assembler-mips.h" |
(...skipping 5695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5755 MaybeObject* maybe = | 5757 MaybeObject* maybe = |
5756 AllocateRaw(Symbol::kSize, OLD_POINTER_SPACE, OLD_POINTER_SPACE); | 5758 AllocateRaw(Symbol::kSize, OLD_POINTER_SPACE, OLD_POINTER_SPACE); |
5757 if (!maybe->ToObject(&result)) return maybe; | 5759 if (!maybe->ToObject(&result)) return maybe; |
5758 | 5760 |
5759 HeapObject::cast(result)->set_map_no_write_barrier(symbol_map()); | 5761 HeapObject::cast(result)->set_map_no_write_barrier(symbol_map()); |
5760 | 5762 |
5761 // Generate a random hash value. | 5763 // Generate a random hash value. |
5762 int hash; | 5764 int hash; |
5763 int attempts = 0; | 5765 int attempts = 0; |
5764 do { | 5766 do { |
5765 hash = V8::RandomPrivate(isolate()) & Name::kHashBitMask; | 5767 hash = isolate()->random_number_generator()->NextInt() & Name::kHashBitMask; |
5766 attempts++; | 5768 attempts++; |
5767 } while (hash == 0 && attempts < 30); | 5769 } while (hash == 0 && attempts < 30); |
5768 if (hash == 0) hash = 1; // never return 0 | 5770 if (hash == 0) hash = 1; // never return 0 |
5769 | 5771 |
5770 Symbol::cast(result)->set_hash_field( | 5772 Symbol::cast(result)->set_hash_field( |
5771 Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); | 5773 Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); |
5772 Symbol::cast(result)->set_name(undefined_value()); | 5774 Symbol::cast(result)->set_name(undefined_value()); |
5773 | 5775 |
5774 ASSERT(result->IsSymbol()); | 5776 ASSERT(result->IsSymbol()); |
5775 return result; | 5777 return result; |
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6920 // to be non-executable here for safety, but this means we need to enable it | 6922 // to be non-executable here for safety, but this means we need to enable it |
6921 // explicitly when allocating large code objects. | 6923 // explicitly when allocating large code objects. |
6922 lo_space_ = new LargeObjectSpace(this, max_old_generation_size_, LO_SPACE); | 6924 lo_space_ = new LargeObjectSpace(this, max_old_generation_size_, LO_SPACE); |
6923 if (lo_space_ == NULL) return false; | 6925 if (lo_space_ == NULL) return false; |
6924 if (!lo_space_->SetUp()) return false; | 6926 if (!lo_space_->SetUp()) return false; |
6925 | 6927 |
6926 // Set up the seed that is used to randomize the string hash function. | 6928 // Set up the seed that is used to randomize the string hash function. |
6927 ASSERT(hash_seed() == 0); | 6929 ASSERT(hash_seed() == 0); |
6928 if (FLAG_randomize_hashes) { | 6930 if (FLAG_randomize_hashes) { |
6929 if (FLAG_hash_seed == 0) { | 6931 if (FLAG_hash_seed == 0) { |
6930 set_hash_seed( | 6932 int rnd = isolate()->random_number_generator()->NextInt(); |
6931 Smi::FromInt(V8::RandomPrivate(isolate()) & 0x3fffffff)); | 6933 set_hash_seed(Smi::FromInt(rnd & Name::kHashBitMask)); |
6932 } else { | 6934 } else { |
6933 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); | 6935 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); |
6934 } | 6936 } |
6935 } | 6937 } |
6936 | 6938 |
6937 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); | 6939 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); |
6938 LOG(isolate_, IntPtrTEvent("heap-available", Available())); | 6940 LOG(isolate_, IntPtrTEvent("heap-available", Available())); |
6939 | 6941 |
6940 store_buffer()->SetUp(); | 6942 store_buffer()->SetUp(); |
6941 | 6943 |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8095 if (FLAG_concurrent_recompilation) { | 8097 if (FLAG_concurrent_recompilation) { |
8096 heap_->relocation_mutex_->Lock(); | 8098 heap_->relocation_mutex_->Lock(); |
8097 #ifdef DEBUG | 8099 #ifdef DEBUG |
8098 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8100 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
8099 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8101 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
8100 #endif // DEBUG | 8102 #endif // DEBUG |
8101 } | 8103 } |
8102 } | 8104 } |
8103 | 8105 |
8104 } } // namespace v8::internal | 8106 } } // namespace v8::internal |
OLD | NEW |