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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 os << "\n - import_name: " << Brief(import_name()); 1228 os << "\n - import_name: " << Brief(import_name());
1229 os << "\n - module_request: " << module_request(); 1229 os << "\n - module_request: " << module_request();
1230 os << "\n - cell_index: " << cell_index(); 1230 os << "\n - cell_index: " << cell_index();
1231 os << "\n - beg_pos: " << beg_pos(); 1231 os << "\n - beg_pos: " << beg_pos();
1232 os << "\n - end_pos: " << end_pos(); 1232 os << "\n - end_pos: " << end_pos();
1233 os << "\n"; 1233 os << "\n";
1234 } 1234 }
1235 1235
1236 void Module::ModulePrint(std::ostream& os) { // NOLINT 1236 void Module::ModulePrint(std::ostream& os) { // NOLINT
1237 HeapObject::PrintHeader(os, "Module"); 1237 HeapObject::PrintHeader(os, "Module");
1238 // TODO(neis): Simplify once modules have a script field.
1239 if (!evaluated()) {
1240 SharedFunctionInfo* shared = code()->IsSharedFunctionInfo()
1241 ? SharedFunctionInfo::cast(code())
1242 : JSFunction::cast(code())->shared();
1243 Object* origin = Script::cast(shared->script())->GetNameOrSourceURL();
1244 os << "\n - origin: " << Brief(origin);
1245 }
1238 os << "\n - code: " << Brief(code()); 1246 os << "\n - code: " << Brief(code());
1239 os << "\n - exports: " << Brief(exports()); 1247 os << "\n - exports: " << Brief(exports());
1240 os << "\n - requested_modules: " << Brief(requested_modules()); 1248 os << "\n - requested_modules: " << Brief(requested_modules());
1241 os << "\n - evaluated: " << evaluated(); 1249 os << "\n - instantiated, evaluated: " << instantiated() << ", "
1250 << evaluated();
1242 os << "\n"; 1251 os << "\n";
1243 } 1252 }
1244 1253
1245 void JSModuleNamespace::JSModuleNamespacePrint(std::ostream& os) { // NOLINT 1254 void JSModuleNamespace::JSModuleNamespacePrint(std::ostream& os) { // NOLINT
1246 JSObjectPrintHeader(os, this, "JSModuleNamespace"); 1255 JSObjectPrintHeader(os, this, "JSModuleNamespace");
1247 os << "\n - module: " << Brief(module()); 1256 os << "\n - module: " << Brief(module());
1248 JSObjectPrintBody(os, this); 1257 JSObjectPrintBody(os, this);
1249 } 1258 }
1250 1259
1251 void PrototypeInfo::PrototypeInfoPrint(std::ostream& os) { // NOLINT 1260 void PrototypeInfo::PrototypeInfoPrint(std::ostream& os) { // NOLINT
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 printf("Not a transition array\n"); 1701 printf("Not a transition array\n");
1693 } else { 1702 } else {
1694 reinterpret_cast<i::TransitionArray*>(object)->Print(); 1703 reinterpret_cast<i::TransitionArray*>(object)->Print();
1695 } 1704 }
1696 } 1705 }
1697 1706
1698 extern void _v8_internal_Print_StackTrace() { 1707 extern void _v8_internal_Print_StackTrace() {
1699 i::Isolate* isolate = i::Isolate::Current(); 1708 i::Isolate* isolate = i::Isolate::Current();
1700 isolate->PrintStack(stdout); 1709 isolate->PrintStack(stdout);
1701 } 1710 }
OLDNEW
« 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