Revision: 16496
Author: [email protected]
Date: Tue Sep 3 09:35:26 2013 UTC
Log: Move global V8::IsDead() into the Isolate.
[email protected]
BUG=v8:2744
Review URL: https://codereview.chromium.org/23549010
http://code.google.com/p/v8/source/detail?r=16496
Modified:
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/isolate.h
/branches/bleeding_edge/src/v8.cc
/branches/bleeding_edge/src/v8.h
=======================================
--- /branches/bleeding_edge/src/api.cc Tue Sep 3 06:59:01 2013 UTC
+++ /branches/bleeding_edge/src/api.cc Tue Sep 3 09:35:26 2013 UTC
@@ -220,7 +220,7 @@
// HeapIterator here without doing a special GC.
isolate->heap()->RecordStats(&heap_stats, false);
}
- i::V8::SetFatalError();
+ isolate->SignalFatalError();
FatalErrorCallback callback = GetFatalErrorHandler();
const char* message = "Allocation failed - process out of memory";
callback(location, message);
@@ -232,13 +232,15 @@
bool Utils::ReportApiFailure(const char* location, const char* message) {
FatalErrorCallback callback = GetFatalErrorHandler();
callback(location, message);
- i::V8::SetFatalError();
+ i::Isolate* isolate = i::Isolate::Current();
+ isolate->SignalFatalError();
return false;
}
bool V8::IsDead() {
- return i::V8::IsDead();
+ i::Isolate* isolate = i::Isolate::Current();
+ return isolate->IsDead();
}
@@ -277,7 +279,7 @@
*/
static inline bool IsDeadCheck(i::Isolate* isolate, const char* location) {
return !isolate->IsInitialized()
- && i::V8::IsDead() ? ReportV8Dead(location) : false;
+ && isolate->IsDead() ? ReportV8Dead(location) : false;
}
@@ -2843,7 +2845,7 @@
void i::Internals::CheckInitializedImpl(v8::Isolate* external_isolate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate);
- ApiCheck(isolate != NULL && isolate->IsInitialized() && !i::V8::IsDead(),
+ ApiCheck(isolate != NULL && isolate->IsInitialized()
&& !isolate->IsDead(),
"v8::internal::Internals::CheckInitialized()",
"Isolate is not initialized or V8 has died");
}
=======================================
--- /branches/bleeding_edge/src/isolate.cc Tue Sep 3 08:49:44 2013 UTC
+++ /branches/bleeding_edge/src/isolate.cc Tue Sep 3 09:35:26 2013 UTC
@@ -1793,6 +1793,7 @@
regexp_stack_(NULL),
date_cache_(NULL),
code_stub_interface_descriptors_(NULL),
+ has_fatal_error_(false),
use_crankshaft_(true),
initialized_from_snapshot_(false),
cpu_profiler_(NULL),
@@ -2149,6 +2150,8 @@
stress_deopt_count_ = FLAG_deopt_every_n_times;
+ has_fatal_error_ = false;
+
use_crankshaft_ = FLAG_crankshaft
&& !Serializer::enabled()
&& CPU::SupportsCrankshaft();
=======================================
--- /branches/bleeding_edge/src/isolate.h Tue Sep 3 08:49:44 2013 UTC
+++ /branches/bleeding_edge/src/isolate.h Tue Sep 3 09:35:26 2013 UTC
@@ -1058,6 +1058,9 @@
void SetTopLookupResult(LookupResult* top) {
thread_local_top_.top_lookup_result_ = top;
}
+
+ bool IsDead() { return has_fatal_error_; }
+ void SignalFatalError() { has_fatal_error_ = true; }
bool use_crankshaft() const { return use_crankshaft_; }
@@ -1302,6 +1305,9 @@
unibrow::Mapping<unibrow::Ecma262Canonicalize>
interp_canonicalize_mapping_;
CodeStubInterfaceDescriptor* code_stub_interface_descriptors_;
+ // True if fatal error has been signaled for this isolate.
+ bool has_fatal_error_;
+
// True if we are using the Crankshaft optimizing compiler.
bool use_crankshaft_;
=======================================
--- /branches/bleeding_edge/src/v8.cc Tue Sep 3 08:49:44 2013 UTC
+++ /branches/bleeding_edge/src/v8.cc Tue Sep 3 09:35:26 2013 UTC
@@ -52,7 +52,6 @@
bool V8::has_been_set_up_ = false;
bool V8::has_been_disposed_ = false;
-bool V8::has_fatal_error_ = false;
List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL;
v8::ArrayBuffer::Allocator* V8::array_buffer_allocator_ = NULL;
@@ -78,22 +77,15 @@
ASSERT(i::Isolate::CurrentPerIsolateThreadData()->isolate() ==
i::Isolate::Current());
- if (IsDead()) return false;
-
Isolate* isolate = Isolate::Current();
+ if (isolate->IsDead()) return false;
if (isolate->IsInitialized()) return true;
has_been_set_up_ = true;
- has_fatal_error_ = false;
has_been_disposed_ = false;
return isolate->Init(des);
}
-
-
-void V8::SetFatalError() {
- has_fatal_error_ = true;
-}
void V8::TearDown() {
=======================================
--- /branches/bleeding_edge/src/v8.h Tue Sep 3 08:49:44 2013 UTC
+++ /branches/bleeding_edge/src/v8.h Tue Sep 3 09:35:26 2013 UTC
@@ -82,10 +82,6 @@
// empty heap.
static bool Initialize(Deserializer* des);
static void TearDown();
- // To be dead you have to have lived
- // TODO(isolates): move IsDead to Isolate.
- static bool IsDead() { return has_fatal_error_ || has_been_disposed_; }
- static void SetFatalError();
// Report process out of memory. Implementation found in api.cc.
static void FatalProcessOutOfMemory(const char* location,
@@ -131,9 +127,6 @@
// True if V8 has ever been run
static bool has_been_set_up_;
- // True if error has been signaled for current engine
- // (reset to false if engine is restarted)
- static bool has_fatal_error_;
// True if engine has been shut down
// (reset if engine is restarted)
static bool has_been_disposed_;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.