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 2496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 *sloppy_function_map_writable_prototype_); | 2507 *sloppy_function_map_writable_prototype_); |
2508 native_context()->set_strict_function_map( | 2508 native_context()->set_strict_function_map( |
2509 *strict_function_map_writable_prototype_); | 2509 *strict_function_map_writable_prototype_); |
2510 } | 2510 } |
2511 | 2511 |
2512 | 2512 |
2513 class NoTrackDoubleFieldsForSerializerScope { | 2513 class NoTrackDoubleFieldsForSerializerScope { |
2514 public: | 2514 public: |
2515 explicit NoTrackDoubleFieldsForSerializerScope(Isolate* isolate) | 2515 explicit NoTrackDoubleFieldsForSerializerScope(Isolate* isolate) |
2516 : isolate_(isolate), flag_(FLAG_track_double_fields) { | 2516 : isolate_(isolate), flag_(FLAG_track_double_fields) { |
2517 if (Serializer::enabled()) { | 2517 if (Serializer::enabled(isolate)) { |
2518 // Disable tracking double fields because heap numbers treated as | 2518 // Disable tracking double fields because heap numbers treated as |
2519 // immutable by the serializer. | 2519 // immutable by the serializer. |
2520 FLAG_track_double_fields = false; | 2520 FLAG_track_double_fields = false; |
2521 } | 2521 } |
2522 USE(isolate_); | |
2523 } | 2522 } |
| 2523 |
2524 ~NoTrackDoubleFieldsForSerializerScope() { | 2524 ~NoTrackDoubleFieldsForSerializerScope() { |
2525 if (Serializer::enabled()) { | 2525 if (Serializer::enabled(isolate_)) { |
2526 FLAG_track_double_fields = flag_; | 2526 FLAG_track_double_fields = flag_; |
2527 } | 2527 } |
2528 } | 2528 } |
2529 | 2529 |
2530 private: | 2530 private: |
2531 Isolate* isolate_; | 2531 Isolate* isolate_; |
2532 bool flag_; | 2532 bool flag_; |
2533 }; | 2533 }; |
2534 | 2534 |
2535 | 2535 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2598 isolate->counters()->contexts_created_from_scratch()->Increment(); | 2598 isolate->counters()->contexts_created_from_scratch()->Increment(); |
2599 } | 2599 } |
2600 | 2600 |
2601 // Initialize experimental globals and install experimental natives. | 2601 // Initialize experimental globals and install experimental natives. |
2602 InitializeExperimentalGlobal(); | 2602 InitializeExperimentalGlobal(); |
2603 if (!InstallExperimentalNatives()) return; | 2603 if (!InstallExperimentalNatives()) return; |
2604 | 2604 |
2605 // We can't (de-)serialize typed arrays currently, but we are lucky: The state | 2605 // We can't (de-)serialize typed arrays currently, but we are lucky: The state |
2606 // of the random number generator needs no initialization during snapshot | 2606 // of the random number generator needs no initialization during snapshot |
2607 // creation time and we don't need trigonometric functions then. | 2607 // creation time and we don't need trigonometric functions then. |
2608 if (!Serializer::enabled()) { | 2608 if (!Serializer::enabled(isolate)) { |
2609 // Initially seed the per-context random number generator using the | 2609 // Initially seed the per-context random number generator using the |
2610 // per-isolate random number generator. | 2610 // per-isolate random number generator. |
2611 const int num_elems = 2; | 2611 const int num_elems = 2; |
2612 const int num_bytes = num_elems * sizeof(uint32_t); | 2612 const int num_bytes = num_elems * sizeof(uint32_t); |
2613 uint32_t* state = reinterpret_cast<uint32_t*>(malloc(num_bytes)); | 2613 uint32_t* state = reinterpret_cast<uint32_t*>(malloc(num_bytes)); |
2614 | 2614 |
2615 do { | 2615 do { |
2616 isolate->random_number_generator()->NextBytes(state, num_bytes); | 2616 isolate->random_number_generator()->NextBytes(state, num_bytes); |
2617 } while (state[0] == 0 || state[1] == 0); | 2617 } while (state[0] == 0 || state[1] == 0); |
2618 | 2618 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 return from + sizeof(NestingCounterType); | 2693 return from + sizeof(NestingCounterType); |
2694 } | 2694 } |
2695 | 2695 |
2696 | 2696 |
2697 // Called when the top-level V8 mutex is destroyed. | 2697 // Called when the top-level V8 mutex is destroyed. |
2698 void Bootstrapper::FreeThreadResources() { | 2698 void Bootstrapper::FreeThreadResources() { |
2699 ASSERT(!IsActive()); | 2699 ASSERT(!IsActive()); |
2700 } | 2700 } |
2701 | 2701 |
2702 } } // namespace v8::internal | 2702 } } // namespace v8::internal |
OLD | NEW |