mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:59:47 +00:00
[ VM ] Additional cleanup in Dart_Initialize and Dart_Cleanup
Change-Id: I6dc02b3d9de16cc176eb97613bc0c7f0bb9b16eb Reviewed-on: https://dart-review.googlesource.com/77013 Commit-Queue: Ben Konyi <bkonyi@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Auto-Submit: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
41a875f420
commit
07852532e3
|
@ -282,7 +282,7 @@ static int Main(int argc, const char** argv) {
|
|||
TesterState::create_callback = CreateIsolateAndSetup;
|
||||
TesterState::cleanup_callback = CleanupIsolate;
|
||||
|
||||
error = Dart::InitOnce(
|
||||
error = Dart::Init(
|
||||
dart::bin::vm_snapshot_data, dart::bin::vm_snapshot_instructions,
|
||||
CreateIsolateAndSetup /* create */, NULL /* shutdown */,
|
||||
CleanupIsolate /* cleanup */, NULL /* thread_exit */,
|
||||
|
|
|
@ -5529,7 +5529,7 @@ void Deserializer::ReadVMSnapshot() {
|
|||
// allocations (e.g., FinalizeVMIsolate) before allocating new pages.
|
||||
heap_->old_space()->AbandonBumpAllocation();
|
||||
|
||||
Symbols::InitOnceFromSnapshot(isolate());
|
||||
Symbols::InitFromSnapshot(isolate());
|
||||
|
||||
Object::set_vm_isolate_snapshot_object_table(refs);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ void CodeObservers::Cleanup() {
|
|||
observers_ = NULL;
|
||||
}
|
||||
|
||||
void CodeObservers::InitOnce() {
|
||||
void CodeObservers::Init() {
|
||||
if (mutex_ == NULL) {
|
||||
mutex_ = new Mutex();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class CodeObserver {
|
|||
|
||||
class CodeObservers : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
static void Register(CodeObserver* observer);
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ bool HostCPUFeatures::initialized_ = false;
|
|||
|
||||
#if !defined(USING_SIMULATOR)
|
||||
#if HOST_OS_IOS
|
||||
void HostCPUFeatures::InitOnce() {
|
||||
void HostCPUFeatures::Init() {
|
||||
// TODO(24743): Actually check the CPU features and fail if we're missing
|
||||
// something assumed in a precompiled snapshot.
|
||||
hardware_ = "";
|
||||
|
@ -157,9 +157,9 @@ void HostCPUFeatures::InitOnce() {
|
|||
#endif
|
||||
}
|
||||
#else // HOST_OS_IOS
|
||||
void HostCPUFeatures::InitOnce() {
|
||||
void HostCPUFeatures::Init() {
|
||||
bool is_arm64 = false;
|
||||
CpuInfo::InitOnce();
|
||||
CpuInfo::Init();
|
||||
hardware_ = CpuInfo::GetCpuModel();
|
||||
|
||||
// Check for ARMv5TE, ARMv6, ARMv7, or aarch64.
|
||||
|
|
|
@ -27,7 +27,7 @@ enum ARMVersion {
|
|||
|
||||
class HostCPUFeatures : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
static const char* hardware() {
|
||||
DEBUG_ASSERT(initialized_);
|
||||
|
@ -92,7 +92,7 @@ class HostCPUFeatures : public AllStatic {
|
|||
|
||||
class TargetCPUFeatures : public AllStatic {
|
||||
public:
|
||||
static void InitOnce() { HostCPUFeatures::InitOnce(); }
|
||||
static void Init() { HostCPUFeatures::Init(); }
|
||||
static void Cleanup() { HostCPUFeatures::Cleanup(); }
|
||||
static bool double_truncate_round_supported() { return false; }
|
||||
static bool integer_division_supported() {
|
||||
|
|
|
@ -66,8 +66,8 @@ bool HostCPUFeatures::initialized_ = false;
|
|||
#endif
|
||||
|
||||
#if !defined(USING_SIMULATOR)
|
||||
void HostCPUFeatures::InitOnce() {
|
||||
CpuInfo::InitOnce();
|
||||
void HostCPUFeatures::Init() {
|
||||
CpuInfo::Init();
|
||||
hardware_ = CpuInfo::GetCpuModel();
|
||||
#if defined(DEBUG)
|
||||
initialized_ = true;
|
||||
|
@ -87,8 +87,8 @@ void HostCPUFeatures::Cleanup() {
|
|||
|
||||
#else // !defined(USING_SIMULATOR)
|
||||
|
||||
void HostCPUFeatures::InitOnce() {
|
||||
CpuInfo::InitOnce();
|
||||
void HostCPUFeatures::Init() {
|
||||
CpuInfo::Init();
|
||||
hardware_ = CpuInfo::GetCpuModel();
|
||||
#if defined(DEBUG)
|
||||
initialized_ = true;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace dart {
|
|||
|
||||
class HostCPUFeatures : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
static const char* hardware() {
|
||||
DEBUG_ASSERT(initialized_);
|
||||
|
@ -36,7 +36,7 @@ class HostCPUFeatures : public AllStatic {
|
|||
|
||||
class TargetCPUFeatures : public AllStatic {
|
||||
public:
|
||||
static void InitOnce() { HostCPUFeatures::InitOnce(); }
|
||||
static void Init() { HostCPUFeatures::Init(); }
|
||||
static void Cleanup() { HostCPUFeatures::Cleanup(); }
|
||||
static const char* hardware() { return HostCPUFeatures::hardware(); }
|
||||
static bool double_truncate_round_supported() { return false; }
|
||||
|
|
|
@ -25,8 +25,8 @@ const char* HostCPUFeatures::hardware_ = NULL;
|
|||
bool HostCPUFeatures::initialized_ = false;
|
||||
#endif
|
||||
|
||||
void HostCPUFeatures::InitOnce() {
|
||||
CpuInfo::InitOnce();
|
||||
void HostCPUFeatures::Init() {
|
||||
CpuInfo::Init();
|
||||
hardware_ = CpuInfo::GetCpuModel();
|
||||
#if defined(DEBUG)
|
||||
initialized_ = true;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace dart {
|
|||
|
||||
class HostCPUFeatures : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
|
||||
static const char* hardware() {
|
||||
|
@ -29,7 +29,7 @@ class HostCPUFeatures : public AllStatic {
|
|||
|
||||
class TargetCPUFeatures : public AllStatic {
|
||||
public:
|
||||
static void InitOnce() { HostCPUFeatures::InitOnce(); }
|
||||
static void Init() { HostCPUFeatures::Init(); }
|
||||
static void Cleanup() { HostCPUFeatures::Cleanup(); }
|
||||
|
||||
static const char* hardware() { return CPU::Id(); }
|
||||
|
|
|
@ -34,8 +34,8 @@ const char* HostCPUFeatures::hardware_ = NULL;
|
|||
bool HostCPUFeatures::initialized_ = false;
|
||||
#endif
|
||||
|
||||
void HostCPUFeatures::InitOnce() {
|
||||
CpuInfo::InitOnce();
|
||||
void HostCPUFeatures::Init() {
|
||||
CpuInfo::Init();
|
||||
|
||||
hardware_ = CpuInfo::GetCpuModel();
|
||||
sse2_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse2");
|
||||
|
|
|
@ -14,7 +14,7 @@ DECLARE_FLAG(bool, use_sse41);
|
|||
|
||||
class HostCPUFeatures : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
static const char* hardware() {
|
||||
DEBUG_ASSERT(initialized_);
|
||||
|
@ -42,7 +42,7 @@ class HostCPUFeatures : public AllStatic {
|
|||
|
||||
class TargetCPUFeatures : public AllStatic {
|
||||
public:
|
||||
static void InitOnce() { HostCPUFeatures::InitOnce(); }
|
||||
static void Init() { HostCPUFeatures::Init(); }
|
||||
static void Cleanup() { HostCPUFeatures::Cleanup(); }
|
||||
static const char* hardware() { return HostCPUFeatures::hardware(); }
|
||||
static bool sse2_supported() { return HostCPUFeatures::sse2_supported(); }
|
||||
|
|
|
@ -34,8 +34,8 @@ const char* HostCPUFeatures::hardware_ = NULL;
|
|||
bool HostCPUFeatures::initialized_ = false;
|
||||
#endif
|
||||
|
||||
void HostCPUFeatures::InitOnce() {
|
||||
CpuInfo::InitOnce();
|
||||
void HostCPUFeatures::Init() {
|
||||
CpuInfo::Init();
|
||||
hardware_ = CpuInfo::GetCpuModel();
|
||||
sse4_1_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse4_1") ||
|
||||
CpuInfo::FieldContains(kCpuInfoFeatures, "sse4.1");
|
||||
|
|
|
@ -14,7 +14,7 @@ DECLARE_FLAG(bool, use_sse41);
|
|||
|
||||
class HostCPUFeatures : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
static const char* hardware() {
|
||||
DEBUG_ASSERT(initialized_);
|
||||
|
@ -42,7 +42,7 @@ class HostCPUFeatures : public AllStatic {
|
|||
|
||||
class TargetCPUFeatures : public AllStatic {
|
||||
public:
|
||||
static void InitOnce() { HostCPUFeatures::InitOnce(); }
|
||||
static void Init() { HostCPUFeatures::Init(); }
|
||||
static void Cleanup() { HostCPUFeatures::Cleanup(); }
|
||||
static const char* hardware() { return HostCPUFeatures::hardware(); }
|
||||
static bool sse2_supported() { return HostCPUFeatures::sse2_supported(); }
|
||||
|
|
|
@ -34,7 +34,7 @@ void CpuId::GetCpuId(int32_t level, uint32_t info[4]) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void CpuId::InitOnce() {
|
||||
void CpuId::Init() {
|
||||
uint32_t info[4] = {static_cast<uint32_t>(-1)};
|
||||
|
||||
GetCpuId(0, info);
|
||||
|
|
|
@ -15,13 +15,13 @@ namespace dart {
|
|||
class CpuId : public AllStatic {
|
||||
public:
|
||||
#if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64)
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
|
||||
// Caller must free the result of field.
|
||||
static const char* field(CpuInfoIndices idx);
|
||||
#else
|
||||
static void InitOnce() {}
|
||||
static void Init() {}
|
||||
static void Cleanup() {}
|
||||
static const char* field(CpuInfoIndices idx) { return NULL; }
|
||||
#endif
|
||||
|
|
|
@ -36,7 +36,7 @@ enum CpuInfoMethod {
|
|||
|
||||
class CpuInfo : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
|
||||
static const char* FieldName(CpuInfoIndices idx) {
|
||||
|
|
|
@ -15,10 +15,10 @@ namespace dart {
|
|||
CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault;
|
||||
const char* CpuInfo::fields_[kCpuInfoMax] = {0};
|
||||
|
||||
void CpuInfo::InitOnce() {
|
||||
void CpuInfo::Init() {
|
||||
// Initialize our read from /proc/cpuinfo.
|
||||
method_ = kCpuInfoSystem;
|
||||
ProcCpuInfo::InitOnce();
|
||||
ProcCpuInfo::Init();
|
||||
|
||||
#if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64)
|
||||
fields_[kCpuInfoProcessor] = "vendor_id";
|
||||
|
|
|
@ -15,13 +15,13 @@ namespace dart {
|
|||
CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault;
|
||||
const char* CpuInfo::fields_[kCpuInfoMax] = {0};
|
||||
|
||||
void CpuInfo::InitOnce() {
|
||||
void CpuInfo::Init() {
|
||||
// TODO(zra): Add support for HOST_ARCH_ARM64
|
||||
#if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64)
|
||||
method_ = kCpuInfoCpuId;
|
||||
|
||||
// Initialize the CpuId information.
|
||||
CpuId::InitOnce();
|
||||
CpuId::Init();
|
||||
|
||||
fields_[kCpuInfoProcessor] = "Processor";
|
||||
fields_[kCpuInfoModel] = "Hardware";
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace dart {
|
|||
CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault;
|
||||
const char* CpuInfo::fields_[kCpuInfoMax] = {0};
|
||||
|
||||
void CpuInfo::InitOnce() {
|
||||
void CpuInfo::Init() {
|
||||
#if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64)
|
||||
fields_[kCpuInfoProcessor] = "vendor_id";
|
||||
fields_[kCpuInfoModel] = "model name";
|
||||
|
@ -28,7 +28,7 @@ void CpuInfo::InitOnce() {
|
|||
fields_[kCpuInfoFeatures] = "flags";
|
||||
fields_[kCpuInfoArchitecture] = "CPU architecture";
|
||||
method_ = kCpuInfoCpuId;
|
||||
CpuId::InitOnce();
|
||||
CpuId::Init();
|
||||
#elif defined(HOST_ARCH_ARM)
|
||||
fields_[kCpuInfoProcessor] = "Processor";
|
||||
fields_[kCpuInfoModel] = "model name";
|
||||
|
@ -36,7 +36,7 @@ void CpuInfo::InitOnce() {
|
|||
fields_[kCpuInfoFeatures] = "Features";
|
||||
fields_[kCpuInfoArchitecture] = "CPU architecture";
|
||||
method_ = kCpuInfoSystem;
|
||||
ProcCpuInfo::InitOnce();
|
||||
ProcCpuInfo::Init();
|
||||
#elif defined(HOST_ARCH_ARM64)
|
||||
fields_[kCpuInfoProcessor] = "Processor";
|
||||
fields_[kCpuInfoModel] = "CPU implementer";
|
||||
|
@ -44,7 +44,7 @@ void CpuInfo::InitOnce() {
|
|||
fields_[kCpuInfoFeatures] = "Features";
|
||||
fields_[kCpuInfoArchitecture] = "CPU architecture";
|
||||
method_ = kCpuInfoSystem;
|
||||
ProcCpuInfo::InitOnce();
|
||||
ProcCpuInfo::Init();
|
||||
#else
|
||||
#error Unrecognized target architecture
|
||||
#endif
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace dart {
|
|||
CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault;
|
||||
const char* CpuInfo::fields_[kCpuInfoMax] = {0};
|
||||
|
||||
void CpuInfo::InitOnce() {
|
||||
void CpuInfo::Init() {
|
||||
method_ = kCpuInfoSystem;
|
||||
|
||||
fields_[kCpuInfoProcessor] = "machdep.cpu.vendor";
|
||||
|
|
|
@ -19,11 +19,11 @@ namespace dart {
|
|||
CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault;
|
||||
const char* CpuInfo::fields_[kCpuInfoMax] = {0};
|
||||
|
||||
void CpuInfo::InitOnce() {
|
||||
void CpuInfo::Init() {
|
||||
method_ = kCpuInfoCpuId;
|
||||
|
||||
// Initialize the CpuId information.
|
||||
CpuId::InitOnce();
|
||||
CpuId::Init();
|
||||
|
||||
fields_[kCpuInfoProcessor] = "Processor";
|
||||
fields_[kCpuInfoModel] = "Hardware";
|
||||
|
|
|
@ -109,19 +109,19 @@ static void CheckOffsets() {
|
|||
#undef CHECK_OFFSET
|
||||
}
|
||||
|
||||
char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
|
||||
const uint8_t* instructions_snapshot,
|
||||
Dart_IsolateCreateCallback create,
|
||||
Dart_IsolateShutdownCallback shutdown,
|
||||
Dart_IsolateCleanupCallback cleanup,
|
||||
Dart_ThreadExitCallback thread_exit,
|
||||
Dart_FileOpenCallback file_open,
|
||||
Dart_FileReadCallback file_read,
|
||||
Dart_FileWriteCallback file_write,
|
||||
Dart_FileCloseCallback file_close,
|
||||
Dart_EntropySource entropy_source,
|
||||
Dart_GetVMServiceAssetsArchive get_service_assets,
|
||||
bool start_kernel_isolate) {
|
||||
char* Dart::Init(const uint8_t* vm_isolate_snapshot,
|
||||
const uint8_t* instructions_snapshot,
|
||||
Dart_IsolateCreateCallback create,
|
||||
Dart_IsolateShutdownCallback shutdown,
|
||||
Dart_IsolateCleanupCallback cleanup,
|
||||
Dart_ThreadExitCallback thread_exit,
|
||||
Dart_FileOpenCallback file_open,
|
||||
Dart_FileReadCallback file_read,
|
||||
Dart_FileWriteCallback file_write,
|
||||
Dart_FileCloseCallback file_close,
|
||||
Dart_EntropySource entropy_source,
|
||||
Dart_GetVMServiceAssetsArchive get_service_assets,
|
||||
bool start_kernel_isolate) {
|
||||
CheckOffsets();
|
||||
// TODO(iposva): Fix race condition here.
|
||||
if (vm_isolate_ != NULL || !Flags::Initialized()) {
|
||||
|
@ -153,36 +153,36 @@ char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
|
|||
FLAG_optimization_counter_threshold = -1;
|
||||
}
|
||||
|
||||
FrameLayout::InitOnce();
|
||||
FrameLayout::Init();
|
||||
|
||||
set_thread_exit_callback(thread_exit);
|
||||
SetFileCallbacks(file_open, file_read, file_write, file_close);
|
||||
set_entropy_source_callback(entropy_source);
|
||||
OS::InitOnce();
|
||||
NOT_IN_PRODUCT(CodeObservers::InitOnce());
|
||||
OS::Init();
|
||||
NOT_IN_PRODUCT(CodeObservers::Init());
|
||||
start_time_micros_ = OS::GetCurrentMonotonicMicros();
|
||||
VirtualMemory::InitOnce();
|
||||
OSThread::InitOnce();
|
||||
VirtualMemory::Init();
|
||||
OSThread::Init();
|
||||
if (FLAG_support_timeline) {
|
||||
Timeline::InitOnce();
|
||||
Timeline::Init();
|
||||
}
|
||||
NOT_IN_PRODUCT(
|
||||
TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::InitOnce"));
|
||||
Isolate::InitOnce();
|
||||
IdleNotifier::InitOnce();
|
||||
PortMap::InitOnce();
|
||||
FreeListElement::InitOnce();
|
||||
ForwardingCorpse::InitOnce();
|
||||
Api::InitOnce();
|
||||
NativeSymbolResolver::InitOnce();
|
||||
NOT_IN_PRODUCT(Profiler::InitOnce());
|
||||
TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::Init"));
|
||||
Isolate::InitVM();
|
||||
IdleNotifier::Init();
|
||||
PortMap::Init();
|
||||
FreeListElement::Init();
|
||||
ForwardingCorpse::Init();
|
||||
Api::Init();
|
||||
NativeSymbolResolver::Init();
|
||||
NOT_IN_PRODUCT(Profiler::Init());
|
||||
SemiSpace::Init();
|
||||
NOT_IN_PRODUCT(Metric::InitOnce());
|
||||
StoreBuffer::InitOnce();
|
||||
MarkingStack::InitOnce();
|
||||
NOT_IN_PRODUCT(Metric::Init());
|
||||
StoreBuffer::Init();
|
||||
MarkingStack::Init();
|
||||
|
||||
#if defined(USING_SIMULATOR)
|
||||
Simulator::InitOnce();
|
||||
Simulator::Init();
|
||||
#endif
|
||||
// Create the read-only handles area.
|
||||
ASSERT(predefined_handles_ == NULL);
|
||||
|
@ -198,7 +198,7 @@ char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
|
|||
// Setup default flags for the VM isolate.
|
||||
Dart_IsolateFlags api_flags;
|
||||
Isolate::FlagsInitialize(&api_flags);
|
||||
vm_isolate_ = Isolate::Init("vm-isolate", api_flags, is_vm_isolate);
|
||||
vm_isolate_ = Isolate::InitIsolate("vm-isolate", api_flags, is_vm_isolate);
|
||||
// Verify assumptions about executing in the VM isolate.
|
||||
ASSERT(vm_isolate_ == Isolate::Current());
|
||||
ASSERT(vm_isolate_ == Thread::Current()->isolate());
|
||||
|
@ -209,10 +209,10 @@ char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
|
|||
HandleScope handle_scope(T);
|
||||
Object::InitNull(vm_isolate_);
|
||||
ObjectStore::Init(vm_isolate_);
|
||||
TargetCPUFeatures::InitOnce();
|
||||
Object::InitOnce(vm_isolate_);
|
||||
ArgumentsDescriptor::InitOnce();
|
||||
ICData::InitOnce();
|
||||
TargetCPUFeatures::Init();
|
||||
Object::Init(vm_isolate_);
|
||||
ArgumentsDescriptor::Init();
|
||||
ICData::Init();
|
||||
if (vm_isolate_snapshot != NULL) {
|
||||
NOT_IN_PRODUCT(TimelineDurationScope tds(Timeline::GetVMStream(),
|
||||
"VMIsolateSnapshot"));
|
||||
|
@ -237,15 +237,15 @@ char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
|
|||
#if defined(DART_PRECOMPILED_RUNTIME)
|
||||
return strdup("Precompiled runtime requires a precompiled snapshot");
|
||||
#else
|
||||
StubCode::InitOnce();
|
||||
Object::FinishInitOnce(vm_isolate_);
|
||||
StubCode::Init();
|
||||
Object::FinishInit(vm_isolate_);
|
||||
// MallocHooks can't be initialized until StubCode has been since stack
|
||||
// trace generation relies on stub methods that are generated in
|
||||
// StubCode::InitOnce().
|
||||
// StubCode::Init().
|
||||
// TODO(bkonyi) Split initialization for stack trace collection from the
|
||||
// initialization for the actual malloc hooks to increase accuracy of
|
||||
// memory consumption statistics.
|
||||
MallocHooks::InitOnce();
|
||||
MallocHooks::Init();
|
||||
#endif
|
||||
} else {
|
||||
return strdup("Invalid vm isolate snapshot seen");
|
||||
|
@ -256,7 +256,7 @@ char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
|
|||
// Must copy before leaving the zone.
|
||||
return strdup(error.ToErrorCString());
|
||||
}
|
||||
Object::FinishInitOnce(vm_isolate_);
|
||||
Object::FinishInit(vm_isolate_);
|
||||
#if !defined(PRODUCT)
|
||||
if (tds.enabled()) {
|
||||
tds.SetNumArguments(2);
|
||||
|
@ -284,22 +284,22 @@ char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
|
|||
return strdup("Missing vm isolate snapshot");
|
||||
#else
|
||||
vm_snapshot_kind_ = Snapshot::kNone;
|
||||
StubCode::InitOnce();
|
||||
Object::FinishInitOnce(vm_isolate_);
|
||||
StubCode::Init();
|
||||
Object::FinishInit(vm_isolate_);
|
||||
// MallocHooks can't be initialized until StubCode has been since stack
|
||||
// trace generation relies on stub methods that are generated in
|
||||
// StubCode::InitOnce().
|
||||
// StubCode::Init().
|
||||
// TODO(bkonyi) Split initialization for stack trace collection from the
|
||||
// initialization for the actual malloc hooks to increase accuracy of
|
||||
// memory consumption statistics.
|
||||
MallocHooks::InitOnce();
|
||||
Symbols::InitOnce(vm_isolate_);
|
||||
MallocHooks::Init();
|
||||
Symbols::Init(vm_isolate_);
|
||||
#endif
|
||||
}
|
||||
// We need to initialize the constants here for the vm isolate thread due to
|
||||
// bootstrapping issues.
|
||||
T->InitVMConstants();
|
||||
Scanner::InitOnce();
|
||||
Scanner::Init();
|
||||
#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64)
|
||||
// Dart VM requires at least SSE2.
|
||||
if (!TargetCPUFeatures::sse2_supported()) {
|
||||
|
@ -389,10 +389,10 @@ const char* Dart::Cleanup() {
|
|||
OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down profiling\n",
|
||||
UptimeMillis());
|
||||
}
|
||||
Profiler::Shutdown();
|
||||
Profiler::Cleanup();
|
||||
#endif // !defined(PRODUCT)
|
||||
|
||||
NativeSymbolResolver::ShutdownOnce();
|
||||
NativeSymbolResolver::Cleanup();
|
||||
|
||||
{
|
||||
// Set the VM isolate as current isolate when shutting down
|
||||
|
@ -492,10 +492,11 @@ const char* Dart::Cleanup() {
|
|||
ASSERT(Isolate::IsolateListLength() == 0);
|
||||
PortMap::Cleanup();
|
||||
IdleNotifier::Cleanup();
|
||||
ICData::Cleanup();
|
||||
ArgumentsDescriptor::Cleanup();
|
||||
TargetCPUFeatures::Cleanup();
|
||||
MarkingStack::ShutDown();
|
||||
StoreBuffer::ShutDown();
|
||||
MarkingStack::ShutDown();
|
||||
MarkingStack::Cleanup();
|
||||
StoreBuffer::Cleanup();
|
||||
Object::Cleanup();
|
||||
SemiSpace::Cleanup();
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
@ -523,19 +524,20 @@ const char* Dart::Cleanup() {
|
|||
OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down timeline\n",
|
||||
UptimeMillis());
|
||||
}
|
||||
Timeline::Shutdown();
|
||||
Timeline::Cleanup();
|
||||
}
|
||||
OS::Cleanup();
|
||||
if (FLAG_trace_shutdown) {
|
||||
OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done\n", UptimeMillis());
|
||||
}
|
||||
MallocHooks::TearDown();
|
||||
MallocHooks::Cleanup();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Isolate* Dart::CreateIsolate(const char* name_prefix,
|
||||
const Dart_IsolateFlags& api_flags) {
|
||||
// Create a new isolate.
|
||||
Isolate* isolate = Isolate::Init(name_prefix, api_flags);
|
||||
Isolate* isolate = Isolate::InitIsolate(name_prefix, api_flags);
|
||||
return isolate;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,19 +24,19 @@ class Program;
|
|||
|
||||
class Dart : public AllStatic {
|
||||
public:
|
||||
static char* InitOnce(const uint8_t* vm_snapshot_data,
|
||||
const uint8_t* vm_snapshot_instructions,
|
||||
Dart_IsolateCreateCallback create,
|
||||
Dart_IsolateShutdownCallback shutdown,
|
||||
Dart_IsolateCleanupCallback cleanup,
|
||||
Dart_ThreadExitCallback thread_exit,
|
||||
Dart_FileOpenCallback file_open,
|
||||
Dart_FileReadCallback file_read,
|
||||
Dart_FileWriteCallback file_write,
|
||||
Dart_FileCloseCallback file_close,
|
||||
Dart_EntropySource entropy_source,
|
||||
Dart_GetVMServiceAssetsArchive get_service_assets,
|
||||
bool start_kernel_isolate);
|
||||
static char* Init(const uint8_t* vm_snapshot_data,
|
||||
const uint8_t* vm_snapshot_instructions,
|
||||
Dart_IsolateCreateCallback create,
|
||||
Dart_IsolateShutdownCallback shutdown,
|
||||
Dart_IsolateCleanupCallback cleanup,
|
||||
Dart_ThreadExitCallback thread_exit,
|
||||
Dart_FileOpenCallback file_open,
|
||||
Dart_FileReadCallback file_read,
|
||||
Dart_FileWriteCallback file_write,
|
||||
Dart_FileCloseCallback file_close,
|
||||
Dart_EntropySource entropy_source,
|
||||
Dart_GetVMServiceAssetsArchive get_service_assets,
|
||||
bool start_kernel_isolate);
|
||||
static const char* Cleanup();
|
||||
|
||||
static Isolate* CreateIsolate(const char* name_prefix,
|
||||
|
|
|
@ -478,7 +478,7 @@ ApiLocalScope* Api::TopScope(Thread* thread) {
|
|||
return scope;
|
||||
}
|
||||
|
||||
void Api::InitOnce() {
|
||||
void Api::Init() {
|
||||
if (api_native_key_ == kUnsetThreadLocalKey) {
|
||||
api_native_key_ = OSThread::CreateThreadLocal();
|
||||
}
|
||||
|
@ -1002,12 +1002,12 @@ DART_EXPORT char* Dart_Initialize(Dart_InitializeParams* params) {
|
|||
"Invalid Dart_InitializeParams version.");
|
||||
}
|
||||
|
||||
return Dart::InitOnce(
|
||||
params->vm_snapshot_data, params->vm_snapshot_instructions,
|
||||
params->create, params->shutdown, params->cleanup, params->thread_exit,
|
||||
params->file_open, params->file_read, params->file_write,
|
||||
params->file_close, params->entropy_source, params->get_service_assets,
|
||||
params->start_kernel_isolate);
|
||||
return Dart::Init(params->vm_snapshot_data, params->vm_snapshot_instructions,
|
||||
params->create, params->shutdown, params->cleanup,
|
||||
params->thread_exit, params->file_open, params->file_read,
|
||||
params->file_write, params->file_close,
|
||||
params->entropy_source, params->get_service_assets,
|
||||
params->start_kernel_isolate);
|
||||
}
|
||||
|
||||
DART_EXPORT char* Dart_Cleanup() {
|
||||
|
|
|
@ -238,8 +238,8 @@ class Api : AllStatic {
|
|||
// Retrieves the top ApiLocalScope.
|
||||
static ApiLocalScope* TopScope(Thread* thread);
|
||||
|
||||
// Performs one-time initialization needed by the API.
|
||||
static void InitOnce();
|
||||
// Performs initialization needed by the API.
|
||||
static void Init();
|
||||
|
||||
// Allocates handles for objects in the VM isolate.
|
||||
static void InitHandles();
|
||||
|
|
|
@ -502,12 +502,19 @@ RawArray* ArgumentsDescriptor::NewNonCached(intptr_t type_args_len,
|
|||
return descriptor.raw();
|
||||
}
|
||||
|
||||
void ArgumentsDescriptor::InitOnce() {
|
||||
void ArgumentsDescriptor::Init() {
|
||||
for (int i = 0; i < kCachedDescriptorCount; i++) {
|
||||
cached_args_descriptors_[i] = NewNonCached(/*type_args_len=*/0, i, false);
|
||||
}
|
||||
}
|
||||
|
||||
void ArgumentsDescriptor::Cleanup() {
|
||||
for (int i = 0; i < kCachedDescriptorCount; i++) {
|
||||
// Don't free pointers to RawArray objects managed by the VM.
|
||||
cached_args_descriptors_[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
RawObject* DartLibraryCalls::InstanceCreate(const Library& lib,
|
||||
const String& class_name,
|
||||
const String& constructor_name,
|
||||
|
|
|
@ -73,7 +73,10 @@ class ArgumentsDescriptor : public ValueObject {
|
|||
static RawArray* New(intptr_t type_args_len, intptr_t num_arguments);
|
||||
|
||||
// Initialize the preallocated fixed length arguments descriptors cache.
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
// Clear the preallocated fixed length arguments descriptors cache.
|
||||
static void Cleanup();
|
||||
|
||||
enum { kCachedDescriptorCount = 32 };
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ ForwardingCorpse* ForwardingCorpse::AsForwarder(uword addr, intptr_t size) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void ForwardingCorpse::InitOnce() {
|
||||
void ForwardingCorpse::Init() {
|
||||
ASSERT(sizeof(ForwardingCorpse) == kObjectAlignment);
|
||||
ASSERT(OFFSET_OF(ForwardingCorpse, tags_) == Object::tags_offset());
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class ForwardingCorpse {
|
|||
|
||||
static ForwardingCorpse* AsForwarder(uword addr, intptr_t size);
|
||||
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
// Used to allocate class for forwarding corpses in Object::InitOnce.
|
||||
class FakeInstance {
|
||||
|
|
|
@ -44,7 +44,7 @@ FreeListElement* FreeListElement::AsElement(uword addr, intptr_t size) {
|
|||
// writable.
|
||||
}
|
||||
|
||||
void FreeListElement::InitOnce() {
|
||||
void FreeListElement::Init() {
|
||||
ASSERT(sizeof(FreeListElement) == kObjectAlignment);
|
||||
ASSERT(OFFSET_OF(FreeListElement, tags_) == Object::tags_offset());
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class FreeListElement {
|
|||
|
||||
static FreeListElement* AsElement(uword addr, intptr_t size);
|
||||
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
static intptr_t HeaderSizeFor(intptr_t size);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ template <int BlockSize>
|
|||
Mutex* BlockStack<BlockSize>::global_mutex_ = NULL;
|
||||
|
||||
template <int BlockSize>
|
||||
void BlockStack<BlockSize>::InitOnce() {
|
||||
void BlockStack<BlockSize>::Init() {
|
||||
global_empty_ = new List();
|
||||
if (global_mutex_ == NULL) {
|
||||
global_mutex_ = new Mutex();
|
||||
|
@ -35,7 +35,7 @@ void BlockStack<BlockSize>::InitOnce() {
|
|||
}
|
||||
|
||||
template <int BlockSize>
|
||||
void BlockStack<BlockSize>::ShutDown() {
|
||||
void BlockStack<BlockSize>::Cleanup() {
|
||||
delete global_empty_;
|
||||
global_empty_ = NULL;
|
||||
}
|
||||
|
|
|
@ -87,8 +87,8 @@ class BlockStack {
|
|||
|
||||
BlockStack();
|
||||
~BlockStack();
|
||||
static void InitOnce();
|
||||
static void ShutDown();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
|
||||
// Partially filled blocks can be reused, and there is an "inifite" supply
|
||||
// of empty blocks (reused or newly allocated). In any case, the caller
|
||||
|
|
|
@ -1036,7 +1036,7 @@ Isolate::~Isolate() {
|
|||
}
|
||||
}
|
||||
|
||||
void Isolate::InitOnce() {
|
||||
void Isolate::InitVM() {
|
||||
create_callback_ = NULL;
|
||||
if (isolates_list_monitor_ == NULL) {
|
||||
isolates_list_monitor_ = new Monitor();
|
||||
|
@ -1045,16 +1045,16 @@ void Isolate::InitOnce() {
|
|||
EnableIsolateCreation();
|
||||
}
|
||||
|
||||
Isolate* Isolate::Init(const char* name_prefix,
|
||||
const Dart_IsolateFlags& api_flags,
|
||||
bool is_vm_isolate) {
|
||||
Isolate* Isolate::InitIsolate(const char* name_prefix,
|
||||
const Dart_IsolateFlags& api_flags,
|
||||
bool is_vm_isolate) {
|
||||
Isolate* result = new Isolate(api_flags);
|
||||
ASSERT(result != NULL);
|
||||
|
||||
#if !defined(PRODUCT)
|
||||
// Initialize metrics.
|
||||
#define ISOLATE_METRIC_INIT(type, variable, name, unit) \
|
||||
result->metric_##variable##_.Init(result, name, NULL, Metric::unit);
|
||||
result->metric_##variable##_.InitInstance(result, name, NULL, Metric::unit);
|
||||
ISOLATE_METRIC_LIST(ISOLATE_METRIC_INIT);
|
||||
#undef ISOLATE_METRIC_INIT
|
||||
#endif // !defined(PRODUCT)
|
||||
|
|
|
@ -801,10 +801,10 @@ class Isolate : public BaseIsolate {
|
|||
|
||||
explicit Isolate(const Dart_IsolateFlags& api_flags);
|
||||
|
||||
static void InitOnce();
|
||||
static Isolate* Init(const char* name_prefix,
|
||||
const Dart_IsolateFlags& api_flags,
|
||||
bool is_vm_isolate = false);
|
||||
static void InitVM();
|
||||
static Isolate* InitIsolate(const char* name_prefix,
|
||||
const Dart_IsolateFlags& api_flags,
|
||||
bool is_vm_isolate = false);
|
||||
|
||||
// The isolates_list_monitor_ should be held when calling Kill().
|
||||
void KillLocked(LibMsgId msg_id);
|
||||
|
|
|
@ -184,6 +184,7 @@ TEST_CASE(IsolateReload_KernelIncrementalCompileAppAndLib) {
|
|||
""
|
||||
}};
|
||||
// clang-format on
|
||||
|
||||
{
|
||||
const uint8_t* kernel_buffer = NULL;
|
||||
intptr_t kernel_buffer_size = 0;
|
||||
|
|
|
@ -23,8 +23,8 @@ extern const intptr_t kSkipCount;
|
|||
|
||||
class MallocHooks : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void TearDown();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
static bool ProfilingEnabled();
|
||||
static bool stack_trace_collection_enabled();
|
||||
static void set_stack_trace_collection_enabled(bool enabled);
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
|
||||
namespace dart {
|
||||
|
||||
void MallocHooks::InitOnce() {
|
||||
void MallocHooks::Init() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
void MallocHooks::TearDown() {
|
||||
void MallocHooks::Cleanup() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ void MallocHooksState::TearDown() {
|
|||
address_map_ = NULL;
|
||||
}
|
||||
|
||||
void MallocHooks::InitOnce() {
|
||||
void MallocHooks::Init() {
|
||||
if (!FLAG_profiler_native_memory || MallocHooks::Active()) {
|
||||
return;
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ void MallocHooks::InitOnce() {
|
|||
ASSERT(success);
|
||||
}
|
||||
|
||||
void MallocHooks::TearDown() {
|
||||
void MallocHooks::Cleanup() {
|
||||
if (!FLAG_profiler_native_memory || !MallocHooks::Active()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -31,12 +31,12 @@ class EnableMallocHooksScope : public ValueObject {
|
|||
OSThread::Current(); // Ensure not allocated during test.
|
||||
saved_enable_malloc_hooks_ = FLAG_profiler_native_memory;
|
||||
FLAG_profiler_native_memory = true;
|
||||
MallocHooks::InitOnce();
|
||||
MallocHooks::Init();
|
||||
MallocHooks::ResetStats();
|
||||
}
|
||||
|
||||
~EnableMallocHooksScope() {
|
||||
MallocHooks::TearDown();
|
||||
MallocHooks::Cleanup();
|
||||
FLAG_profiler_native_memory = saved_enable_malloc_hooks_;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ class EnableMallocHooksAndStacksScope : public EnableMallocHooksScope {
|
|||
MallocHooks::set_stack_trace_collection_enabled(true);
|
||||
if (!FLAG_profiler) {
|
||||
FLAG_profiler = true;
|
||||
Profiler::InitOnce();
|
||||
Profiler::Init();
|
||||
}
|
||||
MallocHooks::ResetStats();
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
|
||||
namespace dart {
|
||||
|
||||
void MallocHooks::InitOnce() {
|
||||
void MallocHooks::Init() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
void MallocHooks::TearDown() {
|
||||
void MallocHooks::Cleanup() {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
|
|
|
@ -670,7 +670,8 @@ Monitor* IdleNotifier::monitor_ = NULL;
|
|||
bool IdleNotifier::task_running_ = false;
|
||||
IdleNotifier::Timer* IdleNotifier::queue_ = NULL;
|
||||
|
||||
void IdleNotifier::InitOnce() {
|
||||
void IdleNotifier::Init() {
|
||||
ASSERT(monitor_ == NULL);
|
||||
monitor_ = new Monitor();
|
||||
}
|
||||
|
||||
|
@ -697,6 +698,7 @@ void IdleNotifier::Stop() {
|
|||
void IdleNotifier::Cleanup() {
|
||||
ASSERT(queue_ == NULL);
|
||||
ASSERT(!task_running_);
|
||||
ASSERT(monitor_ != NULL);
|
||||
delete monitor_;
|
||||
monitor_ = NULL;
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ class MessageHandler {
|
|||
|
||||
class IdleNotifier : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void Stop();
|
||||
static void Cleanup();
|
||||
static void Update(MessageHandler* handler, int64_t expirary);
|
||||
|
|
|
@ -30,10 +30,10 @@ Metric::Metric()
|
|||
value_(0),
|
||||
next_(NULL) {}
|
||||
|
||||
void Metric::Init(Isolate* isolate,
|
||||
const char* name,
|
||||
const char* description,
|
||||
Unit unit) {
|
||||
void Metric::InitInstance(Isolate* isolate,
|
||||
const char* name,
|
||||
const char* description,
|
||||
Unit unit) {
|
||||
// Only called once.
|
||||
ASSERT(next_ == NULL);
|
||||
ASSERT(name != NULL);
|
||||
|
@ -44,7 +44,9 @@ void Metric::Init(Isolate* isolate,
|
|||
RegisterWithIsolate();
|
||||
}
|
||||
|
||||
void Metric::Init(const char* name, const char* description, Unit unit) {
|
||||
void Metric::InitInstance(const char* name,
|
||||
const char* description,
|
||||
Unit unit) {
|
||||
// Only called once.
|
||||
ASSERT(next_ == NULL);
|
||||
ASSERT(name != NULL);
|
||||
|
@ -306,9 +308,9 @@ int64_t MetricPeakRSS::Value() const {
|
|||
VM_METRIC_LIST(VM_METRIC_VARIABLE);
|
||||
#undef VM_METRIC_VARIABLE
|
||||
|
||||
void Metric::InitOnce() {
|
||||
void Metric::Init() {
|
||||
#define VM_METRIC_INIT(type, variable, name, unit) \
|
||||
vm_metric_##variable##_.Init(name, NULL, Metric::unit);
|
||||
vm_metric_##variable##_.InitInstance(name, NULL, Metric::unit);
|
||||
VM_METRIC_LIST(VM_METRIC_INIT);
|
||||
#undef VM_METRIC_INIT
|
||||
}
|
||||
|
|
|
@ -44,18 +44,18 @@ class Metric {
|
|||
|
||||
Metric();
|
||||
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
static void Cleanup();
|
||||
|
||||
// Initialize and register a metric for an isolate.
|
||||
void Init(Isolate* isolate,
|
||||
const char* name,
|
||||
const char* description,
|
||||
Unit unit);
|
||||
void InitInstance(Isolate* isolate,
|
||||
const char* name,
|
||||
const char* description,
|
||||
Unit unit);
|
||||
|
||||
// Initialize and register a metric for the VM.
|
||||
void Init(const char* name, const char* description, Unit unit);
|
||||
void InitInstance(const char* name, const char* description, Unit unit);
|
||||
|
||||
void CleanupInstance();
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ VM_UNIT_TEST_CASE(Metric_Simple) {
|
|||
Metric metric;
|
||||
|
||||
// Initialize metric.
|
||||
metric.Init(Isolate::Current(), "a.b.c", "foobar", Metric::kCounter);
|
||||
metric.InitInstance(Isolate::Current(), "a.b.c", "foobar",
|
||||
Metric::kCounter);
|
||||
EXPECT_EQ(0, metric.value());
|
||||
metric.increment();
|
||||
EXPECT_EQ(1, metric.value());
|
||||
|
@ -51,7 +52,7 @@ VM_UNIT_TEST_CASE(Metric_OnDemand) {
|
|||
HANDLESCOPE(thread);
|
||||
MyMetric metric;
|
||||
|
||||
metric.Init(Isolate::Current(), "a.b.c", "foobar", Metric::kByte);
|
||||
metric.InitInstance(Isolate::Current(), "a.b.c", "foobar", Metric::kByte);
|
||||
// value is still the default value.
|
||||
EXPECT_EQ(0, metric.value());
|
||||
// Call LeakyValue to confirm that Value returns constant 99.
|
||||
|
|
|
@ -14,8 +14,8 @@ class Mutex;
|
|||
|
||||
class NativeSymbolResolver : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void ShutdownOnce();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
static char* LookupSymbolName(uintptr_t pc, uintptr_t* start);
|
||||
static bool LookupSharedObject(uword pc, uword* dso_base, char** dso_name);
|
||||
static void FreeSymbolName(char* name);
|
||||
|
|
|
@ -27,9 +27,9 @@ extern "C" char* __cxa_demangle(const char* mangled_name,
|
|||
|
||||
namespace dart {
|
||||
|
||||
void NativeSymbolResolver::InitOnce() {}
|
||||
void NativeSymbolResolver::Init() {}
|
||||
|
||||
void NativeSymbolResolver::ShutdownOnce() {}
|
||||
void NativeSymbolResolver::Cleanup() {}
|
||||
|
||||
char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) {
|
||||
Dl_info info;
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
|
||||
namespace dart {
|
||||
|
||||
void NativeSymbolResolver::InitOnce() {}
|
||||
void NativeSymbolResolver::Init() {}
|
||||
|
||||
void NativeSymbolResolver::ShutdownOnce() {}
|
||||
void NativeSymbolResolver::Cleanup() {}
|
||||
|
||||
char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) {
|
||||
Dl_info info;
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
|
||||
namespace dart {
|
||||
|
||||
void NativeSymbolResolver::InitOnce() {}
|
||||
void NativeSymbolResolver::Init() {}
|
||||
|
||||
void NativeSymbolResolver::ShutdownOnce() {}
|
||||
void NativeSymbolResolver::Cleanup() {}
|
||||
|
||||
char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) {
|
||||
Dl_info info;
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
namespace dart {
|
||||
|
||||
void NativeSymbolResolver::InitOnce() {}
|
||||
void NativeSymbolResolver::Init() {}
|
||||
|
||||
void NativeSymbolResolver::ShutdownOnce() {}
|
||||
void NativeSymbolResolver::Cleanup() {}
|
||||
|
||||
char* NativeSymbolResolver::LookupSymbolName(uintptr_t pc, uintptr_t* start) {
|
||||
Dl_info info;
|
||||
|
|
|
@ -16,9 +16,11 @@ namespace dart {
|
|||
static bool running_ = false;
|
||||
static Mutex* lock_ = NULL;
|
||||
|
||||
void NativeSymbolResolver::InitOnce() {
|
||||
void NativeSymbolResolver::Init() {
|
||||
ASSERT(running_ == false);
|
||||
lock_ = new Mutex();
|
||||
if (lock_ == NULL) {
|
||||
lock_ = new Mutex();
|
||||
}
|
||||
running_ = true;
|
||||
SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS);
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
|
@ -29,7 +31,7 @@ void NativeSymbolResolver::InitOnce() {
|
|||
}
|
||||
}
|
||||
|
||||
void NativeSymbolResolver::ShutdownOnce() {
|
||||
void NativeSymbolResolver::Cleanup() {
|
||||
MutexLocker lock(lock_);
|
||||
if (!running_) {
|
||||
return;
|
||||
|
|
|
@ -456,7 +456,7 @@ void Object::InitNull(Isolate* isolate) {
|
|||
}
|
||||
}
|
||||
|
||||
void Object::InitOnce(Isolate* isolate) {
|
||||
void Object::Init(Isolate* isolate) {
|
||||
// Should only be run by the vm isolate.
|
||||
ASSERT(isolate == Dart::vm_isolate());
|
||||
|
||||
|
@ -937,7 +937,7 @@ void Object::InitOnce(Isolate* isolate) {
|
|||
ASSERT(extractor_parameter_names_->IsArray());
|
||||
}
|
||||
|
||||
void Object::FinishInitOnce(Isolate* isolate) {
|
||||
void Object::FinishInit(Isolate* isolate) {
|
||||
// The type testing stubs we initialize in AbstractType objects for the
|
||||
// canonical type of kDynamicCid/kVoidCid need to be set in this
|
||||
// method, which is called after StubCode::InitOnce().
|
||||
|
@ -15295,7 +15295,7 @@ bool ICData::IsUsedAt(intptr_t i) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
void ICData::InitOnce() {
|
||||
void ICData::Init() {
|
||||
for (int i = 0; i <= kCachedICDataMaxArgsTestedWithoutExactnessTracking;
|
||||
i++) {
|
||||
cached_icdata_arrays_
|
||||
|
@ -15306,6 +15306,12 @@ void ICData::InitOnce() {
|
|||
ICData::NewNonCachedEmptyICDataArray(1, true);
|
||||
}
|
||||
|
||||
void ICData::Cleanup() {
|
||||
for (int i = 0; i < kCachedICDataArrayCount; ++i) {
|
||||
cached_icdata_arrays_[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
RawArray* ICData::NewNonCachedEmptyICDataArray(intptr_t num_args_tested,
|
||||
bool tracking_exactness) {
|
||||
// IC data array must be null terminated (sentinel entry).
|
||||
|
|
|
@ -460,8 +460,8 @@ class Object {
|
|||
|
||||
// Initialize the VM isolate.
|
||||
static void InitNull(Isolate* isolate);
|
||||
static void InitOnce(Isolate* isolate);
|
||||
static void FinishInitOnce(Isolate* isolate);
|
||||
static void Init(Isolate* isolate);
|
||||
static void FinishInit(Isolate* isolate);
|
||||
static void FinalizeVMIsolate(Isolate* isolate);
|
||||
static void FinalizeReadOnlyObject(RawObject* object);
|
||||
|
||||
|
@ -2088,7 +2088,10 @@ class ICData : public Object {
|
|||
TokenPosition token_pos) const;
|
||||
|
||||
// Initialize the preallocated empty ICData entry arrays.
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
// Clear the preallocated empty ICData entry arrays.
|
||||
static void Cleanup();
|
||||
|
||||
// We cache ICData with 0, 1, 2 arguments tested without exactness
|
||||
// tracking and with 1 argument tested with exactness tracking.
|
||||
|
|
|
@ -118,10 +118,10 @@ class OS {
|
|||
static void RegisterCodeObservers();
|
||||
|
||||
// Initialize the OS class.
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
// Shut down the OS class.
|
||||
static void Shutdown();
|
||||
// Cleanup the OS class.
|
||||
static void Cleanup();
|
||||
|
||||
static DART_NORETURN void Abort();
|
||||
|
||||
|
|
|
@ -356,10 +356,9 @@ void OS::PrintErr(const char* format, ...) {
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
void OS::InitOnce() {
|
||||
}
|
||||
void OS::Init() {}
|
||||
|
||||
void OS::Shutdown() {}
|
||||
void OS::Cleanup() {}
|
||||
|
||||
void OS::Abort() {
|
||||
abort();
|
||||
|
|
|
@ -253,14 +253,14 @@ void OS::PrintErr(const char* format, ...) {
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
void OS::InitOnce() {
|
||||
void OS::Init() {
|
||||
auto environment_services = std::make_shared<component::Services>();
|
||||
auto env_service_root = component::subtle::CreateStaticServiceRootHandle();
|
||||
environment_services->Bind(std::move(env_service_root));
|
||||
environment_services->ConnectToService(tz.NewRequest());
|
||||
}
|
||||
|
||||
void OS::Shutdown() {}
|
||||
void OS::Cleanup() {}
|
||||
|
||||
void OS::Abort() {
|
||||
abort();
|
||||
|
|
|
@ -655,9 +655,9 @@ void OS::PrintErr(const char* format, ...) {
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
void OS::InitOnce() {}
|
||||
void OS::Init() {}
|
||||
|
||||
void OS::Shutdown() {}
|
||||
void OS::Cleanup() {}
|
||||
|
||||
void OS::Abort() {
|
||||
abort();
|
||||
|
|
|
@ -302,7 +302,7 @@ void OS::PrintErr(const char* format, ...) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void OS::InitOnce() {
|
||||
void OS::Init() {
|
||||
// See https://github.com/dart-lang/sdk/issues/29539
|
||||
// This is a workaround for a macos bug, we eagerly call localtime_r so that
|
||||
// libnotify is initialized early before any fork happens.
|
||||
|
@ -319,7 +319,7 @@ void OS::InitOnce() {
|
|||
}
|
||||
}
|
||||
|
||||
void OS::Shutdown() {}
|
||||
void OS::Cleanup() {}
|
||||
|
||||
void OS::Abort() {
|
||||
abort();
|
||||
|
|
|
@ -136,7 +136,7 @@ static void DeleteThread(void* thread) {
|
|||
delete reinterpret_cast<OSThread*>(thread);
|
||||
}
|
||||
|
||||
void OSThread::InitOnce() {
|
||||
void OSThread::Init() {
|
||||
// Allocate the global OSThread lock.
|
||||
if (thread_list_lock_ == NULL) {
|
||||
thread_list_lock_ = new Mutex();
|
||||
|
|
|
@ -204,7 +204,7 @@ class OSThread : public BaseThread {
|
|||
static ThreadJoinId GetCurrentThreadJoinId(OSThread* thread);
|
||||
|
||||
// Called at VM startup and shutdown.
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
static bool IsThreadInList(ThreadId id);
|
||||
|
||||
|
|
|
@ -604,7 +604,7 @@ void ThreadLocalData::RemoveThreadLocal(ThreadLocalKey key) {
|
|||
// This function is executed on the thread that is exiting. It is invoked
|
||||
// by |OnDartThreadExit| (see below for notes on TLS destructors on Windows).
|
||||
void ThreadLocalData::RunDestructors() {
|
||||
// If an OS thread is created but ThreadLocalData::InitOnce has not yet been
|
||||
// If an OS thread is created but ThreadLocalData::Init has not yet been
|
||||
// called, this method still runs. If this happens, there's nothing to clean
|
||||
// up here. See issue 33826.
|
||||
if (thread_locals_ == NULL) {
|
||||
|
@ -624,12 +624,12 @@ void ThreadLocalData::RunDestructors() {
|
|||
Mutex* ThreadLocalData::mutex_ = NULL;
|
||||
MallocGrowableArray<ThreadLocalEntry>* ThreadLocalData::thread_locals_ = NULL;
|
||||
|
||||
void ThreadLocalData::InitOnce() {
|
||||
void ThreadLocalData::Init() {
|
||||
mutex_ = new Mutex();
|
||||
thread_locals_ = new MallocGrowableArray<ThreadLocalEntry>();
|
||||
}
|
||||
|
||||
void ThreadLocalData::Shutdown() {
|
||||
void ThreadLocalData::Cleanup() {
|
||||
if (mutex_ != NULL) {
|
||||
delete mutex_;
|
||||
mutex_ = NULL;
|
||||
|
|
|
@ -147,8 +147,8 @@ class ThreadLocalData : public AllStatic {
|
|||
static Mutex* mutex_;
|
||||
static MallocGrowableArray<ThreadLocalEntry>* thread_locals_;
|
||||
|
||||
static void InitOnce();
|
||||
static void Shutdown();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
|
||||
friend class OS;
|
||||
friend class OSThread;
|
||||
|
|
|
@ -312,7 +312,7 @@ void OS::PrintErr(const char* format, ...) {
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
void OS::InitOnce() {
|
||||
void OS::Init() {
|
||||
static bool init_once_called = false;
|
||||
if (init_once_called) {
|
||||
return;
|
||||
|
@ -320,7 +320,7 @@ void OS::InitOnce() {
|
|||
init_once_called = true;
|
||||
// Do not pop up a message box when abort is called.
|
||||
_set_abort_behavior(0, _WRITE_ABORT_MSG);
|
||||
ThreadLocalData::InitOnce();
|
||||
ThreadLocalData::Init();
|
||||
MonitorWaitData::monitor_wait_data_key_ = OSThread::CreateThreadLocal();
|
||||
MonitorData::GetMonitorWaitDataForThread();
|
||||
LARGE_INTEGER ticks_per_sec;
|
||||
|
@ -331,9 +331,9 @@ void OS::InitOnce() {
|
|||
}
|
||||
}
|
||||
|
||||
void OS::Shutdown() {
|
||||
void OS::Cleanup() {
|
||||
// TODO(zra): Enable once VM can shutdown cleanly.
|
||||
// ThreadLocalData::Shutdown();
|
||||
// ThreadLocalData::Cleanup();
|
||||
}
|
||||
|
||||
void OS::Abort() {
|
||||
|
|
|
@ -276,7 +276,7 @@ Isolate* PortMap::GetIsolate(Dart_Port id) {
|
|||
return handler->isolate();
|
||||
}
|
||||
|
||||
void PortMap::InitOnce() {
|
||||
void PortMap::Init() {
|
||||
if (mutex_ == NULL) {
|
||||
mutex_ = new Mutex();
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class PortMap : public AllStatic {
|
|||
// Returns the owning Isolate for port 'id'.
|
||||
static Isolate* GetIsolate(Dart_Port id);
|
||||
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
|
||||
static void PrintPortsForMessageHandler(MessageHandler* handler,
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace dart {
|
|||
char* ProcCpuInfo::data_ = NULL;
|
||||
intptr_t ProcCpuInfo::datalen_ = 0;
|
||||
|
||||
void ProcCpuInfo::InitOnce() {
|
||||
void ProcCpuInfo::Init() {
|
||||
// Get the size of the cpuinfo file by reading it until the end. This is
|
||||
// required because files under /proc do not always return a valid size
|
||||
// when using fseek(0, SEEK_END) + ftell(). Nor can they be mmap()-ed.
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace dart {
|
|||
|
||||
class ProcCpuInfo : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
static bool FieldContains(const char* field, const char* search_string);
|
||||
static const char* ExtractField(const char* field);
|
||||
|
|
|
@ -63,11 +63,11 @@ SampleBuffer* Profiler::sample_buffer_ = NULL;
|
|||
AllocationSampleBuffer* Profiler::allocation_sample_buffer_ = NULL;
|
||||
ProfilerCounters Profiler::counters_;
|
||||
|
||||
void Profiler::InitOnce() {
|
||||
void Profiler::Init() {
|
||||
// Place some sane restrictions on user controlled flags.
|
||||
SetSamplePeriod(FLAG_profile_period);
|
||||
SetSampleDepth(FLAG_max_profile_depth);
|
||||
Sample::InitOnce();
|
||||
Sample::Init();
|
||||
if (!FLAG_profiler) {
|
||||
return;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ void Profiler::InitOnce() {
|
|||
Profiler::InitAllocationSampleBuffer();
|
||||
// Zero counters.
|
||||
memset(&counters_, 0, sizeof(counters_));
|
||||
ThreadInterrupter::InitOnce();
|
||||
ThreadInterrupter::Init();
|
||||
ThreadInterrupter::SetInterruptPeriod(FLAG_profile_period);
|
||||
ThreadInterrupter::Startup();
|
||||
initialized_ = true;
|
||||
|
@ -89,12 +89,12 @@ void Profiler::InitAllocationSampleBuffer() {
|
|||
}
|
||||
}
|
||||
|
||||
void Profiler::Shutdown() {
|
||||
void Profiler::Cleanup() {
|
||||
if (!FLAG_profiler) {
|
||||
return;
|
||||
}
|
||||
ASSERT(initialized_);
|
||||
ThreadInterrupter::Shutdown();
|
||||
ThreadInterrupter::Cleanup();
|
||||
#if defined(HOST_OS_LINUX) || defined(HOST_OS_MACOS) || defined(HOST_OS_ANDROID)
|
||||
// TODO(30309): Free the sample buffer on platforms that use a signal-based
|
||||
// thread interrupter.
|
||||
|
@ -128,7 +128,7 @@ void Profiler::SetSamplePeriod(intptr_t period) {
|
|||
intptr_t Sample::pcs_length_ = 0;
|
||||
intptr_t Sample::instance_size_ = 0;
|
||||
|
||||
void Sample::InitOnce() {
|
||||
void Sample::Init() {
|
||||
pcs_length_ = kSampleSize;
|
||||
instance_size_ = sizeof(Sample) + (sizeof(uword) * pcs_length_); // NOLINT.
|
||||
}
|
||||
|
|
|
@ -50,9 +50,9 @@ struct ProfilerCounters {
|
|||
|
||||
class Profiler : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
static void InitAllocationSampleBuffer();
|
||||
static void Shutdown();
|
||||
static void Cleanup();
|
||||
|
||||
static void SetSampleDepth(intptr_t depth);
|
||||
static void SetSamplePeriod(intptr_t period);
|
||||
|
@ -353,7 +353,7 @@ class Sample {
|
|||
set_metadata(cid);
|
||||
}
|
||||
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
static intptr_t instance_size() { return instance_size_; }
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ class AllocationFilter : public SampleFilter {
|
|||
static void EnableProfiler() {
|
||||
if (!FLAG_profiler) {
|
||||
FLAG_profiler = true;
|
||||
Profiler::InitOnce();
|
||||
Profiler::Init();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -896,7 +896,7 @@ void Scanner::ScanTo(intptr_t token_index) {
|
|||
} while ((token_index >= index) && (current_token_.kind != Token::kEOS));
|
||||
}
|
||||
|
||||
void Scanner::InitOnce() {
|
||||
void Scanner::Init() {
|
||||
ASSERT(Isolate::Current() == Dart::vm_isolate());
|
||||
for (int i = 0; i < kNumLowercaseChars; i++) {
|
||||
keywords_char_offset_[i] = Token::kNumKeywords;
|
||||
|
|
|
@ -79,7 +79,7 @@ class Scanner : ValueObject {
|
|||
return current_token_.position;
|
||||
}
|
||||
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
// Return true if str is an identifier.
|
||||
bool IsIdent(const String& str);
|
||||
|
|
|
@ -3761,7 +3761,7 @@ static const MethodParameter* enable_profiler_params[] = {
|
|||
static bool EnableProfiler(Thread* thread, JSONStream* js) {
|
||||
if (!FLAG_profiler) {
|
||||
FLAG_profiler = true;
|
||||
Profiler::InitOnce();
|
||||
Profiler::Init();
|
||||
}
|
||||
PrintSuccess(js);
|
||||
return true;
|
||||
|
|
|
@ -795,7 +795,7 @@ ISOLATE_UNIT_TEST_CASE(Service_EmbedderIsolateHandler) {
|
|||
static void EnableProfiler() {
|
||||
if (!FLAG_profiler) {
|
||||
FLAG_profiler = true;
|
||||
Profiler::InitOnce();
|
||||
Profiler::Init();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -659,8 +659,7 @@ char* SimulatorDebugger::ReadLine(const char* prompt) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void Simulator::InitOnce() {
|
||||
}
|
||||
void Simulator::Init() {}
|
||||
|
||||
Simulator::Simulator() : exclusive_access_addr_(0), exclusive_access_value_(0) {
|
||||
// Setup simulator support first. Some of this information is needed to
|
||||
|
|
|
@ -86,7 +86,7 @@ class Simulator {
|
|||
uint64_t get_icount() const { return icount_; }
|
||||
|
||||
// Call on program start.
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
// Dart generally calls into generated code with 4 parameters. This is a
|
||||
// convenience function, which sets up the simulator state and grabs the
|
||||
|
|
|
@ -709,8 +709,7 @@ char* SimulatorDebugger::ReadLine(const char* prompt) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void Simulator::InitOnce() {
|
||||
}
|
||||
void Simulator::Init() {}
|
||||
|
||||
Simulator::Simulator() : exclusive_access_addr_(0), exclusive_access_value_(0) {
|
||||
// Setup simulator support first. Some of this information is needed to
|
||||
|
|
|
@ -82,7 +82,7 @@ class Simulator {
|
|||
uint64_t get_icount() const { return icount_; }
|
||||
|
||||
// Call on program start.
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
// Dart generally calls into generated code with 4 parameters. This is a
|
||||
// convenience function, which sets up the simulator state and grabs the
|
||||
|
|
|
@ -507,7 +507,7 @@ DART_FORCE_INLINE static RawFunction* FrameFunction(RawObject** FP) {
|
|||
IntrinsicHandler Simulator::intrinsics_[Simulator::kIntrinsicCount];
|
||||
|
||||
// Synchronization primitives support.
|
||||
void Simulator::InitOnce() {
|
||||
void Simulator::Init() {
|
||||
for (intptr_t i = 0; i < kIntrinsicCount; i++) {
|
||||
intrinsics_[i] = 0;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class Simulator {
|
|||
uword stack_limit() const { return stack_limit_; }
|
||||
|
||||
// Call on program start.
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
RawObject* Call(const Code& code,
|
||||
const Array& arguments_descriptor,
|
||||
|
|
|
@ -60,7 +60,7 @@ int FrameLayout::FrameSlotForVariableIndex(int variable_index) const {
|
|||
: (variable_index + param_end_from_fp);
|
||||
}
|
||||
|
||||
void FrameLayout::InitOnce() {
|
||||
void FrameLayout::Init() {
|
||||
compiler_frame_layout = default_frame_layout;
|
||||
runtime_frame_layout = default_frame_layout;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ struct FrameLayout {
|
|||
}
|
||||
|
||||
// Called to initialize the stack frame layout during startup.
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
};
|
||||
|
||||
extern FrameLayout compiler_frame_layout;
|
||||
|
|
|
@ -43,7 +43,7 @@ void StubEntry::VisitObjectPointers(ObjectPointerVisitor* visitor) {
|
|||
}
|
||||
|
||||
#if defined(DART_PRECOMPILED_RUNTIME)
|
||||
void StubCode::InitOnce() {
|
||||
void StubCode::Init() {
|
||||
// Stubs will be loaded from the snapshot.
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ void StubCode::Cleanup() {
|
|||
code ^= Generate("_stub_" #name, StubCode::Generate##name##Stub); \
|
||||
entries_[k##name##Index] = new StubEntry(code);
|
||||
|
||||
void StubCode::InitOnce() {
|
||||
void StubCode::Init() {
|
||||
// Generate all the stubs.
|
||||
Code& code = Code::Handle();
|
||||
VM_STUB_CODE_LIST(STUB_CODE_GENERATE);
|
||||
|
|
|
@ -148,7 +148,7 @@ class StubCode : public AllStatic {
|
|||
public:
|
||||
// Generate all stubs which are shared across all isolates, this is done
|
||||
// only once and the stub code resides in the vm_isolate heap.
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
static void Cleanup();
|
||||
static void VisitObjectPointers(ObjectPointerVisitor* visitor);
|
||||
|
|
|
@ -204,7 +204,7 @@ const String& Symbols::Token(Token::Kind token) {
|
|||
return *symbol_handles_[token_id];
|
||||
}
|
||||
|
||||
void Symbols::InitOnce(Isolate* vm_isolate) {
|
||||
void Symbols::Init(Isolate* vm_isolate) {
|
||||
// Should only be run by the vm isolate.
|
||||
ASSERT(Isolate::Current() == Dart::vm_isolate());
|
||||
ASSERT(vm_isolate == Dart::vm_isolate());
|
||||
|
@ -250,7 +250,7 @@ void Symbols::InitOnce(Isolate* vm_isolate) {
|
|||
vm_isolate->object_store()->set_symbol_table(table.Release());
|
||||
}
|
||||
|
||||
void Symbols::InitOnceFromSnapshot(Isolate* vm_isolate) {
|
||||
void Symbols::InitFromSnapshot(Isolate* vm_isolate) {
|
||||
// Should only be run by the vm isolate.
|
||||
ASSERT(Isolate::Current() == Dart::vm_isolate());
|
||||
ASSERT(vm_isolate == Dart::vm_isolate());
|
||||
|
|
|
@ -607,8 +607,8 @@ class Symbols : public AllStatic {
|
|||
static const String& Token(Token::Kind token);
|
||||
|
||||
// Initialize frequently used symbols in the vm isolate.
|
||||
static void InitOnce(Isolate* isolate);
|
||||
static void InitOnceFromSnapshot(Isolate* isolate);
|
||||
static void Init(Isolate* isolate);
|
||||
static void InitFromSnapshot(Isolate* isolate);
|
||||
|
||||
// Initialize and setup a symbol table for the isolate.
|
||||
static void SetupSymbolTable(Isolate* isolate);
|
||||
|
|
|
@ -59,11 +59,14 @@ Monitor* ThreadInterrupter::monitor_ = NULL;
|
|||
intptr_t ThreadInterrupter::interrupt_period_ = 1000;
|
||||
intptr_t ThreadInterrupter::current_wait_time_ = Monitor::kNoTimeout;
|
||||
|
||||
void ThreadInterrupter::InitOnce() {
|
||||
void ThreadInterrupter::Init() {
|
||||
ASSERT(!initialized_);
|
||||
monitor_ = new Monitor();
|
||||
if (monitor_ == NULL) {
|
||||
monitor_ = new Monitor();
|
||||
}
|
||||
ASSERT(monitor_ != NULL);
|
||||
initialized_ = true;
|
||||
shutdown_ = false;
|
||||
}
|
||||
|
||||
void ThreadInterrupter::Startup() {
|
||||
|
@ -94,7 +97,7 @@ void ThreadInterrupter::Startup() {
|
|||
}
|
||||
}
|
||||
|
||||
void ThreadInterrupter::Shutdown() {
|
||||
void ThreadInterrupter::Cleanup() {
|
||||
{
|
||||
MonitorLocker shutdown_ml(monitor_);
|
||||
if (shutdown_) {
|
||||
|
@ -114,6 +117,7 @@ void ThreadInterrupter::Shutdown() {
|
|||
ASSERT(interrupter_thread_id_ != OSThread::kInvalidThreadJoinId);
|
||||
OSThread::Join(interrupter_thread_id_);
|
||||
interrupter_thread_id_ = OSThread::kInvalidThreadJoinId;
|
||||
initialized_ = false;
|
||||
|
||||
if (FLAG_trace_thread_interrupter) {
|
||||
OS::PrintErr("ThreadInterrupter shut down.\n");
|
||||
|
|
|
@ -22,10 +22,10 @@ struct InterruptedThreadState {
|
|||
|
||||
class ThreadInterrupter : public AllStatic {
|
||||
public:
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
static void Startup();
|
||||
static void Shutdown();
|
||||
static void Cleanup();
|
||||
|
||||
// Delay between interrupts.
|
||||
static void SetInterruptPeriod(intptr_t period);
|
||||
|
|
|
@ -199,7 +199,7 @@ static bool HasStream(MallocGrowableArray<char*>* streams, const char* stream) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void Timeline::InitOnce() {
|
||||
void Timeline::Init() {
|
||||
ASSERT(recorder_ == NULL);
|
||||
recorder_ = CreateTimelineRecorder();
|
||||
ASSERT(recorder_ != NULL);
|
||||
|
@ -231,7 +231,7 @@ void Timeline::StreamStateChange(const char* stream_name,
|
|||
}
|
||||
}
|
||||
|
||||
void Timeline::Shutdown() {
|
||||
void Timeline::Cleanup() {
|
||||
ASSERT(recorder_ != NULL);
|
||||
|
||||
if (Timeline::stream_Embedder_.enabled() &&
|
||||
|
|
|
@ -76,10 +76,10 @@ class TimelineStream {
|
|||
class Timeline : public AllStatic {
|
||||
public:
|
||||
// Initialize timeline system. Not thread safe.
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
// Shutdown timeline system. Not thread safe.
|
||||
static void Shutdown();
|
||||
// Cleanup timeline system. Not thread safe.
|
||||
static void Cleanup();
|
||||
|
||||
// Access the global recorder. Not thread safe.
|
||||
static TimelineEventRecorder* recorder();
|
||||
|
|
|
@ -29,7 +29,7 @@ class VirtualMemory {
|
|||
void* address() const { return region_.pointer(); }
|
||||
intptr_t size() const { return region_.size(); }
|
||||
|
||||
static void InitOnce();
|
||||
static void Init();
|
||||
|
||||
bool Contains(uword addr) const { return region_.Contains(addr); }
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace dart {
|
|||
|
||||
uword VirtualMemory::page_size_ = 0;
|
||||
|
||||
void VirtualMemory::InitOnce() {
|
||||
void VirtualMemory::Init() {
|
||||
page_size_ = getpagesize();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace dart {
|
|||
|
||||
uword VirtualMemory::page_size_ = 0;
|
||||
|
||||
void VirtualMemory::InitOnce() {
|
||||
void VirtualMemory::Init() {
|
||||
page_size_ = getpagesize();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace dart {
|
|||
|
||||
uword VirtualMemory::page_size_ = 0;
|
||||
|
||||
void VirtualMemory::InitOnce() {
|
||||
void VirtualMemory::Init() {
|
||||
page_size_ = getpagesize();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace dart {
|
|||
|
||||
uword VirtualMemory::page_size_ = 0;
|
||||
|
||||
void VirtualMemory::InitOnce() {
|
||||
void VirtualMemory::Init() {
|
||||
page_size_ = getpagesize();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace dart {
|
|||
|
||||
uword VirtualMemory::page_size_ = 0;
|
||||
|
||||
void VirtualMemory::InitOnce() {
|
||||
void VirtualMemory::Init() {
|
||||
SYSTEM_INFO info;
|
||||
GetSystemInfo(&info);
|
||||
page_size_ = info.dwPageSize;
|
||||
|
|
Loading…
Reference in a new issue