OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "sampler.h" | 43 #include "sampler.h" |
44 #include "runtime-profiler.h" | 44 #include "runtime-profiler.h" |
45 #include "serialize.h" | 45 #include "serialize.h" |
46 #include "store-buffer.h" | 46 #include "store-buffer.h" |
47 | 47 |
48 namespace v8 { | 48 namespace v8 { |
49 namespace internal { | 49 namespace internal { |
50 | 50 |
51 V8_DECLARE_ONCE(init_once); | 51 V8_DECLARE_ONCE(init_once); |
52 | 52 |
53 bool V8::is_running_ = false; | |
54 bool V8::has_been_set_up_ = false; | 53 bool V8::has_been_set_up_ = false; |
55 bool V8::has_been_disposed_ = false; | 54 bool V8::has_been_disposed_ = false; |
56 bool V8::has_fatal_error_ = false; | 55 bool V8::has_fatal_error_ = false; |
57 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; | 56 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; |
58 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; | 57 v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL; |
59 | 58 |
60 static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER; | 59 static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER; |
61 | 60 |
62 static EntropySource entropy_source; | 61 static EntropySource entropy_source; |
63 | 62 |
(...skipping 13 matching lines...) Expand all Loading... |
77 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->thread_id().Equals( | 76 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->thread_id().Equals( |
78 i::ThreadId::Current())); | 77 i::ThreadId::Current())); |
79 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() == | 78 ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() == |
80 i::Isolate::Current()); | 79 i::Isolate::Current()); |
81 | 80 |
82 if (IsDead()) return false; | 81 if (IsDead()) return false; |
83 | 82 |
84 Isolate* isolate = Isolate::Current(); | 83 Isolate* isolate = Isolate::Current(); |
85 if (isolate->IsInitialized()) return true; | 84 if (isolate->IsInitialized()) return true; |
86 | 85 |
87 is_running_ = true; | |
88 has_been_set_up_ = true; | 86 has_been_set_up_ = true; |
89 has_fatal_error_ = false; | 87 has_fatal_error_ = false; |
90 has_been_disposed_ = false; | 88 has_been_disposed_ = false; |
91 | 89 |
92 return isolate->Init(des); | 90 return isolate->Init(des); |
93 } | 91 } |
94 | 92 |
95 | 93 |
96 void V8::SetFatalError() { | 94 void V8::SetFatalError() { |
97 is_running_ = false; | |
98 has_fatal_error_ = true; | 95 has_fatal_error_ = true; |
99 } | 96 } |
100 | 97 |
101 | 98 |
102 void V8::TearDown() { | 99 void V8::TearDown() { |
103 Isolate* isolate = Isolate::Current(); | 100 Isolate* isolate = Isolate::Current(); |
104 ASSERT(isolate->IsDefaultIsolate()); | 101 ASSERT(isolate->IsDefaultIsolate()); |
105 | 102 |
106 if (!has_been_set_up_ || has_been_disposed_) return; | 103 if (!has_been_set_up_ || has_been_disposed_) return; |
107 | 104 |
108 // The isolate has to be torn down before clearing the LOperand | 105 // The isolate has to be torn down before clearing the LOperand |
109 // caches so that the optimizing compiler thread (if running) | 106 // caches so that the optimizing compiler thread (if running) |
110 // doesn't see an inconsistent view of the lithium instructions. | 107 // doesn't see an inconsistent view of the lithium instructions. |
111 isolate->TearDown(); | 108 isolate->TearDown(); |
112 delete isolate; | 109 delete isolate; |
113 | 110 |
114 ElementsAccessor::TearDown(); | 111 ElementsAccessor::TearDown(); |
115 LOperand::TearDownCaches(); | 112 LOperand::TearDownCaches(); |
116 ExternalReference::TearDownMathExpData(); | 113 ExternalReference::TearDownMathExpData(); |
117 RegisteredExtension::UnregisterAll(); | 114 RegisteredExtension::UnregisterAll(); |
118 Isolate::GlobalTearDown(); | 115 Isolate::GlobalTearDown(); |
119 | 116 |
120 is_running_ = false; | |
121 has_been_disposed_ = true; | 117 has_been_disposed_ = true; |
122 | 118 |
123 delete call_completed_callbacks_; | 119 delete call_completed_callbacks_; |
124 call_completed_callbacks_ = NULL; | 120 call_completed_callbacks_ = NULL; |
125 | 121 |
126 Sampler::TearDown(); | 122 Sampler::TearDown(); |
127 OS::TearDown(); | 123 OS::TearDown(); |
128 } | 124 } |
129 | 125 |
130 | 126 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 ExternalReference::SetUp(); | 320 ExternalReference::SetUp(); |
325 Bootstrapper::InitializeOncePerProcess(); | 321 Bootstrapper::InitializeOncePerProcess(); |
326 } | 322 } |
327 | 323 |
328 | 324 |
329 void V8::InitializeOncePerProcess() { | 325 void V8::InitializeOncePerProcess() { |
330 CallOnce(&init_once, &InitializeOncePerProcessImpl); | 326 CallOnce(&init_once, &InitializeOncePerProcessImpl); |
331 } | 327 } |
332 | 328 |
333 } } // namespace v8::internal | 329 } } // namespace v8::internal |
OLD | NEW |