Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Side by Side Diff: src/bootstrapper.cc

Issue 296853007: Make serializer non-static. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/assembler.cc ('k') | src/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 native_context()->set_sloppy_function_map( 2515 native_context()->set_sloppy_function_map(
2516 *sloppy_function_map_writable_prototype_); 2516 *sloppy_function_map_writable_prototype_);
2517 native_context()->set_strict_function_map( 2517 native_context()->set_strict_function_map(
2518 *strict_function_map_writable_prototype_); 2518 *strict_function_map_writable_prototype_);
2519 } 2519 }
2520 2520
2521 2521
2522 class NoTrackDoubleFieldsForSerializerScope { 2522 class NoTrackDoubleFieldsForSerializerScope {
2523 public: 2523 public:
2524 explicit NoTrackDoubleFieldsForSerializerScope(Isolate* isolate) 2524 explicit NoTrackDoubleFieldsForSerializerScope(Isolate* isolate)
2525 : isolate_(isolate), flag_(FLAG_track_double_fields) { 2525 : flag_(FLAG_track_double_fields) {
2526 if (Serializer::enabled(isolate)) { 2526 if (isolate->serializer_enabled()) {
2527 // Disable tracking double fields because heap numbers treated as 2527 // Disable tracking double fields because heap numbers treated as
2528 // immutable by the serializer. 2528 // immutable by the serializer.
2529 FLAG_track_double_fields = false; 2529 FLAG_track_double_fields = false;
2530 } 2530 }
2531 } 2531 }
2532 2532
2533 ~NoTrackDoubleFieldsForSerializerScope() { 2533 ~NoTrackDoubleFieldsForSerializerScope() {
2534 if (Serializer::enabled(isolate_)) { 2534 FLAG_track_double_fields = flag_;
2535 FLAG_track_double_fields = flag_;
2536 }
2537 } 2535 }
2538 2536
2539 private: 2537 private:
2540 Isolate* isolate_;
2541 bool flag_; 2538 bool flag_;
2542 }; 2539 };
2543 2540
2544 2541
2545 Genesis::Genesis(Isolate* isolate, 2542 Genesis::Genesis(Isolate* isolate,
2546 Handle<Object> global_object, 2543 Handle<Object> global_object,
2547 v8::Handle<v8::ObjectTemplate> global_template, 2544 v8::Handle<v8::ObjectTemplate> global_template,
2548 v8::ExtensionConfiguration* extensions) 2545 v8::ExtensionConfiguration* extensions)
2549 : isolate_(isolate), 2546 : isolate_(isolate),
2550 active_(isolate->bootstrapper()) { 2547 active_(isolate->bootstrapper()) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 isolate->counters()->contexts_created_from_scratch()->Increment(); 2604 isolate->counters()->contexts_created_from_scratch()->Increment();
2608 } 2605 }
2609 2606
2610 // Initialize experimental globals and install experimental natives. 2607 // Initialize experimental globals and install experimental natives.
2611 InitializeExperimentalGlobal(); 2608 InitializeExperimentalGlobal();
2612 if (!InstallExperimentalNatives()) return; 2609 if (!InstallExperimentalNatives()) return;
2613 2610
2614 // We can't (de-)serialize typed arrays currently, but we are lucky: The state 2611 // We can't (de-)serialize typed arrays currently, but we are lucky: The state
2615 // of the random number generator needs no initialization during snapshot 2612 // of the random number generator needs no initialization during snapshot
2616 // creation time and we don't need trigonometric functions then. 2613 // creation time and we don't need trigonometric functions then.
2617 if (!Serializer::enabled(isolate)) { 2614 if (!isolate->serializer_enabled()) {
2618 // Initially seed the per-context random number generator using the 2615 // Initially seed the per-context random number generator using the
2619 // per-isolate random number generator. 2616 // per-isolate random number generator.
2620 const int num_elems = 2; 2617 const int num_elems = 2;
2621 const int num_bytes = num_elems * sizeof(uint32_t); 2618 const int num_bytes = num_elems * sizeof(uint32_t);
2622 uint32_t* state = reinterpret_cast<uint32_t*>(malloc(num_bytes)); 2619 uint32_t* state = reinterpret_cast<uint32_t*>(malloc(num_bytes));
2623 2620
2624 do { 2621 do {
2625 isolate->random_number_generator()->NextBytes(state, num_bytes); 2622 isolate->random_number_generator()->NextBytes(state, num_bytes);
2626 } while (state[0] == 0 || state[1] == 0); 2623 } while (state[0] == 0 || state[1] == 0);
2627 2624
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2702 return from + sizeof(NestingCounterType); 2699 return from + sizeof(NestingCounterType);
2703 } 2700 }
2704 2701
2705 2702
2706 // Called when the top-level V8 mutex is destroyed. 2703 // Called when the top-level V8 mutex is destroyed.
2707 void Bootstrapper::FreeThreadResources() { 2704 void Bootstrapper::FreeThreadResources() {
2708 ASSERT(!IsActive()); 2705 ASSERT(!IsActive());
2709 } 2706 }
2710 2707
2711 } } // namespace v8::internal 2708 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698