OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/bootstrapper.h" | 5 #include "src/bootstrapper.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/extensions/externalize-string-extension.h" | 9 #include "src/extensions/externalize-string-extension.h" |
10 #include "src/extensions/free-buffer-extension.h" | 10 #include "src/extensions/free-buffer-extension.h" |
(...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2784 MakeFunctionInstancePrototypeWritable(); | 2784 MakeFunctionInstancePrototypeWritable(); |
2785 | 2785 |
2786 if (!ConfigureGlobalObjects(global_proxy_template)) return; | 2786 if (!ConfigureGlobalObjects(global_proxy_template)) return; |
2787 isolate->counters()->contexts_created_from_scratch()->Increment(); | 2787 isolate->counters()->contexts_created_from_scratch()->Increment(); |
2788 } | 2788 } |
2789 | 2789 |
2790 // Install experimental natives. | 2790 // Install experimental natives. |
2791 if (!InstallExperimentalNatives()) return; | 2791 if (!InstallExperimentalNatives()) return; |
2792 InitializeExperimentalGlobal(); | 2792 InitializeExperimentalGlobal(); |
2793 | 2793 |
2794 // We can't (de-)serialize typed arrays currently, but we are lucky: The state | 2794 // The serializer cannot serialize typed arrays. Reset those typed arrays |
2795 // of the random number generator needs no initialization during snapshot | 2795 // for each new context. |
2796 // creation time and we don't need trigonometric functions then. | 2796 { |
2797 if (!isolate->serializer_enabled()) { | |
2798 // Initially seed the per-context random number generator using the | 2797 // Initially seed the per-context random number generator using the |
2799 // per-isolate random number generator. | 2798 // per-isolate random number generator. |
2800 const int num_elems = 2; | 2799 const int num_elems = 2; |
2801 const int num_bytes = num_elems * sizeof(uint32_t); | 2800 const int num_bytes = num_elems * sizeof(uint32_t); |
2802 uint32_t* state = reinterpret_cast<uint32_t*>(malloc(num_bytes)); | 2801 uint32_t* state = reinterpret_cast<uint32_t*>(malloc(num_bytes)); |
2803 | 2802 |
2804 do { | 2803 do { |
2805 isolate->random_number_generator()->NextBytes(state, num_bytes); | 2804 isolate->random_number_generator()->NextBytes(state, num_bytes); |
2806 } while (state[0] == 0 || state[1] == 0); | 2805 } while (state[0] == 0 || state[1] == 0); |
2807 | 2806 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2855 return from + sizeof(NestingCounterType); | 2854 return from + sizeof(NestingCounterType); |
2856 } | 2855 } |
2857 | 2856 |
2858 | 2857 |
2859 // Called when the top-level V8 mutex is destroyed. | 2858 // Called when the top-level V8 mutex is destroyed. |
2860 void Bootstrapper::FreeThreadResources() { | 2859 void Bootstrapper::FreeThreadResources() { |
2861 DCHECK(!IsActive()); | 2860 DCHECK(!IsActive()); |
2862 } | 2861 } |
2863 | 2862 |
2864 } } // namespace v8::internal | 2863 } } // namespace v8::internal |
OLD | NEW |