[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());
|
AddToWeakNativeContextList(*native_context());
|
||||||
isolate->set_context(*native_context());
|
isolate->set_context(*native_context());
|
||||||
isolate->counters()->contexts_created_by_snapshot()->Increment();
|
isolate->counters()->contexts_created_by_snapshot()->Increment();
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
if (FLAG_trace_maps) {
|
if (FLAG_trace_maps) {
|
||||||
Handle<JSFunction> object_fun = isolate->object_function();
|
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",
|
PrintF("[TraceMap: InitialMap map= %p SFI= %d_Object ]\n",
|
||||||
reinterpret_cast<void*>(object_fun->initial_map()),
|
reinterpret_cast<void*>(object_fun->initial_map()), sfi_id);
|
||||||
object_fun->shared()->unique_id());
|
|
||||||
Map::TraceAllTransitions(object_fun->initial_map());
|
Map::TraceAllTransitions(object_fun->initial_map());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (context_snapshot_index == 0) {
|
if (context_snapshot_index == 0) {
|
||||||
Handle<JSGlobalObject> global_object =
|
Handle<JSGlobalObject> global_object =
|
||||||
|
@ -868,9 +868,7 @@ DEFINE_BOOL(trace_prototype_users, false,
|
|||||||
"Trace updates to prototype user tracking")
|
"Trace updates to prototype user tracking")
|
||||||
DEFINE_BOOL(use_verbose_printer, true, "allows verbose printing")
|
DEFINE_BOOL(use_verbose_printer, true, "allows verbose printing")
|
||||||
DEFINE_BOOL(trace_for_in_enumerate, false, "Trace for-in enumerate slow-paths")
|
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")
|
DEFINE_BOOL(trace_maps, false, "trace map creation")
|
||||||
#endif
|
|
||||||
|
|
||||||
// parser.cc
|
// parser.cc
|
||||||
DEFINE_BOOL(allow_natives_syntax, false, "allow natives syntax")
|
DEFINE_BOOL(allow_natives_syntax, false, "allow natives syntax")
|
||||||
|
@ -1611,8 +1611,7 @@ void PreParsedScopeData::PreParsedScopeDataPrint(std::ostream& os) { // NOLINT
|
|||||||
|
|
||||||
#endif // OBJECT_PRINT
|
#endif // OBJECT_PRINT
|
||||||
|
|
||||||
#if V8_TRACE_MAPS
|
// TODO(cbruni): remove once the new maptracer is in place.
|
||||||
|
|
||||||
void Name::NameShortPrint() {
|
void Name::NameShortPrint() {
|
||||||
if (this->IsString()) {
|
if (this->IsString()) {
|
||||||
PrintF("%s", String::cast(this)->ToCString().get());
|
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) {
|
int Name::NameShortPrint(Vector<char> str) {
|
||||||
if (this->IsString()) {
|
if (this->IsString()) {
|
||||||
return SNPrintF(str, "%s", String::cast(this)->ToCString().get());
|
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)
|
#if defined(DEBUG) || defined(OBJECT_PRINT)
|
||||||
// This method is only meant to be called from gdb for debugging purposes.
|
// 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
|
// 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);
|
NotifyMapChange(old_map, new_map, isolate);
|
||||||
|
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
if (FLAG_trace_maps) {
|
if (FLAG_trace_maps) {
|
||||||
PrintF("[TraceMaps: SlowToFast from= %p to= %p reason= %s ]\n",
|
PrintF("[TraceMaps: SlowToFast from= %p to= %p reason= %s ]\n",
|
||||||
reinterpret_cast<void*>(*old_map), reinterpret_cast<void*>(*new_map),
|
reinterpret_cast<void*>(*old_map), reinterpret_cast<void*>(*new_map),
|
||||||
reason);
|
reason);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (instance_descriptor_length == 0) {
|
if (instance_descriptor_length == 0) {
|
||||||
DisallowHeapAllocation no_gc;
|
DisallowHeapAllocation no_gc;
|
||||||
@ -9092,13 +9090,11 @@ Handle<Map> Map::Normalize(Handle<Map> fast_map, PropertyNormalizationMode mode,
|
|||||||
cache->Set(fast_map, new_map, cell);
|
cache->Set(fast_map, new_map, cell);
|
||||||
isolate->counters()->maps_normalized()->Increment();
|
isolate->counters()->maps_normalized()->Increment();
|
||||||
}
|
}
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
if (FLAG_trace_maps) {
|
if (FLAG_trace_maps) {
|
||||||
PrintF("[TraceMaps: Normalize from= %p to= %p reason= %s ]\n",
|
PrintF("[TraceMaps: Normalize from= %p to= %p reason= %s ]\n",
|
||||||
reinterpret_cast<void*>(*fast_map),
|
reinterpret_cast<void*>(*fast_map),
|
||||||
reinterpret_cast<void*>(*new_map), reason);
|
reinterpret_cast<void*>(*new_map), reason);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
fast_map->NotifyLeafMapLayoutChange();
|
fast_map->NotifyLeafMapLayoutChange();
|
||||||
return new_map;
|
return new_map;
|
||||||
@ -9263,8 +9259,6 @@ Handle<Map> Map::ShareDescriptor(Handle<Map> map,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void Map::TraceTransition(const char* what, Map* from, Map* to, Name* name) {
|
void Map::TraceTransition(const char* what, Map* from, Map* to, Name* name) {
|
||||||
if (FLAG_trace_maps) {
|
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,
|
void Map::ConnectTransition(Handle<Map> parent, Handle<Map> child,
|
||||||
Handle<Name> name, SimpleTransitionFlag flag) {
|
Handle<Name> name, SimpleTransitionFlag flag) {
|
||||||
Isolate* isolate = parent->GetIsolate();
|
Isolate* isolate = parent->GetIsolate();
|
||||||
@ -9314,14 +9306,10 @@ void Map::ConnectTransition(Handle<Map> parent, Handle<Map> child,
|
|||||||
}
|
}
|
||||||
if (parent->is_prototype_map()) {
|
if (parent->is_prototype_map()) {
|
||||||
DCHECK(child->is_prototype_map());
|
DCHECK(child->is_prototype_map());
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
Map::TraceTransition("NoTransition", *parent, *child, *name);
|
Map::TraceTransition("NoTransition", *parent, *child, *name);
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
TransitionsAccessor(parent).Insert(name, child, flag);
|
TransitionsAccessor(parent).Insert(name, child, flag);
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
Map::TraceTransition("Transition", *parent, *child, *name);
|
Map::TraceTransition("Transition", *parent, *child, *name);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9356,7 +9344,6 @@ Handle<Map> Map::CopyReplaceDescriptors(
|
|||||||
} else {
|
} else {
|
||||||
result->InitializeDescriptors(*descriptors, *layout_descriptor);
|
result->InitializeDescriptors(*descriptors, *layout_descriptor);
|
||||||
}
|
}
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
if (FLAG_trace_maps &&
|
if (FLAG_trace_maps &&
|
||||||
// Mirror conditions above that did not call ConnectTransition().
|
// Mirror conditions above that did not call ConnectTransition().
|
||||||
(map->is_prototype_map() ||
|
(map->is_prototype_map() ||
|
||||||
@ -9366,8 +9353,6 @@ Handle<Map> Map::CopyReplaceDescriptors(
|
|||||||
reinterpret_cast<void*>(*map), reinterpret_cast<void*>(*result),
|
reinterpret_cast<void*>(*map), reinterpret_cast<void*>(*result),
|
||||||
reason);
|
reason);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9553,13 +9538,11 @@ Handle<Map> Map::CopyForTransition(Handle<Map> map, const char* reason) {
|
|||||||
new_map->InitializeDescriptors(*new_descriptors, *new_layout_descriptor);
|
new_map->InitializeDescriptors(*new_descriptors, *new_layout_descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
if (FLAG_trace_maps) {
|
if (FLAG_trace_maps) {
|
||||||
PrintF("[TraceMaps: CopyForTransition from= %p to= %p reason= %s ]\n",
|
PrintF("[TraceMaps: CopyForTransition from= %p to= %p reason= %s ]\n",
|
||||||
reinterpret_cast<void*>(*map), reinterpret_cast<void*>(*new_map),
|
reinterpret_cast<void*>(*map), reinterpret_cast<void*>(*new_map),
|
||||||
reason);
|
reason);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return new_map;
|
return new_map;
|
||||||
}
|
}
|
||||||
@ -12810,13 +12793,15 @@ void JSFunction::SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
|
|||||||
if (map->prototype() != *prototype) Map::SetPrototype(map, prototype);
|
if (map->prototype() != *prototype) Map::SetPrototype(map, prototype);
|
||||||
function->set_prototype_or_initial_map(*map);
|
function->set_prototype_or_initial_map(*map);
|
||||||
map->SetConstructor(*function);
|
map->SetConstructor(*function);
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
if (FLAG_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",
|
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());
|
function->shared()->DebugName()->ToCString().get());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -837,10 +837,8 @@ class Map : public HeapObject {
|
|||||||
// Returns true if given field is unboxed double.
|
// Returns true if given field is unboxed double.
|
||||||
inline bool IsUnboxedDoubleField(FieldIndex index) const;
|
inline bool IsUnboxedDoubleField(FieldIndex index) const;
|
||||||
|
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
static void TraceTransition(const char* what, Map* from, Map* to, Name* name);
|
static void TraceTransition(const char* what, Map* from, Map* to, Name* name);
|
||||||
static void TraceAllTransitions(Map* map);
|
static void TraceAllTransitions(Map* map);
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline Handle<Map> AddMissingTransitionsForTesting(
|
static inline Handle<Map> AddMissingTransitionsForTesting(
|
||||||
Handle<Map> split_map, Handle<DescriptorArray> descriptors,
|
Handle<Map> split_map, Handle<DescriptorArray> descriptors,
|
||||||
|
@ -57,10 +57,8 @@ class Name : public HeapObject {
|
|||||||
DECL_CAST(Name)
|
DECL_CAST(Name)
|
||||||
|
|
||||||
DECL_PRINTER(Name)
|
DECL_PRINTER(Name)
|
||||||
#if V8_TRACE_MAPS
|
|
||||||
void NameShortPrint();
|
void NameShortPrint();
|
||||||
int NameShortPrint(Vector<char> str);
|
int NameShortPrint(Vector<char> str);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Layout description.
|
// Layout description.
|
||||||
static const int kHashFieldSlot = HeapObject::kHeaderSize;
|
static const int kHashFieldSlot = HeapObject::kHeaderSize;
|
||||||
@ -188,9 +186,8 @@ class Symbol : public Name {
|
|||||||
private:
|
private:
|
||||||
const char* PrivateSymbolToName() const;
|
const char* PrivateSymbolToName() const;
|
||||||
|
|
||||||
#if V8_TRACE_MAPS
|
// TODO(cbruni): remove once the new maptracer is in place.
|
||||||
friend class Name; // For PrivateSymbolToName.
|
friend class Name; // For PrivateSymbolToName.
|
||||||
#endif
|
|
||||||
|
|
||||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Symbol);
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Symbol);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user