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 "bootstrapper.h" | 5 #include "bootstrapper.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
9 #include "natives.h" | 9 #include "natives.h" |
10 #include "snapshot.h" | 10 #include "snapshot.h" |
(...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2500 *sloppy_function_map_writable_prototype_); | 2500 *sloppy_function_map_writable_prototype_); |
2501 native_context()->set_strict_function_map( | 2501 native_context()->set_strict_function_map( |
2502 *strict_function_map_writable_prototype_); | 2502 *strict_function_map_writable_prototype_); |
2503 } | 2503 } |
2504 | 2504 |
2505 | 2505 |
2506 class NoTrackDoubleFieldsForSerializerScope { | 2506 class NoTrackDoubleFieldsForSerializerScope { |
2507 public: | 2507 public: |
2508 explicit NoTrackDoubleFieldsForSerializerScope(Isolate* isolate) | 2508 explicit NoTrackDoubleFieldsForSerializerScope(Isolate* isolate) |
2509 : isolate_(isolate), flag_(FLAG_track_double_fields) { | 2509 : isolate_(isolate), flag_(FLAG_track_double_fields) { |
2510 if (Serializer::enabled()) { | 2510 if (Serializer::enabled(isolate)) { |
2511 // Disable tracking double fields because heap numbers treated as | 2511 // Disable tracking double fields because heap numbers treated as |
2512 // immutable by the serializer. | 2512 // immutable by the serializer. |
2513 FLAG_track_double_fields = false; | 2513 FLAG_track_double_fields = false; |
2514 } | 2514 } |
2515 USE(isolate_); | |
2516 } | 2515 } |
| 2516 |
2517 ~NoTrackDoubleFieldsForSerializerScope() { | 2517 ~NoTrackDoubleFieldsForSerializerScope() { |
2518 if (Serializer::enabled()) { | 2518 if (Serializer::enabled(isolate_)) { |
2519 FLAG_track_double_fields = flag_; | 2519 FLAG_track_double_fields = flag_; |
2520 } | 2520 } |
2521 } | 2521 } |
2522 | 2522 |
2523 private: | 2523 private: |
2524 Isolate* isolate_; | 2524 Isolate* isolate_; |
2525 bool flag_; | 2525 bool flag_; |
2526 }; | 2526 }; |
2527 | 2527 |
2528 | 2528 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 isolate->counters()->contexts_created_from_scratch()->Increment(); | 2591 isolate->counters()->contexts_created_from_scratch()->Increment(); |
2592 } | 2592 } |
2593 | 2593 |
2594 // Initialize experimental globals and install experimental natives. | 2594 // Initialize experimental globals and install experimental natives. |
2595 InitializeExperimentalGlobal(); | 2595 InitializeExperimentalGlobal(); |
2596 if (!InstallExperimentalNatives()) return; | 2596 if (!InstallExperimentalNatives()) return; |
2597 | 2597 |
2598 // We can't (de-)serialize typed arrays currently, but we are lucky: The state | 2598 // We can't (de-)serialize typed arrays currently, but we are lucky: The state |
2599 // of the random number generator needs no initialization during snapshot | 2599 // of the random number generator needs no initialization during snapshot |
2600 // creation time and we don't need trigonometric functions then. | 2600 // creation time and we don't need trigonometric functions then. |
2601 if (!Serializer::enabled()) { | 2601 if (!Serializer::enabled(isolate)) { |
2602 // Initially seed the per-context random number generator using the | 2602 // Initially seed the per-context random number generator using the |
2603 // per-isolate random number generator. | 2603 // per-isolate random number generator. |
2604 const int num_elems = 2; | 2604 const int num_elems = 2; |
2605 const int num_bytes = num_elems * sizeof(uint32_t); | 2605 const int num_bytes = num_elems * sizeof(uint32_t); |
2606 uint32_t* state = reinterpret_cast<uint32_t*>(malloc(num_bytes)); | 2606 uint32_t* state = reinterpret_cast<uint32_t*>(malloc(num_bytes)); |
2607 | 2607 |
2608 do { | 2608 do { |
2609 isolate->random_number_generator()->NextBytes(state, num_bytes); | 2609 isolate->random_number_generator()->NextBytes(state, num_bytes); |
2610 } while (state[0] == 0 || state[1] == 0); | 2610 } while (state[0] == 0 || state[1] == 0); |
2611 | 2611 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2686 return from + sizeof(NestingCounterType); | 2686 return from + sizeof(NestingCounterType); |
2687 } | 2687 } |
2688 | 2688 |
2689 | 2689 |
2690 // Called when the top-level V8 mutex is destroyed. | 2690 // Called when the top-level V8 mutex is destroyed. |
2691 void Bootstrapper::FreeThreadResources() { | 2691 void Bootstrapper::FreeThreadResources() { |
2692 ASSERT(!IsActive()); | 2692 ASSERT(!IsActive()); |
2693 } | 2693 } |
2694 | 2694 |
2695 } } // namespace v8::internal | 2695 } } // namespace v8::internal |
OLD | NEW |