[modules] Add --trace-module-status for printing status transitions.
This is for debugging only. R=adamk@chromium.org Bug: v8:1569 Change-Id: I6526d3a98e96bb1267f1850268c5dc83a64587a6 Reviewed-on: https://chromium-review.googlesource.com/586590 Commit-Queue: Georg Neis <neis@chromium.org> Reviewed-by: Adam Klein <adamk@chromium.org> Cr-Commit-Position: refs/heads/master@{#46906}
This commit is contained in:
parent
a4663baa42
commit
a6f579eb2e
@ -1080,6 +1080,8 @@ DEFINE_BOOL(print_global_handles, false, "report global handles after GC")
|
||||
DEFINE_BOOL(trace_turbo_escape, false, "enable tracing in escape analysis")
|
||||
|
||||
// objects.cc
|
||||
DEFINE_BOOL(trace_module_status, false,
|
||||
"Trace status transitions of ECMAScript modules")
|
||||
DEFINE_BOOL(trace_normalization, false,
|
||||
"prints when objects are turned into dictionaries.")
|
||||
|
||||
|
@ -19662,10 +19662,27 @@ void Module::StoreVariable(Handle<Module> module, int cell_index,
|
||||
module->GetCell(cell_index)->set_value(*value);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void Module::PrintStatusTransition(Status new_status) {
|
||||
if (FLAG_trace_module_status) {
|
||||
OFStream os(stdout);
|
||||
os << "Changing module status from " << status() << " to " << new_status
|
||||
<< " for ";
|
||||
script()->GetNameOrSourceURL()->Print(os);
|
||||
#ifndef OBJECT_PRINT
|
||||
os << "\n";
|
||||
#endif // OBJECT_PRINT
|
||||
}
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
void Module::SetStatus(Status new_status) {
|
||||
DisallowHeapAllocation no_alloc;
|
||||
DCHECK_LE(status(), new_status);
|
||||
DCHECK_NE(new_status, Module::kErrored);
|
||||
#ifdef DEBUG
|
||||
PrintStatusTransition(new_status);
|
||||
#endif // DEBUG
|
||||
set_status(new_status);
|
||||
}
|
||||
|
||||
@ -19692,6 +19709,9 @@ void Module::RecordError() {
|
||||
set_code(info());
|
||||
|
||||
DCHECK(exception()->IsTheHole(isolate));
|
||||
#ifdef DEBUG
|
||||
PrintStatusTransition(Module::kErrored);
|
||||
#endif // DEBUG
|
||||
set_status(Module::kErrored);
|
||||
set_exception(the_exception);
|
||||
}
|
||||
|
@ -5057,6 +5057,11 @@ class Module : public Struct {
|
||||
void SetStatus(Status status);
|
||||
void RecordError();
|
||||
|
||||
#ifdef DEBUG
|
||||
// For --trace-module-status.
|
||||
void PrintStatusTransition(Status new_status);
|
||||
#endif // DEBUG
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Module);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user