Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Unified Diff: runtime/vm/isolate_reload.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/isolate_reload.h ('k') | runtime/vm/isolate_reload_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate_reload.cc
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index 76882ec991a6018831d7ece9a27b9375b4425567..5537b5adc9e0e7288d1bf456c9859f8ef52a10fa 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -6,7 +6,6 @@
#include "vm/become.h"
#include "vm/bit_vector.h"
-#include "vm/runtime_entry.h"
#include "vm/compiler.h"
#include "vm/dart_api_impl.h"
#include "vm/hash_table.h"
@@ -15,6 +14,7 @@
#include "vm/object.h"
#include "vm/object_store.h"
#include "vm/parser.h"
+#include "vm/runtime_entry.h"
#include "vm/safepoint.h"
#include "vm/service_event.h"
#include "vm/stack_frame.h"
@@ -53,7 +53,6 @@ DEFINE_FLAG(bool,
TimelineDurationScope tds##name(Thread::Current(), \
Timeline::GetIsolateStream(), #name)
-
InstanceMorpher::InstanceMorpher(Zone* zone, const Class& from, const Class& to)
: from_(Class::Handle(zone, from.raw())),
to_(Class::Handle(zone, to.raw())),
@@ -66,14 +65,12 @@ InstanceMorpher::InstanceMorpher(Zone* zone, const Class& from, const Class& to)
ComputeMapping();
}
-
void InstanceMorpher::AddObject(RawObject* object) const {
ASSERT(object->GetClassId() == cid());
const Instance& instance = Instance::Cast(Object::Handle(object));
before_->Add(&instance);
}
-
void InstanceMorpher::ComputeMapping() {
if (from_.NumTypeArguments()) {
// Add copying of the optional type argument field.
@@ -136,7 +133,6 @@ void InstanceMorpher::ComputeMapping() {
}
}
-
RawInstance* InstanceMorpher::Morph(const Instance& instance) const {
const Instance& result = Instance::Handle(Instance::New(to_));
// Morph the context from instance to result using mapping_.
@@ -152,7 +148,6 @@ RawInstance* InstanceMorpher::Morph(const Instance& instance) const {
return result.raw();
}
-
void InstanceMorpher::RunNewFieldInitializers() const {
if ((new_fields_->length() == 0) || (after_->length() == 0)) {
return;
@@ -194,7 +189,6 @@ void InstanceMorpher::RunNewFieldInitializers() const {
}
}
-
void InstanceMorpher::CreateMorphedCopies() const {
for (intptr_t i = 0; i < before()->length(); i++) {
const Instance& copy = Instance::Handle(Morph(*before()->At(i)));
@@ -202,7 +196,6 @@ void InstanceMorpher::CreateMorphedCopies() const {
}
}
-
void InstanceMorpher::DumpFormatFor(const Class& cls) const {
THR_Print("%s\n", cls.ToCString());
if (cls.NumTypeArguments()) {
@@ -229,7 +222,6 @@ void InstanceMorpher::DumpFormatFor(const Class& cls) const {
THR_Print("\n");
}
-
void InstanceMorpher::Dump() const {
LogBlock blocker;
THR_Print("Morphing from ");
@@ -239,7 +231,6 @@ void InstanceMorpher::Dump() const {
THR_Print("\n");
}
-
void InstanceMorpher::AppendTo(JSONArray* array) {
JSONObject jsobj(array);
jsobj.AddProperty("type", "ShapeChangeMapping");
@@ -253,26 +244,22 @@ void InstanceMorpher::AppendTo(JSONArray* array) {
}
}
-
void ReasonForCancelling::Report(IsolateReloadContext* context) {
const Error& error = Error::Handle(ToError());
context->ReportError(error);
}
-
RawError* ReasonForCancelling::ToError() {
// By default create the error returned from ToString.
const String& message = String::Handle(ToString());
return LanguageError::New(message);
}
-
RawString* ReasonForCancelling::ToString() {
UNREACHABLE();
return NULL;
}
-
void ReasonForCancelling::AppendTo(JSONArray* array) {
JSONObject jsobj(array);
jsobj.AddProperty("type", "ReasonForCancelling");
@@ -280,7 +267,6 @@ void ReasonForCancelling::AppendTo(JSONArray* array) {
jsobj.AddProperty("message", message.ToCString());
}
-
ClassReasonForCancelling::ClassReasonForCancelling(Zone* zone,
const Class& from,
const Class& to)
@@ -288,7 +274,6 @@ ClassReasonForCancelling::ClassReasonForCancelling(Zone* zone,
from_(Class::ZoneHandle(zone, from.raw())),
to_(Class::ZoneHandle(zone, to.raw())) {}
-
void ClassReasonForCancelling::AppendTo(JSONArray* array) {
JSONObject jsobj(array);
jsobj.AddProperty("type", "ReasonForCancelling");
@@ -297,14 +282,12 @@ void ClassReasonForCancelling::AppendTo(JSONArray* array) {
jsobj.AddProperty("message", message.ToCString());
}
-
RawError* IsolateReloadContext::error() const {
ASSERT(reload_aborted());
// Report the first error to the surroundings.
return reasons_to_cancel_reload_.At(0)->ToError();
}
-
class ScriptUrlSetTraits {
public:
static bool ReportStats() { return false; }
@@ -321,7 +304,6 @@ class ScriptUrlSetTraits {
static uword Hash(const Object& obj) { return String::Cast(obj).Hash(); }
};
-
class ClassMapTraits {
public:
static bool ReportStats() { return false; }
@@ -339,7 +321,6 @@ class ClassMapTraits {
}
};
-
class LibraryMapTraits {
public:
static bool ReportStats() { return false; }
@@ -356,7 +337,6 @@ class LibraryMapTraits {
static uword Hash(const Object& obj) { return Library::Cast(obj).UrlHash(); }
};
-
class BecomeMapTraits {
public:
static bool ReportStats() { return false; }
@@ -383,7 +363,6 @@ class BecomeMapTraits {
}
};
-
bool IsolateReloadContext::IsSameField(const Field& a, const Field& b) {
if (a.is_static() != b.is_static()) {
return false;
@@ -401,7 +380,6 @@ bool IsolateReloadContext::IsSameField(const Field& a, const Field& b) {
return a_name.Equals(b_name);
}
-
bool IsolateReloadContext::IsSameClass(const Class& a, const Class& b) {
if (a.is_patch() != b.is_patch()) {
// TODO(johnmccutchan): Should we just check the class kind bits?
@@ -427,7 +405,6 @@ bool IsolateReloadContext::IsSameClass(const Class& a, const Class& b) {
return (a_lib.private_key() == b_lib.private_key());
}
-
bool IsolateReloadContext::IsSameLibrary(const Library& a_lib,
const Library& b_lib) {
const String& a_lib_url =
@@ -437,7 +414,6 @@ bool IsolateReloadContext::IsSameLibrary(const Library& a_lib,
return a_lib_url.Equals(b_lib_url);
}
-
IsolateReloadContext::IsolateReloadContext(Isolate* isolate, JSONStream* js)
: zone_(Thread::Current()->zone()),
start_time_micros_(OS::GetCurrentMonotonicMicros()),
@@ -472,12 +448,10 @@ IsolateReloadContext::IsolateReloadContext(Isolate* isolate, JSONStream* js)
ASSERT(zone_ != NULL);
}
-
IsolateReloadContext::~IsolateReloadContext() {
ASSERT(saved_class_table_ == NULL);
}
-
void IsolateReloadContext::ReportError(const Error& error) {
if (FLAG_trace_reload) {
THR_Print("ISO-RELOAD: Error: %s\n", error.ToErrorCString());
@@ -487,13 +461,11 @@ void IsolateReloadContext::ReportError(const Error& error) {
Service::HandleEvent(&service_event);
}
-
void IsolateReloadContext::ReportSuccess() {
ServiceEvent service_event(I, ServiceEvent::kIsolateReload);
Service::HandleEvent(&service_event);
}
-
class Aborted : public ReasonForCancelling {
public:
Aborted(Zone* zone, const Error& error)
@@ -509,7 +481,6 @@ class Aborted : public ReasonForCancelling {
}
};
-
static intptr_t CommonSuffixLength(const char* a, const char* b) {
const intptr_t a_length = strlen(a);
const intptr_t b_length = strlen(b);
@@ -528,7 +499,6 @@ static intptr_t CommonSuffixLength(const char* a, const char* b) {
return (a_length - a_cursor);
}
-
// NOTE: This function returns *after* FinalizeLoading is called.
void IsolateReloadContext::Reload(bool force_reload,
const char* root_script_url,
@@ -660,7 +630,6 @@ void IsolateReloadContext::Reload(bool force_reload,
}
}
-
void IsolateReloadContext::RegisterClass(const Class& new_cls) {
const Class& old_cls = Class::Handle(OldClassOrNull(new_cls));
if (old_cls.IsNull()) {
@@ -687,7 +656,6 @@ void IsolateReloadContext::RegisterClass(const Class& new_cls) {
AddClassMapping(new_cls, old_cls);
}
-
// FinalizeLoading will be called *before* Reload() returns but will not be
// called if the embedder fails to load sources.
void IsolateReloadContext::FinalizeLoading() {
@@ -712,7 +680,6 @@ void IsolateReloadContext::FinalizeLoading() {
CommonFinalizeTail();
}
-
// FinalizeFailedLoad will be called *before* Reload() returns and will only
// be called if the embedder fails to load sources.
void IsolateReloadContext::FinalizeFailedLoad(const Error& error) {
@@ -725,13 +692,11 @@ void IsolateReloadContext::FinalizeFailedLoad(const Error& error) {
CommonFinalizeTail();
}
-
void IsolateReloadContext::CommonFinalizeTail() {
ReportOnJSON(js_);
reload_finalized_ = true;
}
-
void IsolateReloadContext::ReportOnJSON(JSONStream* stream) {
JSONObject jsobj(stream);
jsobj.AddProperty("type", "ReloadReport");
@@ -771,7 +736,6 @@ void IsolateReloadContext::ReportOnJSON(JSONStream* stream) {
}
}
-
void IsolateReloadContext::EnsuredUnoptimizedCodeForStack() {
TIMELINE_SCOPE(EnsuredUnoptimizedCodeForStack);
StackFrameIterator it(StackFrameIterator::kDontValidateFrames,
@@ -789,7 +753,6 @@ void IsolateReloadContext::EnsuredUnoptimizedCodeForStack() {
}
}
-
void IsolateReloadContext::DeoptimizeDependentCode() {
TIMELINE_SCOPE(DeoptimizeDependentCode);
ClassTable* class_table = I->class_table();
@@ -824,7 +787,6 @@ void IsolateReloadContext::DeoptimizeDependentCode() {
// TODO(johnmccutchan): Also call LibraryPrefix::InvalidateDependentCode.
}
-
void IsolateReloadContext::CheckpointClasses() {
TIMELINE_SCOPE(CheckpointClasses);
TIR_Print("---- CHECKPOINTING CLASSES\n");
@@ -865,10 +827,8 @@ void IsolateReloadContext::CheckpointClasses() {
TIR_Print("---- System had %" Pd " classes\n", saved_num_cids_);
}
-
Dart_FileModifiedCallback IsolateReloadContext::file_modified_callback_ = NULL;
-
bool IsolateReloadContext::ScriptModifiedSince(const Script& script,
int64_t since) {
if (file_modified_callback_ == NULL) {
@@ -880,7 +840,6 @@ bool IsolateReloadContext::ScriptModifiedSince(const Script& script,
return (*file_modified_callback_)(url_chars, since);
}
-
static void PropagateLibraryModified(
const ZoneGrowableArray<ZoneGrowableArray<intptr_t>*>* imported_by,
intptr_t lib_index,
@@ -895,7 +854,6 @@ static void PropagateLibraryModified(
}
}
-
BitVector* IsolateReloadContext::FindModifiedLibraries(bool force_reload) {
Thread* thread = Thread::Current();
int64_t last_reload = I->last_reload_timestamp();
@@ -991,7 +949,6 @@ BitVector* IsolateReloadContext::FindModifiedLibraries(bool force_reload) {
return modified_libs;
}
-
void IsolateReloadContext::CheckpointLibraries() {
TIMELINE_SCOPE(CheckpointLibraries);
TIR_Print("---- CHECKPOINTING LIBRARIES\n");
@@ -1036,7 +993,6 @@ void IsolateReloadContext::CheckpointLibraries() {
object_store()->set_root_library(Library::Handle());
}
-
// While reloading everything we do must be reversible so that we can abort
// safely if the reload fails. This function stashes things to the side and
// prepares the isolate for the reload attempt.
@@ -1046,7 +1002,6 @@ void IsolateReloadContext::Checkpoint() {
CheckpointLibraries();
}
-
void IsolateReloadContext::RollbackClasses() {
TIR_Print("---- ROLLING BACK CLASS TABLE\n");
ASSERT(saved_num_cids_ > 0);
@@ -1068,7 +1023,6 @@ void IsolateReloadContext::RollbackClasses() {
class_table->AddOldTable(local_saved_class_table);
}
-
void IsolateReloadContext::RollbackLibraries() {
TIR_Print("---- ROLLING BACK LIBRARY CHANGES\n");
Thread* thread = Thread::Current();
@@ -1095,14 +1049,12 @@ void IsolateReloadContext::RollbackLibraries() {
set_saved_libraries(GrowableObjectArray::Handle());
}
-
void IsolateReloadContext::Rollback() {
TIR_Print("---- ROLLING BACK");
RollbackClasses();
RollbackLibraries();
}
-
#ifdef DEBUG
void IsolateReloadContext::VerifyMaps() {
TIMELINE_SCOPE(VerifyMaps);
@@ -1139,7 +1091,6 @@ void IsolateReloadContext::VerifyMaps() {
}
#endif
-
void IsolateReloadContext::Commit() {
TIMELINE_SCOPE(Commit);
TIR_Print("---- COMMITTING RELOAD\n");
@@ -1307,7 +1258,6 @@ void IsolateReloadContext::Commit() {
#endif // DEBUG
}
-
void IsolateReloadContext::RehashConstants() {
TIMELINE_SCOPE(RehashConstants);
ClassTable* class_table = I->class_table();
@@ -1329,7 +1279,6 @@ void IsolateReloadContext::RehashConstants() {
}
}
-
bool IsolateReloadContext::IsDirty(const Library& lib) {
const intptr_t index = lib.index();
if (index == static_cast<classid_t>(-1)) {
@@ -1340,7 +1289,6 @@ bool IsolateReloadContext::IsDirty(const Library& lib) {
return library_infos_[index].dirty;
}
-
void IsolateReloadContext::PostCommit() {
TIMELINE_SCOPE(PostCommit);
set_saved_root_library(Library::Handle());
@@ -1349,19 +1297,16 @@ void IsolateReloadContext::PostCommit() {
TIR_Print("---- DONE COMMIT\n");
}
-
void IsolateReloadContext::AddReasonForCancelling(ReasonForCancelling* reason) {
reload_aborted_ = true;
reasons_to_cancel_reload_.Add(reason);
}
-
void IsolateReloadContext::AddInstanceMorpher(InstanceMorpher* morpher) {
instance_morphers_.Add(morpher);
cid_mapper_.Insert(morpher);
}
-
void IsolateReloadContext::ReportReasonsForCancelling() {
ASSERT(FLAG_reload_force_rollback || HasReasonsForCancelling());
for (int i = 0; i < reasons_to_cancel_reload_.length(); i++) {
@@ -1369,7 +1314,6 @@ void IsolateReloadContext::ReportReasonsForCancelling() {
}
}
-
// The ObjectLocator is used for collecting instances that
// needs to be morphed.
class ObjectLocator : public ObjectVisitor {
@@ -1394,7 +1338,6 @@ class ObjectLocator : public ObjectVisitor {
intptr_t count_;
};
-
void IsolateReloadContext::MorphInstances() {
TIMELINE_SCOPE(MorphInstances);
ASSERT(HasInstanceMorphers());
@@ -1448,7 +1391,6 @@ void IsolateReloadContext::MorphInstances() {
Become::ElementsForwardIdentity(before, after);
}
-
void IsolateReloadContext::RunNewFieldInitializers() {
// Run new field initializers on all instances.
for (intptr_t i = 0; i < instance_morphers_.length(); i++) {
@@ -1456,7 +1398,6 @@ void IsolateReloadContext::RunNewFieldInitializers() {
}
}
-
bool IsolateReloadContext::ValidateReload() {
TIMELINE_SCOPE(ValidateReload);
if (reload_aborted()) return false;
@@ -1502,12 +1443,10 @@ bool IsolateReloadContext::ValidateReload() {
return !FLAG_reload_force_rollback && !HasReasonsForCancelling();
}
-
RawClass* IsolateReloadContext::FindOriginalClass(const Class& cls) {
return MappedClass(cls);
}
-
RawClass* IsolateReloadContext::GetClassForHeapWalkAt(intptr_t cid) {
RawClass** class_table = AtomicOperations::LoadRelaxed(&saved_class_table_);
if (class_table != NULL) {
@@ -1519,28 +1458,23 @@ RawClass* IsolateReloadContext::GetClassForHeapWalkAt(intptr_t cid) {
}
}
-
RawLibrary* IsolateReloadContext::saved_root_library() const {
return saved_root_library_;
}
-
void IsolateReloadContext::set_saved_root_library(const Library& value) {
saved_root_library_ = value.raw();
}
-
RawGrowableObjectArray* IsolateReloadContext::saved_libraries() const {
return saved_libraries_;
}
-
void IsolateReloadContext::set_saved_libraries(
const GrowableObjectArray& value) {
saved_libraries_ = value.raw();
}
-
void IsolateReloadContext::VisitObjectPointers(ObjectPointerVisitor* visitor) {
visitor->VisitPointers(from(), to());
if (saved_class_table_ != NULL) {
@@ -1549,12 +1483,10 @@ void IsolateReloadContext::VisitObjectPointers(ObjectPointerVisitor* visitor) {
}
}
-
ObjectStore* IsolateReloadContext::object_store() {
return isolate_->object_store();
}
-
void IsolateReloadContext::ResetUnoptimizedICsOnStack() {
Thread* thread = Thread::Current();
StackZone stack_zone(thread);
@@ -1582,7 +1514,6 @@ void IsolateReloadContext::ResetUnoptimizedICsOnStack() {
}
}
-
void IsolateReloadContext::ResetMegamorphicCaches() {
object_store()->set_megamorphic_cache_table(GrowableObjectArray::Handle());
// Since any current optimized code will not make any more calls, it may be
@@ -1591,7 +1522,6 @@ void IsolateReloadContext::ResetMegamorphicCaches() {
// new ones.
}
-
class MarkFunctionsForRecompilation : public ObjectVisitor {
public:
MarkFunctionsForRecompilation(Isolate* isolate,
@@ -1676,7 +1606,6 @@ class MarkFunctionsForRecompilation : public ObjectVisitor {
Zone* zone_;
};
-
void IsolateReloadContext::MarkAllFunctionsForRecompilation() {
TIMELINE_SCOPE(MarkAllFunctionsForRecompilation);
TIR_Print("---- MARKING ALL FUNCTIONS FOR RECOMPILATION\n");
@@ -1689,7 +1618,6 @@ void IsolateReloadContext::MarkAllFunctionsForRecompilation() {
isolate_->heap()->VisitObjects(&visitor);
}
-
void IsolateReloadContext::InvalidateWorld() {
TIR_Print("---- INVALIDATING WORLD\n");
ResetMegamorphicCaches();
@@ -1698,7 +1626,6 @@ void IsolateReloadContext::InvalidateWorld() {
MarkAllFunctionsForRecompilation();
}
-
RawClass* IsolateReloadContext::MappedClass(const Class& replacement_or_new) {
UnorderedHashMap<ClassMapTraits> map(class_map_storage_);
Class& cls = Class::Handle();
@@ -1708,13 +1635,11 @@ RawClass* IsolateReloadContext::MappedClass(const Class& replacement_or_new) {
return cls.raw();
}
-
RawLibrary* IsolateReloadContext::MappedLibrary(
const Library& replacement_or_new) {
return Library::null();
}
-
RawClass* IsolateReloadContext::OldClassOrNull(
const Class& replacement_or_new) {
UnorderedHashSet<ClassMapTraits> old_classes_set(old_classes_set_storage_);
@@ -1724,7 +1649,6 @@ RawClass* IsolateReloadContext::OldClassOrNull(
return cls.raw();
}
-
RawString* IsolateReloadContext::FindLibraryPrivateKey(
const Library& replacement_or_new) {
const Library& old = Library::Handle(OldLibraryOrNull(replacement_or_new));
@@ -1739,7 +1663,6 @@ RawString* IsolateReloadContext::FindLibraryPrivateKey(
return old.private_key();
}
-
RawLibrary* IsolateReloadContext::OldLibraryOrNull(
const Library& replacement_or_new) {
UnorderedHashSet<LibraryMapTraits> old_libraries_set(
@@ -1754,7 +1677,6 @@ RawLibrary* IsolateReloadContext::OldLibraryOrNull(
return lib.raw();
}
-
// Attempt to find the pair to |replacement_or_new| with the knowledge that
// the base url prefix has moved.
RawLibrary* IsolateReloadContext::OldLibraryOrNullBaseMoved(
@@ -1794,7 +1716,6 @@ RawLibrary* IsolateReloadContext::OldLibraryOrNullBaseMoved(
return Library::null();
}
-
void IsolateReloadContext::BuildLibraryMapping() {
const GrowableObjectArray& libs =
GrowableObjectArray::Handle(object_store()->libraries());
@@ -1822,7 +1743,6 @@ void IsolateReloadContext::BuildLibraryMapping() {
}
}
-
void IsolateReloadContext::AddClassMapping(const Class& replacement_or_new,
const Class& original) {
UnorderedHashMap<ClassMapTraits> map(class_map_storage_);
@@ -1833,7 +1753,6 @@ void IsolateReloadContext::AddClassMapping(const Class& replacement_or_new,
class_map_storage_ = map.Release().raw();
}
-
void IsolateReloadContext::AddLibraryMapping(const Library& replacement_or_new,
const Library& original) {
UnorderedHashMap<LibraryMapTraits> map(library_map_storage_);
@@ -1844,7 +1763,6 @@ void IsolateReloadContext::AddLibraryMapping(const Library& replacement_or_new,
library_map_storage_ = map.Release().raw();
}
-
void IsolateReloadContext::AddStaticFieldMapping(const Field& old_field,
const Field& new_field) {
ASSERT(old_field.is_static());
@@ -1853,7 +1771,6 @@ void IsolateReloadContext::AddStaticFieldMapping(const Field& old_field,
AddBecomeMapping(old_field, new_field);
}
-
void IsolateReloadContext::AddBecomeMapping(const Object& old,
const Object& neu) {
ASSERT(become_map_storage_ != Array::null());
@@ -1863,7 +1780,6 @@ void IsolateReloadContext::AddBecomeMapping(const Object& old,
become_map_storage_ = become_map.Release().raw();
}
-
void IsolateReloadContext::AddEnumBecomeMapping(const Object& old,
const Object& neu) {
const GrowableObjectArray& become_enum_mappings =
@@ -1873,7 +1789,6 @@ void IsolateReloadContext::AddEnumBecomeMapping(const Object& old,
ASSERT((become_enum_mappings.Length() % 2) == 0);
}
-
void IsolateReloadContext::RebuildDirectSubclasses() {
ClassTable* class_table = I->class_table();
intptr_t num_cids = class_table->NumCids();
« no previous file with comments | « runtime/vm/isolate_reload.h ('k') | runtime/vm/isolate_reload_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698