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

Side by Side Diff: src/v8.cc

Issue 113121: Changed the flags that indicate the status of running vs dead... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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
« src/v8.h ('K') | « src/v8.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 17 matching lines...) Expand all
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "bootstrapper.h" 30 #include "bootstrapper.h"
31 #include "debug.h" 31 #include "debug.h"
32 #include "serialize.h" 32 #include "serialize.h"
33 #include "stub-cache.h" 33 #include "stub-cache.h"
34 #include "oprofile-agent.h" 34 #include "oprofile-agent.h"
35 35
36 namespace v8 { namespace internal { 36 namespace v8 { namespace internal {
37 37
38 bool V8::is_running_ = false;
38 bool V8::has_been_setup_ = false; 39 bool V8::has_been_setup_ = false;
39 bool V8::has_been_disposed_ = false; 40 bool V8::has_been_disposed_ = false;
41 bool V8::has_fatal_error_ = false;
40 42
41 bool V8::Initialize(Deserializer *des) { 43 bool V8::Initialize(Deserializer *des) {
42 bool create_heap_objects = des == NULL; 44 bool create_heap_objects = des == NULL;
43 if (HasBeenDisposed()) return false; 45 if (has_been_disposed_ || has_fatal_error_) return false;
44 if (HasBeenSetup()) return true; 46 if (IsRunning()) return true;
47
48 is_running_ = true;
45 has_been_setup_ = true; 49 has_been_setup_ = true;
50 has_fatal_error_ = false;
51 has_been_disposed_ = false;
46 #ifdef DEBUG 52 #ifdef DEBUG
47 // The initialization process does not handle memory exhaustion. 53 // The initialization process does not handle memory exhaustion.
48 DisallowAllocationFailure disallow_allocation_failure; 54 DisallowAllocationFailure disallow_allocation_failure;
49 #endif 55 #endif
50 56
51 // Enable logging before setting up the heap 57 // Enable logging before setting up the heap
52 Logger::Setup(); 58 Logger::Setup();
53 if (des) des->GetLog(); 59 if (des) des->GetLog();
54 60
55 // Setup the platform OS support. 61 // Setup the platform OS support.
56 OS::Setup(); 62 OS::Setup();
57 63
58 // Setup the object heap 64 // Setup the object heap
59 ASSERT(!Heap::HasBeenSetup()); 65 ASSERT(!Heap::HasBeenSetup());
60 if (!Heap::Setup(create_heap_objects)) { 66 if (!Heap::Setup(create_heap_objects)) {
61 has_been_setup_ = false; 67 SetFatalError();
62 return false; 68 return false;
63 } 69 }
64 70
65 // Initialize other runtime facilities 71 // Initialize other runtime facilities
66 Bootstrapper::Initialize(create_heap_objects); 72 Bootstrapper::Initialize(create_heap_objects);
67 Builtins::Setup(create_heap_objects); 73 Builtins::Setup(create_heap_objects);
68 Top::Initialize(); 74 Top::Initialize();
69 75
70 if (FLAG_preemption) { 76 if (FLAG_preemption) {
71 v8::Locker locker; 77 v8::Locker locker;
(...skipping 15 matching lines...) Expand all
87 // any deserialization because we have to have the initial heap 93 // any deserialization because we have to have the initial heap
88 // objects in place for creating the code object used for probing. 94 // objects in place for creating the code object used for probing.
89 CPU::Setup(); 95 CPU::Setup();
90 96
91 OProfileAgent::Initialize(); 97 OProfileAgent::Initialize();
92 98
93 return true; 99 return true;
94 } 100 }
95 101
96 102
103 void V8::SetFatalError() {
104 is_running_ = false;
105 has_fatal_error_ = true;
106 }
107
108
97 void V8::TearDown() { 109 void V8::TearDown() {
98 if (HasBeenDisposed()) return; 110 if (!has_been_setup_ || has_been_disposed_) return;
99 if (!HasBeenSetup()) return;
100 111
101 OProfileAgent::TearDown(); 112 OProfileAgent::TearDown();
102 113
103 if (FLAG_preemption) { 114 if (FLAG_preemption) {
104 v8::Locker locker; 115 v8::Locker locker;
105 v8::Locker::StopPreemption(); 116 v8::Locker::StopPreemption();
106 } 117 }
107 118
108 Builtins::TearDown(); 119 Builtins::TearDown();
109 Bootstrapper::TearDown(); 120 Bootstrapper::TearDown();
110 121
111 Top::TearDown(); 122 Top::TearDown();
112 123
113 Heap::TearDown(); 124 Heap::TearDown();
114 Logger::TearDown(); 125 Logger::TearDown();
115 126
116 has_been_setup_ = false; 127 is_running_ = false;
117 has_been_disposed_ = true; 128 has_been_disposed_ = true;
118 } 129 }
119 130
131
120 } } // namespace v8::internal 132 } } // namespace v8::internal
OLDNEW
« src/v8.h ('K') | « src/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698