[simulator] Hoist out common {SimulatorBase::TearDown}.

R=clemensh@chromium.org

Change-Id: I53b9de78d6070d04b7535c828fd72225fd93afde
Reviewed-on: https://chromium-review.googlesource.com/829375
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50405}
This commit is contained in:
Michael Starzinger 2017-12-15 15:04:43 +01:00 committed by Commit Bot
parent d7b33bf623
commit cd9e121128
9 changed files with 15 additions and 66 deletions

View File

@ -706,17 +706,6 @@ Simulator::~Simulator() {
free(stack_);
}
// static
void SimulatorBase::TearDown(base::CustomMatcherHashMap* i_cache) {
if (i_cache != nullptr) {
for (base::HashMap::Entry* entry = i_cache->Start(); entry != nullptr;
entry = i_cache->Next(entry)) {
delete static_cast<CachePage*>(entry->value);
}
delete i_cache;
}
}
// Get the active Simulator for the current thread.
Simulator* Simulator::current(Isolate* isolate) {

View File

@ -456,12 +456,6 @@ void Simulator::RunFrom(Instruction* start) {
}
// static
void SimulatorBase::TearDown(base::CustomMatcherHashMap* i_cache) {
// TODO(all): Simulator flush I cache
}
// Calls into the V8 runtime are based on this very simple interface.
// Note: To be able to return two values from some calls the code in runtime.cc
// uses the ObjectPair structure.

View File

@ -226,6 +226,10 @@ T FPRound(int64_t sign, int64_t exponent, uint64_t mantissa,
}
}
class CachePage {
// TODO(all): Simulate instruction cache.
};
// Representation of memory, with typed getters and setters for access.
class SimMemory {
public:

View File

@ -929,18 +929,6 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) {
Simulator::~Simulator() { free(stack_); }
// static
void SimulatorBase::TearDown(base::CustomMatcherHashMap* i_cache) {
if (i_cache != nullptr) {
for (base::CustomMatcherHashMap::Entry* entry = i_cache->Start();
entry != nullptr; entry = i_cache->Next(entry)) {
delete static_cast<CachePage*>(entry->value);
}
delete i_cache;
}
}
// Get the active Simulator for the current thread.
Simulator* Simulator::current(Isolate* isolate) {
v8::internal::Isolate::PerIsolateThreadData* isolate_data =

View File

@ -862,18 +862,6 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) {
Simulator::~Simulator() { free(stack_); }
// static
void SimulatorBase::TearDown(base::CustomMatcherHashMap* i_cache) {
if (i_cache != nullptr) {
for (base::HashMap::Entry* entry = i_cache->Start(); entry != nullptr;
entry = i_cache->Next(entry)) {
delete static_cast<CachePage*>(entry->value);
}
delete i_cache;
}
}
// Get the active Simulator for the current thread.
Simulator* Simulator::current(Isolate* isolate) {
v8::internal::Isolate::PerIsolateThreadData* isolate_data =

View File

@ -788,18 +788,6 @@ Simulator::~Simulator() {
}
// static
void SimulatorBase::TearDown(base::CustomMatcherHashMap* i_cache) {
if (i_cache != nullptr) {
for (base::HashMap::Entry* entry = i_cache->Start(); entry != nullptr;
entry = i_cache->Next(entry)) {
delete static_cast<CachePage*>(entry->value);
}
delete i_cache;
}
}
// Get the active Simulator for the current thread.
Simulator* Simulator::current(Isolate* isolate) {
v8::internal::Isolate::PerIsolateThreadData* isolate_data =

View File

@ -1539,18 +1539,6 @@ Simulator::Simulator(Isolate* isolate) : isolate_(isolate) {
Simulator::~Simulator() { free(stack_); }
// static
void SimulatorBase::TearDown(base::CustomMatcherHashMap* i_cache) {
if (i_cache != nullptr) {
for (base::HashMap::Entry* entry = i_cache->Start(); entry != nullptr;
entry = i_cache->Next(entry)) {
delete static_cast<CachePage*>(entry->value);
}
delete i_cache;
}
}
// Get the active Simulator for the current thread.
Simulator* Simulator::current(Isolate* isolate) {
v8::internal::Isolate::PerIsolateThreadData* isolate_data =

View File

@ -39,6 +39,17 @@ void SimulatorBase::Initialize(Isolate* isolate) {
ExternalReference::set_redirector(isolate, &RedirectExternalReference);
}
// static
void SimulatorBase::TearDown(base::CustomMatcherHashMap* i_cache) {
if (i_cache != nullptr) {
for (base::HashMap::Entry* entry = i_cache->Start(); entry != nullptr;
entry = i_cache->Next(entry)) {
delete static_cast<CachePage*>(entry->value);
}
delete i_cache;
}
}
// static
void* SimulatorBase::RedirectExternalReference(Isolate* isolate,
void* external_function,

View File

@ -24,7 +24,6 @@ class SimulatorBase {
// Call on isolate initialization and teardown.
static void Initialize(Isolate* isolate);
// TODO(mstarzinger): Move implementation to "simulator-base.cc" file.
static void TearDown(base::CustomMatcherHashMap* i_cache);
static base::Mutex* redirection_mutex() { return redirection_mutex_; }