[logging] Enable basic --trace-maps by default
This CL makes --trace-maps available in the default build by disabling certain expensive/intrusive features. This is an intermediate step to be able to write proper tests for --trace-maps and the new map-processor. Change-Id: Ib6a8fc9c77796c106d3af9d741d48abe6c6b9099 Reviewed-on: https://chromium-review.googlesource.com/734648 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#48891}
This commit is contained in:
parent
fbc419dfaa
commit
2940132ff3
@ -5376,15 +5376,16 @@ Genesis::Genesis(
|
||||
AddToWeakNativeContextList(*native_context());
|
||||
isolate->set_context(*native_context());
|
||||
isolate->counters()->contexts_created_by_snapshot()->Increment();
|
||||
#if V8_TRACE_MAPS
|
||||
if (FLAG_trace_maps) {
|
||||
Handle<JSFunction> object_fun = isolate->object_function();
|
||||
int sfi_id = -1;
|
||||
#if V8_SFI_HAS_UNIQUE_ID
|
||||
sfi_id = object_fun->shared()->unique_id();
|
||||
#endif // V8_SFI_HAS_UNIQUE_ID
|
||||
PrintF("[TraceMap: InitialMap map= %p SFI= %d_Object ]\n",
|
||||
reinterpret_cast<void*>(object_fun->initial_map()),
|
||||
object_fun->shared()->unique_id());
|
||||
reinterpret_cast<void*>(object_fun->initial_map()), sfi_id);
|
||||
Map::TraceAllTransitions(object_fun->initial_map());
|
||||
}
|
||||
#endif
|
||||
|
||||
if (context_snapshot_index == 0) {
|
||||
Handle<JSGlobalObject> global_object =
|
||||
|
@ -868,9 +868,7 @@ DEFINE_BOOL(trace_prototype_users, false,
|
||||
"Trace updates to prototype user tracking")
|
||||
DEFINE_BOOL(use_verbose_printer, true, "allows verbose printing")
|
||||
DEFINE_BOOL(trace_for_in_enumerate, false, "Trace for-in enumerate slow-paths")
|
||||
#if V8_TRACE_MAPS
|
||||
DEFINE_BOOL(trace_maps, false, "trace map creation")
|
||||
#endif
|
||||
|
||||
// parser.cc
|
||||
DEFINE_BOOL(allow_natives_syntax, false, "allow natives syntax")
|
||||
|
@ -1611,8 +1611,7 @@ void PreParsedScopeData::PreParsedScopeDataPrint(std::ostream& os) { // NOLINT
|
||||
|
||||
#endif // OBJECT_PRINT
|
||||
|
||||
#if V8_TRACE_MAPS
|
||||
|
||||
// TODO(cbruni): remove once the new maptracer is in place.
|
||||
void Name::NameShortPrint() {
|
||||
if (this->IsString()) {
|
||||
PrintF("%s", String::cast(this)->ToCString().get());
|
||||
@ -1627,7 +1626,7 @@ void Name::NameShortPrint() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO(cbruni): remove once the new maptracer is in place.
|
||||
int Name::NameShortPrint(Vector<char> str) {
|
||||
if (this->IsString()) {
|
||||
return SNPrintF(str, "%s", String::cast(this)->ToCString().get());
|
||||
@ -1642,8 +1641,6 @@ int Name::NameShortPrint(Vector<char> str) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // V8_TRACE_MAPS
|
||||
|
||||
#if defined(DEBUG) || defined(OBJECT_PRINT)
|
||||
// This method is only meant to be called from gdb for debugging purposes.
|
||||
// Since the string can also be in two-byte encoding, non-Latin1 characters
|
||||
|
@ -6245,13 +6245,11 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
|
||||
|
||||
NotifyMapChange(old_map, new_map, isolate);
|
||||
|
||||
#if V8_TRACE_MAPS
|
||||
if (FLAG_trace_maps) {
|
||||
PrintF("[TraceMaps: SlowToFast from= %p to= %p reason= %s ]\n",
|
||||
reinterpret_cast<void*>(*old_map), reinterpret_cast<void*>(*new_map),
|
||||
reason);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (instance_descriptor_length == 0) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
@ -9092,13 +9090,11 @@ Handle<Map> Map::Normalize(Handle<Map> fast_map, PropertyNormalizationMode mode,
|
||||
cache->Set(fast_map, new_map, cell);
|
||||
isolate->counters()->maps_normalized()->Increment();
|
||||
}
|
||||
#if V8_TRACE_MAPS
|
||||
if (FLAG_trace_maps) {
|
||||
PrintF("[TraceMaps: Normalize from= %p to= %p reason= %s ]\n",
|
||||
reinterpret_cast<void*>(*fast_map),
|
||||
reinterpret_cast<void*>(*new_map), reason);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
fast_map->NotifyLeafMapLayoutChange();
|
||||
return new_map;
|
||||
@ -9263,8 +9259,6 @@ Handle<Map> Map::ShareDescriptor(Handle<Map> map,
|
||||
return result;
|
||||
}
|
||||
|
||||
#if V8_TRACE_MAPS
|
||||
|
||||
// static
|
||||
void Map::TraceTransition(const char* what, Map* from, Map* to, Name* name) {
|
||||
if (FLAG_trace_maps) {
|
||||
@ -9289,8 +9283,6 @@ void Map::TraceAllTransitions(Map* map) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // V8_TRACE_MAPS
|
||||
|
||||
void Map::ConnectTransition(Handle<Map> parent, Handle<Map> child,
|
||||
Handle<Name> name, SimpleTransitionFlag flag) {
|
||||
Isolate* isolate = parent->GetIsolate();
|
||||
@ -9314,14 +9306,10 @@ void Map::ConnectTransition(Handle<Map> parent, Handle<Map> child,
|
||||
}
|
||||
if (parent->is_prototype_map()) {
|
||||
DCHECK(child->is_prototype_map());
|
||||
#if V8_TRACE_MAPS
|
||||
Map::TraceTransition("NoTransition", *parent, *child, *name);
|
||||
#endif
|
||||
} else {
|
||||
TransitionsAccessor(parent).Insert(name, child, flag);
|
||||
#if V8_TRACE_MAPS
|
||||
Map::TraceTransition("Transition", *parent, *child, *name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -9356,7 +9344,6 @@ Handle<Map> Map::CopyReplaceDescriptors(
|
||||
} else {
|
||||
result->InitializeDescriptors(*descriptors, *layout_descriptor);
|
||||
}
|
||||
#if V8_TRACE_MAPS
|
||||
if (FLAG_trace_maps &&
|
||||
// Mirror conditions above that did not call ConnectTransition().
|
||||
(map->is_prototype_map() ||
|
||||
@ -9366,8 +9353,6 @@ Handle<Map> Map::CopyReplaceDescriptors(
|
||||
reinterpret_cast<void*>(*map), reinterpret_cast<void*>(*result),
|
||||
reason);
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -9553,13 +9538,11 @@ Handle<Map> Map::CopyForTransition(Handle<Map> map, const char* reason) {
|
||||
new_map->InitializeDescriptors(*new_descriptors, *new_layout_descriptor);
|
||||
}
|
||||
|
||||
#if V8_TRACE_MAPS
|
||||
if (FLAG_trace_maps) {
|
||||
PrintF("[TraceMaps: CopyForTransition from= %p to= %p reason= %s ]\n",
|
||||
reinterpret_cast<void*>(*map), reinterpret_cast<void*>(*new_map),
|
||||
reason);
|
||||
}
|
||||
#endif
|
||||
|
||||
return new_map;
|
||||
}
|
||||
@ -12810,13 +12793,15 @@ void JSFunction::SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
|
||||
if (map->prototype() != *prototype) Map::SetPrototype(map, prototype);
|
||||
function->set_prototype_or_initial_map(*map);
|
||||
map->SetConstructor(*function);
|
||||
#if V8_TRACE_MAPS
|
||||
if (FLAG_trace_maps) {
|
||||
int sfi_id = -1;
|
||||
#if V8_SFI_HAS_UNIQUE_ID
|
||||
sfi_id = function->shared()->unique_id();
|
||||
#endif // V8_SFI_HAS_UNIQUE_ID
|
||||
PrintF("[TraceMaps: InitialMap map= %p SFI= %d_%s ]\n",
|
||||
reinterpret_cast<void*>(*map), function->shared()->unique_id(),
|
||||
reinterpret_cast<void*>(*map), sfi_id,
|
||||
function->shared()->DebugName()->ToCString().get());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -837,10 +837,8 @@ class Map : public HeapObject {
|
||||
// Returns true if given field is unboxed double.
|
||||
inline bool IsUnboxedDoubleField(FieldIndex index) const;
|
||||
|
||||
#if V8_TRACE_MAPS
|
||||
static void TraceTransition(const char* what, Map* from, Map* to, Name* name);
|
||||
static void TraceAllTransitions(Map* map);
|
||||
#endif
|
||||
|
||||
static inline Handle<Map> AddMissingTransitionsForTesting(
|
||||
Handle<Map> split_map, Handle<DescriptorArray> descriptors,
|
||||
|
@ -57,10 +57,8 @@ class Name : public HeapObject {
|
||||
DECL_CAST(Name)
|
||||
|
||||
DECL_PRINTER(Name)
|
||||
#if V8_TRACE_MAPS
|
||||
void NameShortPrint();
|
||||
int NameShortPrint(Vector<char> str);
|
||||
#endif
|
||||
|
||||
// Layout description.
|
||||
static const int kHashFieldSlot = HeapObject::kHeaderSize;
|
||||
@ -188,9 +186,8 @@ class Symbol : public Name {
|
||||
private:
|
||||
const char* PrivateSymbolToName() const;
|
||||
|
||||
#if V8_TRACE_MAPS
|
||||
// TODO(cbruni): remove once the new maptracer is in place.
|
||||
friend class Name; // For PrivateSymbolToName.
|
||||
#endif
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Symbol);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user