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 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 // Replace function instance maps to make prototype writable. | 2498 // Replace function instance maps to make prototype writable. |
2499 native_context()->set_sloppy_function_map( | 2499 native_context()->set_sloppy_function_map( |
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 NoTrackDoubleFieldsForSerializerScope() : flag_(FLAG_track_double_fields) { | 2508 explicit NoTrackDoubleFieldsForSerializerScope(Isolate* isolate) |
| 2509 : isolate_(isolate), flag_(FLAG_track_double_fields) { |
2509 if (Serializer::enabled()) { | 2510 if (Serializer::enabled()) { |
2510 // Disable tracking double fields because heap numbers treated as | 2511 // Disable tracking double fields because heap numbers treated as |
2511 // immutable by the serializer. | 2512 // immutable by the serializer. |
2512 FLAG_track_double_fields = false; | 2513 FLAG_track_double_fields = false; |
2513 } | 2514 } |
2514 } | 2515 } |
2515 ~NoTrackDoubleFieldsForSerializerScope() { | 2516 ~NoTrackDoubleFieldsForSerializerScope() { |
2516 if (Serializer::enabled()) { | 2517 if (Serializer::enabled()) { |
2517 FLAG_track_double_fields = flag_; | 2518 FLAG_track_double_fields = flag_; |
2518 } | 2519 } |
2519 } | 2520 } |
2520 | 2521 |
2521 private: | 2522 private: |
| 2523 Isolate* isolate_; |
2522 bool flag_; | 2524 bool flag_; |
2523 }; | 2525 }; |
2524 | 2526 |
2525 | 2527 |
2526 Genesis::Genesis(Isolate* isolate, | 2528 Genesis::Genesis(Isolate* isolate, |
2527 Handle<Object> global_object, | 2529 Handle<Object> global_object, |
2528 v8::Handle<v8::ObjectTemplate> global_template, | 2530 v8::Handle<v8::ObjectTemplate> global_template, |
2529 v8::ExtensionConfiguration* extensions) | 2531 v8::ExtensionConfiguration* extensions) |
2530 : isolate_(isolate), | 2532 : isolate_(isolate), |
2531 active_(isolate->bootstrapper()) { | 2533 active_(isolate->bootstrapper()) { |
2532 NoTrackDoubleFieldsForSerializerScope disable_double_tracking_for_serializer; | 2534 NoTrackDoubleFieldsForSerializerScope disable_scope(isolate); |
2533 result_ = Handle<Context>::null(); | 2535 result_ = Handle<Context>::null(); |
2534 // If V8 cannot be initialized, just return. | 2536 // If V8 cannot be initialized, just return. |
2535 if (!V8::Initialize(NULL)) return; | 2537 if (!V8::Initialize(NULL)) return; |
2536 | 2538 |
2537 // Before creating the roots we must save the context and restore it | 2539 // Before creating the roots we must save the context and restore it |
2538 // on all function exits. | 2540 // on all function exits. |
2539 SaveContext saved_context(isolate); | 2541 SaveContext saved_context(isolate); |
2540 | 2542 |
2541 // During genesis, the boilerplate for stack overflow won't work until the | 2543 // During genesis, the boilerplate for stack overflow won't work until the |
2542 // environment has been at least partially initialized. Add a stack check | 2544 // environment has been at least partially initialized. Add a stack check |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2683 return from + sizeof(NestingCounterType); | 2685 return from + sizeof(NestingCounterType); |
2684 } | 2686 } |
2685 | 2687 |
2686 | 2688 |
2687 // Called when the top-level V8 mutex is destroyed. | 2689 // Called when the top-level V8 mutex is destroyed. |
2688 void Bootstrapper::FreeThreadResources() { | 2690 void Bootstrapper::FreeThreadResources() { |
2689 ASSERT(!IsActive()); | 2691 ASSERT(!IsActive()); |
2690 } | 2692 } |
2691 | 2693 |
2692 } } // namespace v8::internal | 2694 } } // namespace v8::internal |
OLD | NEW |