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

Unified Diff: src/objects-printer.cc

Issue 2711123002: [modules] When debug-printing a module, print its origin if possible. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-printer.cc
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index 53c35e9c639d5255c545b7b6819fb19d41a25c5d..f080eb3c41f5ac5d3d1095d83cea48b4073edfc7 100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -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";
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698