Fix and re-enable test-api/InitializeAndDispose.

R=svenpanne@chromium.org
TEST=cctest/test-api/InitializeAndDispose

Review URL: https://codereview.chromium.org/504093002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23401 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7e6f6537
......@@ -413,6 +413,7 @@ void RegisteredExtension::UnregisterAll() {
delete re;
re = next;
}
first_extension_ = NULL;
}
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -75,6 +75,7 @@ void SubKindOperand<kOperandKind, kNumCachedOperands>::SetUpCache() {
template <InstructionOperand::Kind kOperandKind, int kNumCachedOperands>
void SubKindOperand<kOperandKind, kNumCachedOperands>::TearDownCache() {
delete[] cache;
cache = NULL;
}
......
......@@ -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
......
......@@ -1592,6 +1592,7 @@ void Isolate::TearDown() {
void Isolate::GlobalTearDown() {
delete thread_data_table_;
thread_data_table_ = NULL;
}
......
......@@ -145,6 +145,7 @@ void LSubKindOperand<kOperandKind, kNumCachedOperands>::SetUpCache() {
template<LOperand::Kind kOperandKind, int kNumCachedOperands>
void LSubKindOperand<kOperandKind, kNumCachedOperands>::TearDownCache() {
delete[] cache;
cache = NULL;
}
......
......@@ -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_);
......
......@@ -52,7 +52,6 @@ void V8::TearDown() {
ExternalReference::TearDownMathExpData();
RegisteredExtension::UnregisterAll();
Isolate::GlobalTearDown();
Sampler::TearDown();
FlagList::ResetAllFlags(); // Frees memory held by string arguments.
}
......
......@@ -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],
......
......@@ -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());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment