Commit 32f60470 authored by neis's avatar neis Committed by Commit bot

[modules] When debug-printing a module, print its origin if possible.

BUG=v8:1569

Review-Url: https://codereview.chromium.org/2711123002
Cr-Commit-Position: refs/heads/master@{#43392}
parent c0651535
......@@ -1235,10 +1235,19 @@ void ModuleInfoEntry::ModuleInfoEntryPrint(std::ostream& os) { // NOLINT
void Module::ModulePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Module");
// TODO(neis): Simplify once modules have a script field.
if (!evaluated()) {
SharedFunctionInfo* shared = code()->IsSharedFunctionInfo()
? SharedFunctionInfo::cast(code())
: JSFunction::cast(code())->shared();
Object* origin = Script::cast(shared->script())->GetNameOrSourceURL();
os << "\n - origin: " << Brief(origin);
}
os << "\n - code: " << Brief(code());
os << "\n - exports: " << Brief(exports());
os << "\n - requested_modules: " << Brief(requested_modules());
os << "\n - evaluated: " << evaluated();
os << "\n - instantiated, evaluated: " << instantiated() << ", "
<< evaluated();
os << "\n";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment