Reviewers: Sven Panne,
Description:
Fix and re-enable test-api/InitializeAndDispose.
[email protected]
TEST=cctest/test-api/InitializeAndDispose
Please review this at https://codereview.chromium.org/504093002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+18, -11 lines):
M src/api.cc
M src/assembler.cc
M src/bootstrapper.cc
M src/compiler/instruction.cc
M src/elements.cc
M src/isolate.cc
M src/lithium.cc
M src/sampler.cc
M src/v8.cc
M test/cctest/cctest.status
M test/cctest/test-api.cc
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
45efd68312a864109ac7a0d18f35461c3a81841f..616571cd1d1e9d1ad3f9fce8991f6c313447e245
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -413,6 +413,7 @@ void RegisteredExtension::UnregisterAll() {
delete re;
re = next;
}
+ first_extension_ = NULL;
}
Index: src/assembler.cc
diff --git a/src/assembler.cc b/src/assembler.cc
index
4187675f1f0cff8a042823884917be342c489d7d..d2c8bd67772faf846ae1e4f1900be1d369eca68b
100644
--- a/src/assembler.cc
+++ b/src/assembler.cc
@@ -937,8 +937,11 @@ void ExternalReference::InitializeMathExpData() {
void ExternalReference::TearDownMathExpData() {
delete[] math_exp_constants_array;
+ math_exp_constants_array = NULL;
delete[] math_exp_log_table_array;
+ math_exp_log_table_array = NULL;
delete math_exp_data_mutex;
+ math_exp_data_mutex = NULL;
}
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index
e0e90b375104758a68ee51848f719c8e62f50237..fdc09081681dbabc5a3a88d13810e9827123285f
100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -99,10 +99,15 @@ void Bootstrapper::InitializeOncePerProcess() {
void Bootstrapper::TearDownExtensions() {
delete free_buffer_extension_;
+ free_buffer_extension_ = NULL;
delete gc_extension_;
+ gc_extension_ = NULL;
delete externalize_string_extension_;
+ externalize_string_extension_ = NULL;
delete statistics_extension_;
+ statistics_extension_ = NULL;
delete trigger_failure_extension_;
+ trigger_failure_extension_ = NULL;
}
Index: src/compiler/instruction.cc
diff --git a/src/compiler/instruction.cc b/src/compiler/instruction.cc
index
a2f4ed4f47f6b56ff5cd87cdc66af4b68a9d7860..dd80cad4cfd839c6d8e19e109077d299645180ee
100644
--- a/src/compiler/instruction.cc
+++ b/src/compiler/instruction.cc
@@ -75,6 +75,7 @@ void SubKindOperand<kOperandKind,
kNumCachedOperands>::SetUpCache() {
template <InstructionOperand::Kind kOperandKind, int kNumCachedOperands>
void SubKindOperand<kOperandKind, kNumCachedOperands>::TearDownCache() {
delete[] cache;
+ cache = NULL;
}
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index
76b9b03bf62d51a0ff4a59127f809f8f441fef84..121dd7d25eb0661dbe77432eb8345c11874b60ff
100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -120,7 +120,7 @@ ELEMENTS_LIST(ELEMENTS_TRAITS)
#undef ELEMENTS_TRAITS
-ElementsAccessor** ElementsAccessor::elements_accessors_;
+ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
static bool HasKey(Handle<FixedArray> array, Handle<Object> key_handle) {
@@ -1735,6 +1735,7 @@ void ElementsAccessor::InitializeOncePerProcess() {
void ElementsAccessor::TearDown() {
+ if (elements_accessors_ == NULL) return;
#define ACCESSOR_DELETE(Class, Kind, Store) delete
elements_accessors_[Kind];
ELEMENTS_LIST(ACCESSOR_DELETE)
#undef ACCESSOR_DELETE
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index
0f1f7028a042c60a564a9e732f6d8d19c9c66205..9685adfc3b32d9157536f133595273da53097d07
100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1592,6 +1592,7 @@ void Isolate::TearDown() {
void Isolate::GlobalTearDown() {
delete thread_data_table_;
+ thread_data_table_ = NULL;
}
Index: src/lithium.cc
diff --git a/src/lithium.cc b/src/lithium.cc
index
a8d4d22ab5cad967e732826aa2510d7266754dce..26d07b3c4a2075546e823905b0b696711b31ba11
100644
--- a/src/lithium.cc
+++ b/src/lithium.cc
@@ -145,6 +145,7 @@ void LSubKindOperand<kOperandKind,
kNumCachedOperands>::SetUpCache() {
template<LOperand::Kind kOperandKind, int kNumCachedOperands>
void LSubKindOperand<kOperandKind, kNumCachedOperands>::TearDownCache() {
delete[] cache;
+ cache = NULL;
}
Index: src/sampler.cc
diff --git a/src/sampler.cc b/src/sampler.cc
index
413b6be9060daa43c41bb6e41414ef419d1a299b..29fe27fd35866ffe62e26105fadbe728bfdc7666
100644
--- a/src/sampler.cc
+++ b/src/sampler.cc
@@ -276,7 +276,7 @@ class SimulatorHelper {
class SignalHandler : public AllStatic {
public:
static void SetUp() { if (!mutex_) mutex_ = new base::Mutex(); }
- static void TearDown() { delete mutex_; }
+ static void TearDown() { delete mutex_; mutex_ = NULL; }
static void IncreaseSamplerCount() {
base::LockGuard<base::Mutex> lock_guard(mutex_);
Index: src/v8.cc
diff --git a/src/v8.cc b/src/v8.cc
index
13a576b1c94d7ef1974aa0f7c30a58210c4c31c4..0c8579b09bf0fc57f86413906b8b6697f0b5252c
100644
--- a/src/v8.cc
+++ b/src/v8.cc
@@ -52,7 +52,6 @@ void V8::TearDown() {
ExternalReference::TearDownMathExpData();
RegisteredExtension::UnregisterAll();
Isolate::GlobalTearDown();
-
Sampler::TearDown();
}
Index: test/cctest/cctest.status
diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status
index
90617c920a1ef8069e3c1f9365acd31aff6ce361..f2bb922c4f3c8cfecc3266fdcb349881c7ad266a
100644
--- a/test/cctest/cctest.status
+++ b/test/cctest/cctest.status
@@ -35,10 +35,6 @@
# BUG(382): Weird test. Can't guarantee that it never times out.
'test-api/ApplyInterruption': [PASS, TIMEOUT],
- # TODO(mstarzinger): Fail gracefully on multiple V8::Dispose calls.
- 'test-api/InitializeAndDisposeOnce': [SKIP],
- 'test-api/InitializeAndDisposeMultiple': [SKIP],
-
# These tests always fail. They are here to test test.py. If
# they don't fail then test.py has failed.
'test-serialize/TestThatAlwaysFails': [FAIL],
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
c910f0ec5ea149d7acc38a4254a28e5b8b8a4d04..b427257d652daeb4b6adff4cf4f2155ac9dacbfb
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -130,19 +130,18 @@ static void SignatureCallback(
// Tests that call v8::V8::Dispose() cannot be threaded.
-TEST(InitializeAndDisposeOnce) {
+UNINITIALIZED_TEST(InitializeAndDisposeOnce) {
CHECK(v8::V8::Initialize());
CHECK(v8::V8::Dispose());
}
// Tests that call v8::V8::Dispose() cannot be threaded.
-TEST(InitializeAndDisposeMultiple) {
+UNINITIALIZED_TEST(InitializeAndDisposeMultiple) {
for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose());
for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize());
for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose());
- // TODO(mstarzinger): This should fail gracefully instead of asserting.
- // for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize());
+ for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize());
for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose());
}
--
--
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/d/optout.